summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_process.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 22:37:38 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 22:37:38 +0000
commit17543d6da3e6078109e25358481fd3bbd98ab587 (patch)
tree9d92d94d76db72a6feb4becc2e7f77ec89ebcf10 /chrome/service/service_process.cc
parent4c974a138a20ec387ad0f347ca6d0804f26de74e (diff)
downloadchromium_src-17543d6da3e6078109e25358481fd3bbd98ab587.zip
chromium_src-17543d6da3e6078109e25358481fd3bbd98ab587.tar.gz
chromium_src-17543d6da3e6078109e25358481fd3bbd98ab587.tar.bz2
All communication with the cloud print proxy service from the browser now happens in the CloudPrintProxyService class. Added code to start the service process if the cloud print proxy was enabled. Also, when detect an auto-update, we send an IPC to the service process. The service process then shuts down when the browser disconnects.
BUG=None TEST=Unit-tests, test Cloud Print proxy UI, test that when an update is available, the service process shuts down when the browser does. TBR=phajdan.jr Review URL: http://codereview.chromium.org/3617008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61871 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r--chrome/service/service_process.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc
index 86d787b..db562c3 100644
--- a/chrome/service/service_process.cc
+++ b/chrome/service/service_process.cc
@@ -52,7 +52,8 @@ static const int64 kShutdownDelay = 60000;
ServiceProcess::ServiceProcess()
: shutdown_event_(true, false),
main_message_loop_(NULL),
- enabled_services_(0) {
+ enabled_services_(0),
+ update_available_(false) {
DCHECK(!g_service_process);
g_service_process = this;
}
@@ -150,6 +151,17 @@ void ServiceProcess::Shutdown() {
main_message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
+bool ServiceProcess::HandleClientDisconnect() {
+ // If there are no enabled services or if there is an update available
+ // we want to shutdown right away. Else we want to keep listening for
+ // new connections.
+ if (!enabled_services_ || update_available()) {
+ Shutdown();
+ return false;
+ }
+ return true;
+}
+
CloudPrintProxy* ServiceProcess::GetCloudPrintProxy() {
if (!cloud_print_proxy_.get()) {
cloud_print_proxy_.reset(new CloudPrintProxy());
@@ -180,7 +192,7 @@ void ServiceProcess::OnServiceEnabled() {
}
void ServiceProcess::OnServiceDisabled() {
- DCHECK(0 != enabled_services_);
+ DCHECK_NE(enabled_services_, 0);
enabled_services_--;
if (0 == enabled_services_) {
RemoveServiceProcessFromAutoStart();