diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-23 23:20:57 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-23 23:20:57 +0000 |
commit | e96bf0c56566457022d20682ee278cd135d7c681 (patch) | |
tree | 16aae1f02aa4ca3948343ffb75f6010f9d1da125 /chrome/service | |
parent | 4232100ca0d42e558e75a728b69abca4b28499bf (diff) | |
download | chromium_src-e96bf0c56566457022d20682ee278cd135d7c681.zip chromium_src-e96bf0c56566457022d20682ee278cd135d7c681.tar.gz chromium_src-e96bf0c56566457022d20682ee278cd135d7c681.tar.bz2 |
Resubmit r56600 - Start/stop service process when browser starts and stop
Save the information that the setup of remoting has completed.
After setup has been completed we start and stop service process when
--enable-remoting presents when browser starts.
Also save the information in the service process that host is registered
and ready to be used. Again start chromoting host automatically once
the host registration is done.
BUG=50244, 50242, 50243, 50249
Review URL: http://codereview.chromium.org/3153029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/remoting/remoting_directory_service.cc | 4 | ||||
-rw-r--r-- | chrome/service/service_main.cc | 5 | ||||
-rw-r--r-- | chrome/service/service_process.cc | 21 |
3 files changed, 26 insertions, 4 deletions
diff --git a/chrome/service/remoting/remoting_directory_service.cc b/chrome/service/remoting/remoting_directory_service.cc index 697a576..8bc6b0a0 100644 --- a/chrome/service/remoting/remoting_directory_service.cc +++ b/chrome/service/remoting/remoting_directory_service.cc @@ -75,9 +75,7 @@ void RemotingDirectoryService::OnURLFetchComplete( // Destroy the fetcher after the response has been received. fetcher_.reset(); - LOG(INFO) << "Remoting directory response: \n" << data.c_str(); - - // TODO(hclam): Simply checking 200 status is not ennough. + // TODO(hclam): Simply checking 200 status is not enough. if (response_code == 200) { client_->OnRemotingHostAdded(); } else { diff --git a/chrome/service/service_main.cc b/chrome/service/service_main.cc index 2670c5c..03ccfe3 100644 --- a/chrome/service/service_main.cc +++ b/chrome/service/service_main.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/debug_util.h" #include "base/message_loop.h" #include "base/path_service.h" #include "chrome/common/chrome_paths.h" @@ -14,6 +15,10 @@ // Mainline routine for running as the service process. int ServiceProcessMain(const MainFunctionParams& parameters) { MessageLoopForUI main_message_loop; + if (parameters.command_line_.HasSwitch(switches::kWaitForDebugger)) { + DebugUtil::WaitForDebugger(60, true); + } + PlatformThread::SetName("CrServiceMain"); #if defined(OS_WIN) diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index f6d38e6..3dc4601 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -8,9 +8,11 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" +#include "base/values.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/json_pref_store.h" +#include "chrome/common/pref_names.h" #include "chrome/common/service_process_type.h" #include "chrome/common/service_process_util.h" #include "chrome/service/cloud_print/cloud_print_proxy.h" @@ -65,6 +67,16 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop) { file_thread_->message_loop_proxy())); service_prefs_->ReadPrefs(); + DictionaryValue* values = service_prefs_->prefs(); + bool remoting_host_enabled = false; + + // Check if remoting host is already enabled. + if (values->GetBoolean(prefs::kRemotingHostEnabled, &remoting_host_enabled) && + remoting_host_enabled) { + // If true then we start the host. + StartChromotingHost(); + } + // TODO(hclam): Each type of service process should has it own instance of // process and thus channel, but now we have only one process for all types // so the type parameter doesn't matter now. @@ -81,7 +93,6 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop) { } bool ServiceProcess::Teardown() { - // TODO(hclam): Remove this as this looks like dead code. if (service_prefs_.get()) { service_prefs_->WritePrefs(); service_prefs_.reset(); @@ -132,6 +143,8 @@ bool ServiceProcess::EnableChromotingHostWithTokens( talk_token_ = talk_token; // Use the remoting directory to register the host. + if (remoting_directory_.get()) + remoting_directory_->CancelRequest(); remoting_directory_.reset(new RemotingDirectoryService(this)); remoting_directory_->AddHost(remoting_token); return true; @@ -207,6 +220,12 @@ void ServiceProcess::OnRemotingHostAdded() { remoting_token_ = ""; talk_token_ = ""; + // Save the preference that we have enabled the remoting host. + service_prefs_->prefs()->SetBoolean(prefs::kRemotingHostEnabled, true); + + // Force writing prefs to the disk. + service_prefs_->WritePrefs(); + // TODO(hclam): If we have a problem we need to send an IPC message back // to the client that started this. bool ret = StartChromotingHost(); |