Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/remoting/setup_flow_get_status_step.cc

Issue 6955010: Remove the Remoting Host component from Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove an errant include. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #include "chrome/browser/remoting/setup_flow_get_status_step.h"
6
7 #include "chrome/browser/remoting/setup_flow_register_step.h"
8 #include "chrome/browser/service/service_process_control.h"
9 #include "chrome/browser/service/service_process_control_manager.h"
10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h"
12
13 namespace remoting {
14
15 SetupFlowGetStatusStep::SetupFlowGetStatusStep()
16 : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
17 status_requested_(false) {
18 }
19
20 SetupFlowGetStatusStep::~SetupFlowGetStatusStep() {
21 if (process_control_)
22 process_control_->RemoveMessageHandler(this);
23 }
24
25 void SetupFlowGetStatusStep::HandleMessage(const std::string& message,
26 const Value* arg) {
27 }
28
29 void SetupFlowGetStatusStep::Cancel() {
30 if (process_control_)
31 process_control_->RemoveMessageHandler(this);
32 }
33
34 void SetupFlowGetStatusStep::OnRemotingHostInfo(
35 const remoting::ChromotingHostInfo& host_info) {
36 if (status_requested_) {
37 flow()->context()->host_info = host_info;
38 status_requested_ = false;
39 FinishStep(new SetupFlowRegisterStep());
40 }
41 }
42
43 void SetupFlowGetStatusStep::DoStart() {
44 flow()->web_ui()->CallJavascriptFunction("showSettingUp");
45
46 process_control_ =
47 ServiceProcessControlManager::GetInstance()->GetProcessControl(
48 flow()->profile());
49 if (!process_control_->is_connected()) {
50 LaunchServiceProcess();
51 } else {
52 RequestStatus();
53 }
54 }
55
56 void SetupFlowGetStatusStep::LaunchServiceProcess() {
57 Task* done_task = task_factory_.NewRunnableMethod(
58 &SetupFlowGetStatusStep::OnServiceProcessLaunched);
59 process_control_->Launch(done_task, done_task);
60 }
61
62 void SetupFlowGetStatusStep::OnServiceProcessLaunched() {
63 if (!process_control_->is_connected()) {
64 // Failed to start service process.
65 FinishStep(new SetupFlowGetStatusErrorStep());
66 } else {
67 RequestStatus();
68 }
69 }
70
71 void SetupFlowGetStatusStep::RequestStatus() {
72 DCHECK(!status_requested_);
73
74 if (!process_control_->RequestRemotingHostStatus()) {
75 FinishStep(new SetupFlowGetStatusErrorStep());
76 return;
77 }
78
79 status_requested_ = true;
80 process_control_->AddMessageHandler(this);
81 }
82
83 SetupFlowGetStatusErrorStep::SetupFlowGetStatusErrorStep() { }
84 SetupFlowGetStatusErrorStep::~SetupFlowGetStatusErrorStep() { }
85
86 string16 SetupFlowGetStatusErrorStep::GetErrorMessage() {
87 return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE);
88 }
89
90 void SetupFlowGetStatusErrorStep::Retry() {
91 FinishStep(new SetupFlowGetStatusStep());
92 }
93
94 } // namespace remoting
OLDNEW
« no previous file with comments | « chrome/browser/remoting/setup_flow_get_status_step.h ('k') | chrome/browser/remoting/setup_flow_login_step.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698