diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:31:40 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:31:40 +0000 |
commit | 809e10f57b8bbfb1b780e3963a7466b15aef45bf (patch) | |
tree | 00b8867d566bf0c968b519bac4f036846d0c1612 /chrome/browser/service | |
parent | 1edeeaf2c02be8d62dd57a348b6a4d0e57604448 (diff) | |
download | chromium_src-809e10f57b8bbfb1b780e3963a7466b15aef45bf.zip chromium_src-809e10f57b8bbfb1b780e3963a7466b15aef45bf.tar.gz chromium_src-809e10f57b8bbfb1b780e3963a7466b15aef45bf.tar.bz2 |
Remove chromoting host registration from service process. More IPCs to control
host state.
BUG=None
TEST=Unittests.
Review URL: http://codereview.chromium.org/5955001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/service')
-rw-r--r-- | chrome/browser/service/service_process_control.cc | 43 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.h | 25 |
2 files changed, 52 insertions, 16 deletions
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index bd98319..dfba80a 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -243,6 +243,8 @@ void ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay) IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, OnCloudPrintProxyIsEnabled) + IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo, + OnRemotingHostInfo) IPC_END_MESSAGE_MAP() } @@ -273,7 +275,6 @@ void ServiceProcessControl::Observe(NotificationType type, } } - void ServiceProcessControl::OnGoodDay() { if (!message_handler_) return; @@ -290,6 +291,22 @@ void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled, } } +void ServiceProcessControl::OnRemotingHostInfo( + remoting::ChromotingHostInfo host_info) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (remoting_host_status_callback_ != NULL) { + remoting_host_status_callback_->Run(host_info); + remoting_host_status_callback_.reset(); + } +} + +bool ServiceProcessControl::GetCloudPrintProxyStatus( + Callback2<bool, std::string>::Type* cloud_print_status_callback) { + DCHECK(cloud_print_status_callback); + cloud_print_status_callback_.reset(cloud_print_status_callback); + return Send(new ServiceMsg_IsCloudPrintProxyEnabled); +} + bool ServiceProcessControl::SendHello() { return Send(new ServiceMsg_Hello()); } @@ -300,20 +317,26 @@ bool ServiceProcessControl::Shutdown() { return ret; } -bool ServiceProcessControl::EnableRemotingWithTokens( +bool ServiceProcessControl::SetRemotingHostCredentials( const std::string& user, - const std::string& remoting_token, const std::string& talk_token) { return Send( - new ServiceMsg_EnableRemotingWithTokens(user, remoting_token, - talk_token)); + new ServiceMsg_SetRemotingHostCredentials(user, talk_token)); } -bool ServiceProcessControl::GetCloudPrintProxyStatus( - Callback2<bool, std::string>::Type* cloud_print_status_callback) { - DCHECK(cloud_print_status_callback); - cloud_print_status_callback_.reset(cloud_print_status_callback); - return Send(new ServiceMsg_IsCloudPrintProxyEnabled); +bool ServiceProcessControl::EnableRemotingHost() { + return Send(new ServiceMsg_EnableRemotingHost()); +} + +bool ServiceProcessControl::DisableRemotingHost() { + return Send(new ServiceMsg_DisableRemotingHost()); +} + +bool ServiceProcessControl::GetRemotingHostStatus( + GetRemotingHostStatusCallback* status_callback) { + DCHECK(status_callback); + remoting_host_status_callback_.reset(status_callback); + return Send(new ServiceMsg_GetRemotingHostInfo); } DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl); diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index ff22eb3..efbd545 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -20,6 +20,10 @@ class Profile; +namespace remoting { +struct ChromotingHostInfo; +} // namespace remoting + // A ServiceProcessControl works as a portal between the service process and // the browser process. // @@ -36,6 +40,8 @@ class ServiceProcessControl : public IPC::Channel::Sender, public: typedef IDMap<ServiceProcessControl>::iterator iterator; typedef std::queue<IPC::Message> MessageQueue; + typedef Callback1<const remoting::ChromotingHostInfo&>::Type + GetRemotingHostStatusCallback; // An interface for handling messages received from the service process. class MessageHandler { @@ -86,6 +92,7 @@ class ServiceProcessControl : public IPC::Channel::Sender, // 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. @@ -96,12 +103,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, // Return true if the message was sent. bool Shutdown(); - // Send a message to enable the remoting service in the service process. - // Return true if the message was sent. - bool EnableRemotingWithTokens(const std::string& user, - const std::string& remoting_token, - const std::string& talk_token); - // Send a message to the service process to request a response // containing the enablement status of the cloud print proxy and the // registered email address. The callback gets the information when @@ -109,6 +110,17 @@ class ServiceProcessControl : public IPC::Channel::Sender, bool GetCloudPrintProxyStatus( Callback2<bool, std::string>::Type* cloud_print_status_callback); + // Send a message to enable the remoting service in the service process. + // Return true if the message was sent. + bool SetRemotingHostCredentials(const std::string& user, + const std::string& auth_token); + + bool EnableRemotingHost(); + bool DisableRemotingHost(); + + bool GetRemotingHostStatus( + GetRemotingHostStatusCallback* status_callback); + // Set the message handler for receiving messages from the service process. // TODO(hclam): Allow more than 1 handler. void SetMessageHandler(MessageHandler* message_handler) { @@ -149,6 +161,7 @@ class ServiceProcessControl : public IPC::Channel::Sender, // Callback that gets invoked when a status message is received from // the cloud print proxy. scoped_ptr<Callback2<bool, std::string>::Type> cloud_print_status_callback_; + scoped_ptr<GetRemotingHostStatusCallback> remoting_host_status_callback_; // Handler for messages from service process. MessageHandler* message_handler_; |