diff options
author | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 18:40:55 +0000 |
---|---|---|
committer | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 18:40:55 +0000 |
commit | 66ad7faacf401592f814b73ec8d670a552f4c61e (patch) | |
tree | 4fbe4ef838cf6829e29b526eb4da7155f9ab3be5 /chrome/browser/service | |
parent | 19432bb9264b16672c1a06a462618738aad22a12 (diff) | |
download | chromium_src-66ad7faacf401592f814b73ec8d670a552f4c61e.zip chromium_src-66ad7faacf401592f814b73ec8d670a552f4c61e.tar.gz chromium_src-66ad7faacf401592f814b73ec8d670a552f4c61e.tar.bz2 |
Cloud print connector policy.
This implements the policy inside the browser process, shutting down the cloud
print connector if the policy is set to disabled. This isn't a complete
solution, as the browser needs to be running or be launched for the policy to
take effect. (It will take a lot more refactoring for the service process to
use the policy code). The hole without the refactoring is that if you enable
the connector, quit Chromium, and set the policy, the connector will stay alive
until the next launch of Chromium.
The browser process checks the policy on startup, and listens for it changing
as long as it is up. You can sit on the Under the Hood page and watch the
button change state on Windows as you fiddle with the policy.
BUG=59769
TEST=Set Cloud Print Proxy policy to disabled, bring up browser, Options/Under
the Hood - Sign in to Google Cloud print will be disabled. Unset policy, wait,
button becomes active. Log in to cloud print. Quit Chromium, note service
process hangs around for more than a minute. Set policy, launch and quit
Chromium. Note that the service process quits within a minute.
Review URL: http://codereview.chromium.org/8438020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/service')
-rw-r--r-- | chrome/browser/service/service_process_control.cc | 4 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.h | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 99c1668..f92e3dd 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -78,6 +78,10 @@ void ServiceProcessControl::RunAllTasksHelper(TaskList* task_list) { } } +bool ServiceProcessControl::is_connected() const { + return channel_.get() != NULL; +} + void ServiceProcessControl::Launch(const base::Closure& success_task, const base::Closure& failure_task) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index 483d78c..1e4261d 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -48,8 +48,10 @@ class ServiceProcessControl : public IPC::Channel::Sender, // Returns the singleton instance of this class. static ServiceProcessControl* GetInstance(); + // Return true if this object is connected to the service. - bool is_connected() const { return channel_.get() != NULL; } + // Virtual for testing. + virtual bool is_connected() const; // If no service process is currently running, creates a new service process // and connects to it. If a service process is already running this method @@ -61,11 +63,13 @@ class ServiceProcessControl : public IPC::Channel::Sender, // this case, the task is invoked on success or failure. // Note that if we are already connected to service process then // |success_task| can be invoked in the context of the Launch call. - void Launch(const base::Closure& success_task, - const base::Closure& failure_task); + // Virtual for testing. + virtual void Launch(const base::Closure& success_task, + const base::Closure& failure_task); // Disconnect the IPC channel from the service process. - void Disconnect(); + // Virtual for testing. + virtual void Disconnect(); // IPC::Channel::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -87,7 +91,8 @@ class ServiceProcessControl : public IPC::Channel::Sender, // 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(); + // Virtual for testing. + virtual bool Shutdown(); // Send request for cloud print proxy info (enabled state, email, proxy id). // The callback gets the information when received. @@ -125,6 +130,7 @@ class ServiceProcessControl : public IPC::Channel::Sender, uint32 retry_count_; }; + friend class MockServiceProcessControl; ServiceProcessControl(); virtual ~ServiceProcessControl(); |