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_GET_STATUS_STEP_H_
6#define CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_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// SetupFlowGetStatusStep requests current host information from the service
16// process. It also starts service process if necessary.
17class SetupFlowGetStatusStep : public SetupFlowStepBase,
18                               public ServiceProcessControl::MessageHandler {
19 public:
20  SetupFlowGetStatusStep();
21  virtual ~SetupFlowGetStatusStep();
22
23  // SetupFlowStep implementation.
24  virtual void HandleMessage(const std::string& message, const Value* arg);
25  virtual void Cancel();
26
27  // ServiceProcessControl::MessageHandler interface
28  virtual void OnRemotingHostInfo(
29      const remoting::ChromotingHostInfo& host_info);
30
31 protected:
32  virtual void DoStart();
33
34 private:
35  void LaunchServiceProcess();
36  void OnServiceProcessLaunched();
37  void RequestStatus();
38
39  ScopedRunnableMethodFactory<SetupFlowGetStatusStep> task_factory_;
40  ServiceProcessControl* process_control_;
41  bool status_requested_;
42
43  DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusStep);
44};
45
46class SetupFlowGetStatusErrorStep : public SetupFlowErrorStepBase {
47 public:
48  SetupFlowGetStatusErrorStep();
49  virtual ~SetupFlowGetStatusErrorStep();
50
51 protected:
52  virtual string16 GetErrorMessage();
53  virtual void Retry();
54
55 private:
56  DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusErrorStep);
57};
58
59}  // namespace remoting
60
61#endif  // CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_
62