diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 01:25:48 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 01:25:48 +0000 |
commit | ed31bae79de0365119170a992489ecc1ed85eaab (patch) | |
tree | 13828a84e2cbcc26ffcd980d4d471cc25d6c859d | |
parent | 761d342a5307a6b858a3bfd2feaa14eb4d9830ce (diff) | |
download | chromium_src-ed31bae79de0365119170a992489ecc1ed85eaab.zip chromium_src-ed31bae79de0365119170a992489ecc1ed85eaab.tar.gz chromium_src-ed31bae79de0365119170a992489ecc1ed85eaab.tar.bz2 |
Chromoting setup flow: implemented rest of setup flow steps.
BUG=67218
TEST=None
Review URL: http://codereview.chromium.org/6033005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70576 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow.cc | 7 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_get_status_step.cc | 92 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_get_status_step.h | 61 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_login_step.cc | 3 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_login_step.h | 3 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_register_step.cc | 70 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_register_step.h | 53 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_start_host_step.cc | 85 | ||||
-rw-r--r-- | chrome/browser/remoting/setup_flow_start_host_step.h | 60 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.cc | 15 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.h | 9 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control_browsertest.cc | 31 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 6 | ||||
-rw-r--r-- | chrome/common/service_messages_internal.h | 6 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.cc | 5 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.h | 1 |
17 files changed, 449 insertions, 61 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 4cfd1e6..966d6d5e 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8307,6 +8307,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE" desc="Message shown during remoting host setup if there was an error starting service process."> Unable to start service process. </message> + <message name="IDS_REMOTING_REGISTRATION_FAILED_MESSAGE" desc="Message shown during remoting host setup if there was an error registering the host."> + Failed to register this computer for remote access. + </message> <message name="IDS_REMOTING_RETRY_BUTTON_TEXT" desc="Text for retry button"> Retry </message> diff --git a/chrome/browser/remoting/setup_flow.cc b/chrome/browser/remoting/setup_flow.cc index f2b23c8..6070f1f 100644 --- a/chrome/browser/remoting/setup_flow.cc +++ b/chrome/browser/remoting/setup_flow.cc @@ -112,11 +112,8 @@ void SetupFlowDoneStep::DoStart() { ExecuteJavascriptInIFrame(kDoneIframeXPath, L"onPageShown();"); } -SetupFlowContext::SetupFlowContext() { -} - -SetupFlowContext::~SetupFlowContext() { -} +SetupFlowContext::SetupFlowContext() { } +SetupFlowContext::~SetupFlowContext() { } SetupFlow::SetupFlow(const std::string& args, Profile* profile, SetupFlowStep* first_step) diff --git a/chrome/browser/remoting/setup_flow_get_status_step.cc b/chrome/browser/remoting/setup_flow_get_status_step.cc new file mode 100644 index 0000000..1f03bb9 --- /dev/null +++ b/chrome/browser/remoting/setup_flow_get_status_step.cc @@ -0,0 +1,92 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/remoting/setup_flow_get_status_step.h" + +#include "app/l10n_util.h" +#include "chrome/browser/remoting/setup_flow_register_step.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/browser/service/service_process_control_manager.h" +#include "grit/generated_resources.h" + +namespace remoting { + +SetupFlowGetStatusStep::SetupFlowGetStatusStep() + : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), + status_requested_(false) { +} + +SetupFlowGetStatusStep::~SetupFlowGetStatusStep() { + if (process_control_) + process_control_->RemoveMessageHandler(this); +} + +void SetupFlowGetStatusStep::HandleMessage(const std::string& message, + const Value* arg) { +} + +void SetupFlowGetStatusStep::Cancel() { + if (process_control_) + process_control_->RemoveMessageHandler(this); +} + +void SetupFlowGetStatusStep::OnRemotingHostInfo( + const remoting::ChromotingHostInfo& host_info) { + if (status_requested_) { + flow()->context()->host_info = host_info; + status_requested_ = false; + FinishStep(new SetupFlowRegisterStep()); + } +} + +void SetupFlowGetStatusStep::DoStart() { + process_control_ = + ServiceProcessControlManager::GetInstance()->GetProcessControl( + flow()->profile()); + if (!process_control_->is_connected()) { + LaunchServiceProcess(); + } else { + RequestStatus(); + } +} + +void SetupFlowGetStatusStep::LaunchServiceProcess() { + Task* done_task = task_factory_.NewRunnableMethod( + &SetupFlowGetStatusStep::OnServiceProcessLaunched); + process_control_->Launch(done_task, done_task); +} + +void SetupFlowGetStatusStep::OnServiceProcessLaunched() { + if (!process_control_->is_connected()) { + // Failed to start service process. + FinishStep(new SetupFlowGetStatusErrorStep()); + } else { + RequestStatus(); + } +} + +void SetupFlowGetStatusStep::RequestStatus() { + DCHECK(!status_requested_); + + if (!process_control_->RequestRemotingHostStatus()) { + FinishStep(new SetupFlowGetStatusErrorStep()); + return; + } + + status_requested_ = true; + process_control_->AddMessageHandler(this); +} + +SetupFlowGetStatusErrorStep::SetupFlowGetStatusErrorStep() { } +SetupFlowGetStatusErrorStep::~SetupFlowGetStatusErrorStep() { } + +string16 SetupFlowGetStatusErrorStep::GetErrorMessage() { + return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE); +} + +void SetupFlowGetStatusErrorStep::Retry() { + FinishStep(new SetupFlowGetStatusStep()); +} + +} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_get_status_step.h b/chrome/browser/remoting/setup_flow_get_status_step.h new file mode 100644 index 0000000..7968d78e1 --- /dev/null +++ b/chrome/browser/remoting/setup_flow_get_status_step.h @@ -0,0 +1,61 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ +#define CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ + +#include "chrome/browser/remoting/setup_flow.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/common/net/gaia/gaia_auth_consumer.h" +#include "chrome/common/net/gaia/gaia_auth_fetcher.h" + +namespace remoting { + +// SetupFlowGetStatusStep requests current host information from the service +// process. It also starts service process if necessary. +class SetupFlowGetStatusStep : public SetupFlowStepBase, + public ServiceProcessControl::MessageHandler { + public: + SetupFlowGetStatusStep(); + virtual ~SetupFlowGetStatusStep(); + + // SetupFlowStep implementation. + virtual void HandleMessage(const std::string& message, const Value* arg); + virtual void Cancel(); + + // ServiceProcessControl::MessageHandler interface + virtual void OnRemotingHostInfo( + const remoting::ChromotingHostInfo& host_info); + + protected: + virtual void DoStart(); + + private: + void LaunchServiceProcess(); + void OnServiceProcessLaunched(); + void RequestStatus(); + + ScopedRunnableMethodFactory<SetupFlowGetStatusStep> task_factory_; + ServiceProcessControl* process_control_; + bool status_requested_; + + DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusStep); +}; + +class SetupFlowGetStatusErrorStep : public SetupFlowErrorStepBase { + public: + SetupFlowGetStatusErrorStep(); + virtual ~SetupFlowGetStatusErrorStep(); + + protected: + virtual string16 GetErrorMessage(); + virtual void Retry(); + + private: + DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusErrorStep); +}; + +} // namespace remoting + +#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ diff --git a/chrome/browser/remoting/setup_flow_login_step.cc b/chrome/browser/remoting/setup_flow_login_step.cc index 9b7cf7b..71ee79b 100644 --- a/chrome/browser/remoting/setup_flow_login_step.cc +++ b/chrome/browser/remoting/setup_flow_login_step.cc @@ -11,6 +11,7 @@ #include "base/values.h" #include "chrome/browser/dom_ui/dom_ui_util.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/remoting/setup_flow_get_status_step.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/net/gaia/google_service_auth_error.h" @@ -97,7 +98,7 @@ void SetupFlowLoginStep::OnIssueAuthTokenSuccess( flow()->context()->talk_token = auth_token; authenticator_.reset(); - FinishStep(new SetupFlowDoneStep()); + FinishStep(new SetupFlowGetStatusStep()); } void SetupFlowLoginStep::OnIssueAuthTokenFailure(const std::string& service, diff --git a/chrome/browser/remoting/setup_flow_login_step.h b/chrome/browser/remoting/setup_flow_login_step.h index 9aee6b5..a7d8911 100644 --- a/chrome/browser/remoting/setup_flow_login_step.h +++ b/chrome/browser/remoting/setup_flow_login_step.h @@ -24,8 +24,7 @@ class SetupFlowLoginStep : public SetupFlowStepBase, public GaiaAuthConsumer { // GaiaAuthConsumer implementation. virtual void OnClientLoginSuccess( const GaiaAuthConsumer::ClientLoginResult& credentials); - virtual void OnClientLoginFailure( - const GoogleServiceAuthError& error); + virtual void OnClientLoginFailure(const GoogleServiceAuthError& error); virtual void OnIssueAuthTokenSuccess(const std::string& service, const std::string& auth_token); virtual void OnIssueAuthTokenFailure(const std::string& service, diff --git a/chrome/browser/remoting/setup_flow_register_step.cc b/chrome/browser/remoting/setup_flow_register_step.cc new file mode 100644 index 0000000..95799b5 --- /dev/null +++ b/chrome/browser/remoting/setup_flow_register_step.cc @@ -0,0 +1,70 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/remoting/setup_flow_register_step.h" + +#include "app/l10n_util.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/remoting/setup_flow_login_step.h" +#include "chrome/browser/remoting/setup_flow_start_host_step.h" +#include "grit/generated_resources.h" + +namespace remoting { + +SetupFlowRegisterStep::SetupFlowRegisterStep() { } +SetupFlowRegisterStep::~SetupFlowRegisterStep() { } + +void SetupFlowRegisterStep::HandleMessage(const std::string& message, + const Value* arg) { +} + +void SetupFlowRegisterStep::Cancel() { + // Don't need to do anything here. Ther request will canceled when + // |request_| is destroyed. +} + +void SetupFlowRegisterStep::DoStart() { + request_.reset(new DirectoryAddRequest( + flow()->profile()->GetRequestContext())); + request_->AddHost(flow()->context()->host_info, + flow()->context()->remoting_token, + NewCallback(this, &SetupFlowRegisterStep::OnRequestDone)); +} + +void SetupFlowRegisterStep::OnRequestDone(DirectoryAddRequest::Result result, + const std::string& error_message) { + switch (result) { + case DirectoryAddRequest::SUCCESS: + FinishStep(new SetupFlowStartHostStep()); + break; + case DirectoryAddRequest::ERROR_EXISTS: + LOG(INFO) << "Chromoting host is already reagistered."; + FinishStep(new SetupFlowStartHostStep()); + break; + case DirectoryAddRequest::ERROR_AUTH: + LOG(ERROR) << "Chromoting Directory didn't accept auth token."; + FinishStep(new SetupFlowLoginStep()); + break; + default: + LOG(ERROR) << "Chromoting Host registration failed: " + << error_message << " (" << result << ")"; + FinishStep(new SetupFlowRegisterErrorStep()); + break; + } +} + +SetupFlowRegisterErrorStep::SetupFlowRegisterErrorStep() { } +SetupFlowRegisterErrorStep::~SetupFlowRegisterErrorStep() { } + +string16 SetupFlowRegisterErrorStep::GetErrorMessage() { + return l10n_util::GetStringUTF16(IDS_REMOTING_REGISTRATION_FAILED_MESSAGE); +} + +void SetupFlowRegisterErrorStep::Retry() { + // When retrying we retry from the GetStatus step because it may be + // necessary to start service process. + FinishStep(new SetupFlowRegisterStep()); +} + +} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_register_step.h b/chrome/browser/remoting/setup_flow_register_step.h new file mode 100644 index 0000000..d8b9fe7 --- /dev/null +++ b/chrome/browser/remoting/setup_flow_register_step.h @@ -0,0 +1,53 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ +#define CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ + +#include "chrome/browser/remoting/directory_add_request.h" +#include "chrome/browser/remoting/setup_flow.h" +#include "chrome/common/net/gaia/gaia_auth_consumer.h" +#include "chrome/common/net/gaia/gaia_auth_fetcher.h" + +namespace remoting { + +// Implementation of host registration step for remoting setup flow. +class SetupFlowRegisterStep : public SetupFlowStepBase { + public: + SetupFlowRegisterStep(); + virtual ~SetupFlowRegisterStep(); + + // SetupFlowStep implementation. + virtual void HandleMessage(const std::string& message, + const Value* arg); + virtual void Cancel(); + + protected: + virtual void DoStart(); + + void OnRequestDone(DirectoryAddRequest::Result result, + const std::string& error_message); + + private: + scoped_ptr<DirectoryAddRequest> request_; + + DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterStep); +}; + +class SetupFlowRegisterErrorStep : public SetupFlowErrorStepBase { + public: + SetupFlowRegisterErrorStep(); + virtual ~SetupFlowRegisterErrorStep(); + + protected: + virtual string16 GetErrorMessage(); + virtual void Retry(); + + private: + DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterErrorStep); +}; + +} // namespace remoting + +#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ diff --git a/chrome/browser/remoting/setup_flow_start_host_step.cc b/chrome/browser/remoting/setup_flow_start_host_step.cc new file mode 100644 index 0000000..19094de --- /dev/null +++ b/chrome/browser/remoting/setup_flow_start_host_step.cc @@ -0,0 +1,85 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/remoting/setup_flow_start_host_step.h" + +#include "app/l10n_util.h" +#include "chrome/browser/remoting/setup_flow_get_status_step.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/browser/service/service_process_control_manager.h" +#include "grit/generated_resources.h" + +namespace remoting { + +SetupFlowStartHostStep::SetupFlowStartHostStep() + : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), + status_requested_(false) { +} + +SetupFlowStartHostStep::~SetupFlowStartHostStep() { + if (process_control_) + process_control_->RemoveMessageHandler(this); +} + +void SetupFlowStartHostStep::HandleMessage(const std::string& message, + const Value* arg) { +} + +void SetupFlowStartHostStep::Cancel() { + if (process_control_) + process_control_->RemoveMessageHandler(this); +} + +void SetupFlowStartHostStep::OnRemotingHostInfo( + const remoting::ChromotingHostInfo& host_info) { + if (status_requested_) { + status_requested_ = false; + if (host_info.enabled) { + FinishStep(new SetupFlowDoneStep()); + } else { + FinishStep(new SetupFlowStartHostErrorStep()); + } + } +} + +void SetupFlowStartHostStep::DoStart() { + process_control_ = + ServiceProcessControlManager::GetInstance()->GetProcessControl( + flow()->profile()); + if (!process_control_ || !process_control_->is_connected()) { + FinishStep(new SetupFlowStartHostErrorStep()); + } + + process_control_->SetRemotingHostCredentials(flow()->context()->login, + flow()->context()->talk_token); + process_control_->EnableRemotingHost(); + RequestStatus(); +} + +void SetupFlowStartHostStep::RequestStatus() { + DCHECK(!status_requested_); + + if (!process_control_->RequestRemotingHostStatus()) { + FinishStep(new SetupFlowStartHostErrorStep()); + return; + } + + status_requested_ = true; + process_control_->AddMessageHandler(this); +} + +SetupFlowStartHostErrorStep::SetupFlowStartHostErrorStep() { } +SetupFlowStartHostErrorStep::~SetupFlowStartHostErrorStep() { } + +string16 SetupFlowStartHostErrorStep::GetErrorMessage() { + return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE); +} + +void SetupFlowStartHostErrorStep::Retry() { + // When retrying we retry from the GetStatus step because it may be + // necessary to start service process. + FinishStep(new SetupFlowGetStatusStep()); +} + +} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_start_host_step.h b/chrome/browser/remoting/setup_flow_start_host_step.h new file mode 100644 index 0000000..2780ad7 --- /dev/null +++ b/chrome/browser/remoting/setup_flow_start_host_step.h @@ -0,0 +1,60 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ +#define CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ + +#include "chrome/browser/remoting/setup_flow.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/common/net/gaia/gaia_auth_consumer.h" +#include "chrome/common/net/gaia/gaia_auth_fetcher.h" + +namespace remoting { + +// SetupFlowStartHostStep is the final step in the remoting setup +// flow. It starts the chromoting hosts and then requests current +// state to verify that it was started successfully. +class SetupFlowStartHostStep : public SetupFlowStepBase, + public ServiceProcessControl::MessageHandler { + public: + SetupFlowStartHostStep(); + virtual ~SetupFlowStartHostStep(); + + // SetupFlowStep implementation. + virtual void HandleMessage(const std::string& message, const Value* arg); + virtual void Cancel(); + + // ServiceProcessControl::MessageHandler interface + virtual void OnRemotingHostInfo( + const remoting::ChromotingHostInfo& host_info); + + protected: + virtual void DoStart(); + + private: + void RequestStatus(); + + ScopedRunnableMethodFactory<SetupFlowStartHostStep> task_factory_; + ServiceProcessControl* process_control_; + bool status_requested_; + + DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostStep); +}; + +class SetupFlowStartHostErrorStep : public SetupFlowErrorStepBase { + public: + SetupFlowStartHostErrorStep(); + virtual ~SetupFlowStartHostErrorStep(); + + protected: + virtual string16 GetErrorMessage(); + virtual void Retry(); + + private: + DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostErrorStep); +}; + +} // namespace remoting + +#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 2873ddc..0ca4729 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -238,9 +238,8 @@ void ServiceProcessControl::OnProcessLaunched() { } bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { - bool handled = true;; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message) - IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay) IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, OnCloudPrintProxyIsEnabled) IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo, @@ -277,14 +276,6 @@ void ServiceProcessControl::Observe(NotificationType type, } } -void ServiceProcessControl::OnGoodDay() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - for (std::set<MessageHandler*>::iterator it = message_handlers_.begin(); - it != message_handlers_.end(); ++it) { - (*it)->OnGoodDay(); - } -} - void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled, std::string email) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -310,10 +301,6 @@ bool ServiceProcessControl::GetCloudPrintProxyStatus( return Send(new ServiceMsg_IsCloudPrintProxyEnabled); } -bool ServiceProcessControl::SendHello() { - return Send(new ServiceMsg_Hello()); -} - bool ServiceProcessControl::Shutdown() { bool ret = Send(new ServiceMsg_Shutdown()); channel_.reset(); diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index 78c3141..c2f18ba 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -49,10 +49,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, public: virtual ~MessageHandler() {} - // This is a test signal sent from the service process. This can be used - // the healthiness of the service. - virtual void OnGoodDay() = 0; - // Called when we receive reply to remoting host status request. virtual void OnRemotingHostInfo( const remoting::ChromotingHostInfo& host_info) = 0; @@ -96,14 +92,9 @@ class ServiceProcessControl : public IPC::Channel::Sender, const NotificationDetails& details); // Message handlers - void OnGoodDay(); void OnCloudPrintProxyIsEnabled(bool enabled, std::string email); void OnRemotingHostInfo(remoting::ChromotingHostInfo host_info); - // Send a hello message to the service process for testing purpose. - // Return true if the message was sent. - bool SendHello(); - // Send a shutdown message to the service process. IPC channel will be // destroyed after calling this method. // Return true if the message was sent. diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc index 519c005..9087b8d 100644 --- a/chrome/browser/service/service_process_control_browsertest.cc +++ b/chrome/browser/service/service_process_control_browsertest.cc @@ -13,8 +13,7 @@ #include "chrome/test/ui_test_utils.h" class ServiceProcessControlBrowserTest - : public InProcessBrowserTest, - public ServiceProcessControl::MessageHandler { + : public InProcessBrowserTest { public: ServiceProcessControlBrowserTest() : service_process_handle_(base::kNullProcessHandle) { @@ -46,12 +45,18 @@ class ServiceProcessControlBrowserTest ui_test_utils::RunMessageLoop(); } - void SayHelloAndWait() { - // Send a hello message to the service process and wait for a reply. - process()->SendHello(); + // Send a remoting host status request and wait reply from the service. + void SendRequestAndWait() { + process()->GetCloudPrintProxyStatus(NewCallback( + this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback)); ui_test_utils::RunMessageLoop(); } + void CloudPrintStatusCallback( + bool enabled, std::string email) { + MessageLoop::current()->Quit(); + } + void Disconnect() { // This will delete all instances of ServiceProcessControl and close the IPC // connections. @@ -72,7 +77,6 @@ class ServiceProcessControlBrowserTest service_pid, base::kProcessAccessWaitForTermination, &service_process_handle_)); - process()->AddMessageHandler(this); // Quit the current message. Post a QuitTask instead of just calling Quit() // because this can get invoked in the context of a Launch() call and we // may not be in Run() yet. @@ -85,15 +89,6 @@ class ServiceProcessControlBrowserTest MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); } - // ServiceProcessControl::MessageHandler implementations. - virtual void OnGoodDay() { - MessageLoop::current()->Quit(); - } - - virtual void OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) { - } - ServiceProcessControl* process() { return process_; } private: @@ -109,7 +104,7 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, LaunchAndIPC) { // Make sure we are connected to the service process. EXPECT_TRUE(process()->is_connected()); - SayHelloAndWait(); + SendRequestAndWait(); // And then shutdown the service process. EXPECT_TRUE(process()->Shutdown()); @@ -123,12 +118,12 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, LaunchTwice) { // Make sure we are connected to the service process. EXPECT_TRUE(process()->is_connected()); - SayHelloAndWait(); + SendRequestAndWait(); // Launch the service process again. LaunchServiceProcessControl(); EXPECT_TRUE(process()->is_connected()); - SayHelloAndWait(); + SendRequestAndWait(); // And then shutdown the service process. EXPECT_TRUE(process()->Shutdown()); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 06f0d79..f2081db 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2116,8 +2116,14 @@ 'browser/remoting/remoting_setup_message_handler.h', 'browser/remoting/setup_flow.cc', 'browser/remoting/setup_flow.h', + 'browser/remoting/setup_flow_get_status_step.cc', + 'browser/remoting/setup_flow_get_status_step.h', 'browser/remoting/setup_flow_login_step.cc', 'browser/remoting/setup_flow_login_step.h', + 'browser/remoting/setup_flow_register_step.cc', + 'browser/remoting/setup_flow_register_step.h', + 'browser/remoting/setup_flow_start_host_step.cc', + 'browser/remoting/setup_flow_start_host_step.h', 'browser/remove_rows_table_model.h', 'browser/renderer_host/async_resource_handler.cc', 'browser/renderer_host/async_resource_handler.h', diff --git a/chrome/common/service_messages_internal.h b/chrome/common/service_messages_internal.h index 94a0215..5c35def 100644 --- a/chrome/common/service_messages_internal.h +++ b/chrome/common/service_messages_internal.h @@ -29,9 +29,6 @@ IPC_MESSAGE_CONTROL0(ServiceMsg_DisableCloudPrintProxy) // enabled. IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled) -// This message is for testing purpose. -IPC_MESSAGE_CONTROL0(ServiceMsg_Hello) - // Set credentials used by the RemotingHost. IPC_MESSAGE_CONTROL2(ServiceMsg_SetRemotingHostCredentials, std::string, /* username */ @@ -65,6 +62,3 @@ IPC_MESSAGE_CONTROL2(ServiceHostMsg_CloudPrintProxy_IsEnabled, IPC_MESSAGE_CONTROL1(ServiceHostMsg_RemotingHost_HostInfo, remoting::ChromotingHostInfo /* host_info */) - -// Sent from the service process in response to a Hello message. -IPC_MESSAGE_CONTROL0(ServiceHostMsg_GoodDay) diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index aa4d8ec..978d348 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -98,7 +98,6 @@ bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, OnGetRemotingHostInfo) #endif // defined(ENABLE_REMOTING) - IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); IPC_MESSAGE_UNHANDLED(handled = false) @@ -150,10 +149,6 @@ void ServiceIPCServer::OnDisableCloudPrintProxy() { g_service_process->GetCloudPrintProxy()->DisableForUser(); } -void ServiceIPCServer::OnHello() { - channel_->Send(new ServiceHostMsg_GoodDay()); -} - void ServiceIPCServer::OnShutdown() { g_service_process->Shutdown(); } diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h index bff4f45..29c8dc26 100644 --- a/chrome/service/service_ipc_server.h +++ b/chrome/service/service_ipc_server.h @@ -54,7 +54,6 @@ class ServiceIPCServer : public IPC::Channel::Listener, void OnGetRemotingHostInfo(); #endif // defined(ENABLE_REMOTING) - void OnHello(); void OnShutdown(); void OnUpdateAvailable(); |