1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
6#define CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
7
8#include "chrome/browser/remoting/setup_flow.h"
9#include "chrome/browser/service/service_process_control.h"
10#include "chrome/common/net/gaia/gaia_auth_consumer.h"
11#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
12
13namespace remoting {
14
15// SetupFlowStartHostStep is the final step in the remoting setup
16// flow. It starts the chromoting hosts and then requests current
17// state to verify that it was started successfully.
18class SetupFlowStartHostStep : public SetupFlowStepBase,
19                               public ServiceProcessControl::MessageHandler {
20 public:
21  SetupFlowStartHostStep();
22  virtual ~SetupFlowStartHostStep();
23
24  // SetupFlowStep implementation.
25  virtual void HandleMessage(const std::string& message, const Value* arg);
26  virtual void Cancel();
27
28  // ServiceProcessControl::MessageHandler interface
29  virtual void OnRemotingHostInfo(
30      const remoting::ChromotingHostInfo& host_info);
31
32 protected:
33  virtual void DoStart();
34
35 private:
36  void RequestStatus();
37
38  ScopedRunnableMethodFactory<SetupFlowStartHostStep> task_factory_;
39  ServiceProcessControl* process_control_;
40  bool status_requested_;
41
42  DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostStep);
43};
44
45class SetupFlowStartHostErrorStep : public SetupFlowErrorStepBase {
46 public:
47  SetupFlowStartHostErrorStep();
48  virtual ~SetupFlowStartHostErrorStep();
49
50 protected:
51  virtual string16 GetErrorMessage();
52  virtual void Retry();
53
54 private:
55  DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostErrorStep);
56};
57
58}  // namespace remoting
59
60#endif  // CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
61