summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 21:04:49 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 21:04:49 +0000
commite57d57b67290c8dfd701ac5021264a9ae1588b81 (patch)
treed419061b3690fd591a87aff809096f120f201d46 /chrome/service
parent8e303b21eb3e190b420e82a15d5d151bc8df0dd4 (diff)
downloadchromium_src-e57d57b67290c8dfd701ac5021264a9ae1588b81.zip
chromium_src-e57d57b67290c8dfd701ac5021264a9ae1588b81.tar.gz
chromium_src-e57d57b67290c8dfd701ac5021264a9ae1588b81.tar.bz2
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. Review URL: http://codereview.chromium.org/3185015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/remoting/remoting_directory_service.cc4
-rw-r--r--chrome/service/service_process.cc19
2 files changed, 20 insertions, 3 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_process.cc b/chrome/service/service_process.cc
index f6d38e6..13979e7 100644
--- a/chrome/service/service_process.cc
+++ b/chrome/service/service_process.cc
@@ -11,6 +11,7 @@
#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 +66,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.
@@ -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();