summaryrefslogtreecommitdiffstats
path: root/chrome/browser/service
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:41:35 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:41:35 +0000
commitde119cf2b1e0cc6b6ab2352812adb14726633413 (patch)
treea43fe7e052f03a0bd9c3a54c317c2a8a71f7df8d /chrome/browser/service
parente64648531fc7386c139dffadefa746996264b90f (diff)
downloadchromium_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/browser/service')
-rw-r--r--chrome/browser/service/service_process_control.cc24
-rw-r--r--chrome/browser/service/service_process_control.h19
-rw-r--r--chrome/browser/service/service_process_control_browsertest.cc8
3 files changed, 29 insertions, 22 deletions
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 0d71241..5c07223 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -185,8 +185,8 @@ void ServiceProcessControl::OnProcessLaunched() {
bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message)
- IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled,
- OnCloudPrintProxyIsEnabled)
+ IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_Info,
+ OnCloudPrintProxyInfo)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -230,20 +230,20 @@ void ServiceProcessControl::Observe(NotificationType type,
}
}
-void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled,
- std::string email) {
+void ServiceProcessControl::OnCloudPrintProxyInfo(
+ const cloud_print::CloudPrintProxyInfo& proxy_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (cloud_print_status_callback_ != NULL) {
- cloud_print_status_callback_->Run(enabled, email);
- cloud_print_status_callback_.reset();
+ if (cloud_print_info_callback_ != NULL) {
+ cloud_print_info_callback_->Run(proxy_info);
+ cloud_print_info_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::GetCloudPrintProxyInfo(
+ CloudPrintProxyInfoHandler* cloud_print_info_callback) {
+ DCHECK(cloud_print_info_callback);
+ cloud_print_info_callback_.reset(cloud_print_info_callback);
+ return Send(new ServiceMsg_GetCloudPrintProxyInfo());
}
bool ServiceProcessControl::Shutdown() {
diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h
index 7a9456b..10e9aa0 100644
--- a/chrome/browser/service/service_process_control.h
+++ b/chrome/browser/service/service_process_control.h
@@ -23,6 +23,10 @@
class Profile;
class CommandLine;
+namespace cloud_print {
+struct CloudPrintProxyInfo;
+} // namespace cloud_print
+
// A ServiceProcessControl works as a portal between the service process and
// the browser process.
//
@@ -39,6 +43,8 @@ class ServiceProcessControl : public IPC::Channel::Sender,
public:
typedef IDMap<ServiceProcessControl>::iterator iterator;
typedef std::queue<IPC::Message> MessageQueue;
+ typedef Callback1<const cloud_print::CloudPrintProxyInfo&>::Type
+ CloudPrintProxyInfoHandler;
// Construct a ServiceProcessControl with |profile|..
explicit ServiceProcessControl(Profile* profile);
@@ -78,17 +84,18 @@ class ServiceProcessControl : public IPC::Channel::Sender,
const NotificationDetails& details);
// Message handlers
- void OnCloudPrintProxyIsEnabled(bool enabled, std::string email);
+ void OnCloudPrintProxyInfo(
+ const cloud_print::CloudPrintProxyInfo& proxy_info);
// Send a shutdown message to the service process. IPC channel will be
// destroyed after calling this method.
// Return true if the message was sent.
bool Shutdown();
- // Send request for cloud print proxy status and the registered
- // email address. The callback gets the information when received.
- bool GetCloudPrintProxyStatus(
- Callback2<bool, std::string>::Type* cloud_print_status_callback);
+ // Send request for cloud print proxy info (enabled state, email, proxy id).
+ // The callback gets the information when received.
+ bool GetCloudPrintProxyInfo(
+ CloudPrintProxyInfoHandler* cloud_print_status_callback);
private:
// This class is responsible for launching the service process on the
@@ -152,7 +159,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<CloudPrintProxyInfoHandler> cloud_print_info_callback_;
NotificationRegistrar registrar_;
};
diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc
index b7b0c58..b75ec4a 100644
--- a/chrome/browser/service/service_process_control_browsertest.cc
+++ b/chrome/browser/service/service_process_control_browsertest.cc
@@ -54,13 +54,13 @@ class ServiceProcessControlBrowserTest
// Send a Cloud Print status request and wait for a reply from the service.
void SendRequestAndWait() {
- process()->GetCloudPrintProxyStatus(NewCallback(
- this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback));
+ process()->GetCloudPrintProxyInfo(NewCallback(
+ this, &ServiceProcessControlBrowserTest::CloudPrintInfoCallback));
ui_test_utils::RunMessageLoop();
}
- void CloudPrintStatusCallback(
- bool enabled, std::string email) {
+ void CloudPrintInfoCallback(
+ const cloud_print::CloudPrintProxyInfo& proxy_info) {
MessageLoop::current()->Quit();
}