summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r--chrome/service/service_process.cc19
1 files changed, 19 insertions, 0 deletions
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();