diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 20:41:35 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 20:41:35 +0000 |
commit | de119cf2b1e0cc6b6ab2352812adb14726633413 (patch) | |
tree | a43fe7e052f03a0bd9c3a54c317c2a8a71f7df8d /chrome/service | |
parent | e64648531fc7386c139dffadefa746996264b90f (diff) | |
download | chromium_src-de119cf2b1e0cc6b6ab2352812adb14726633413.zip chromium_src-de119cf2b1e0cc6b6ab2352812adb14726633413.tar.gz chromium_src-de119cf2b1e0cc6b6ab2352812adb14726633413.tar.bz2 |
Changed the IPC between the browser and the service process to return more detailed information about the cloud print proxy. This is a first step towards the new login mechanism for Cloud Print.
BUG=None
TEST=Unit-tests, enabling disabling cloud print proxy
Review URL: http://codereview.chromium.org/7001012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/cloud_print_proxy.cc | 15 | ||||
-rw-r--r-- | chrome/service/cloud_print/cloud_print_proxy.h | 9 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.cc | 21 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.h | 4 |
4 files changed, 23 insertions, 26 deletions
diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc index 8a99596..39ffffc 100644 --- a/chrome/service/cloud_print/cloud_print_proxy.cc +++ b/chrome/service/cloud_print/cloud_print_proxy.cc @@ -9,6 +9,7 @@ #include "base/process_util.h" #include "base/values.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/cloud_print/cloud_print_proxy_info.h" #include "chrome/common/net/gaia/gaia_oauth_client.h" #include "chrome/common/pref_names.h" #include "chrome/service/cloud_print/cloud_print_consts.h" @@ -150,11 +151,14 @@ void CloudPrintProxy::DisableForUser() { } } -bool CloudPrintProxy::IsEnabled(std::string* email) const { - if (enabled_ && email) { - *email = user_email(); - } - return enabled_; +void CloudPrintProxy::GetProxyInfo(cloud_print::CloudPrintProxyInfo* info) { + info->enabled = enabled_; + info->email.clear(); + info->proxy_id.clear(); + if (enabled_) + info->email = user_email(); + if (service_prefs_) + service_prefs_->GetString(prefs::kCloudPrintProxyId, &info->proxy_id); } // Notification methods from the backend. Called on UI thread. @@ -217,3 +221,4 @@ void CloudPrintProxy::Shutdown() { backend_->Shutdown(); backend_.reset(); } + diff --git a/chrome/service/cloud_print/cloud_print_proxy.h b/chrome/service/cloud_print/cloud_print_proxy.h index 2ff6dfb..8510a5b 100644 --- a/chrome/service/cloud_print/cloud_print_proxy.h +++ b/chrome/service/cloud_print/cloud_print_proxy.h @@ -15,6 +15,10 @@ class ServiceProcessPrefs; +namespace cloud_print { +struct CloudPrintProxyInfo; +} // namespace cloud_print + // CloudPrintProxy is the layer between the service process UI thread // and the cloud print proxy backend. class CloudPrintProxy : public CloudPrintProxyFrontend, @@ -36,9 +40,8 @@ class CloudPrintProxy : public CloudPrintProxyFrontend, // Enables/disables cloud printing for the user void EnableForUser(const std::string& lsid); void DisableForUser(); - // Returns the enabled stata of the proxy. If enabled, the email address used - // for authentication is also returned in the optional |email| argument. - bool IsEnabled(std::string* email) const; + // Returns the proxy info. + void GetProxyInfo(cloud_print::CloudPrintProxyInfo* info); const std::string& user_email() const { return user_email_; diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index 493831e..6f08401 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -101,12 +101,10 @@ bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, OnEnableCloudPrintProxy) - IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, - OnEnableCloudPrintProxyWithTokens) IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, OnDisableCloudPrintProxy) - IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, - OnIsCloudPrintProxyEnabled) + IPC_MESSAGE_HANDLER(ServiceMsg_GetCloudPrintProxyInfo, + OnGetCloudPrintProxyInfo) IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); IPC_MESSAGE_UNHANDLED(handled = false) @@ -118,17 +116,10 @@ void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); } -void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( - const std::string& cloud_print_token, const std::string& talk_token) { - // TODO(sanjeevr): Implement this. - NOTIMPLEMENTED(); -} - -void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { - std::string email; - bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); - channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, - email)); +void ServiceIPCServer::OnGetCloudPrintProxyInfo() { + cloud_print::CloudPrintProxyInfo info; + g_service_process->GetCloudPrintProxy()->GetProxyInfo(&info); + channel_->Send(new ServiceHostMsg_CloudPrintProxy_Info(info)); } void ServiceIPCServer::OnDisableCloudPrintProxy() { diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h index 01f6f89..71c2a59 100644 --- a/chrome/service/service_ipc_server.h +++ b/chrome/service/service_ipc_server.h @@ -42,9 +42,7 @@ class ServiceIPCServer : public IPC::Channel::Listener, // IPC message handlers. void OnEnableCloudPrintProxy(const std::string& lsid); - void OnEnableCloudPrintProxyWithTokens(const std::string& cloud_print_token, - const std::string& talk_token); - void OnIsCloudPrintProxyEnabled(); + void OnGetCloudPrintProxyInfo(); void OnDisableCloudPrintProxy(); void OnShutdown(); |