OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 54 matching lines...) Loading... |
65 FilePath pref_path = user_data_dir.Append(chrome::kServiceStateFileName); | 65 FilePath pref_path = user_data_dir.Append(chrome::kServiceStateFileName); |
66 service_prefs_.reset(new JsonPrefStore(pref_path, | 66 service_prefs_.reset(new JsonPrefStore(pref_path, |
67 file_thread_->message_loop_proxy())); | 67 file_thread_->message_loop_proxy())); |
68 service_prefs_->ReadPrefs(); | 68 service_prefs_->ReadPrefs(); |
69 | 69 |
70 DictionaryValue* values = service_prefs_->prefs(); | 70 DictionaryValue* values = service_prefs_->prefs(); |
71 bool remoting_host_enabled = false; | 71 bool remoting_host_enabled = false; |
72 | 72 |
73 // Check if remoting host is already enabled. | 73 // Check if remoting host is already enabled. |
74 if (values->GetBoolean(prefs::kRemotingHostEnabled, &remoting_host_enabled) && | 74 if (values->GetBoolean(prefs::kRemotingHostEnabled, &remoting_host_enabled) && |
75 » remoting_host_enabled) { | 75 remoting_host_enabled) { |
76 // If true then we start the host. | 76 // If true then we start the host. |
77 StartChromotingHost(); | 77 StartChromotingHost(); |
78 } | 78 } |
79 | 79 |
80 // TODO(hclam): Each type of service process should has it own instance of | 80 // TODO(hclam): Each type of service process should has it own instance of |
81 // process and thus channel, but now we have only one process for all types | 81 // process and thus channel, but now we have only one process for all types |
82 // so the type parameter doesn't matter now. | 82 // so the type parameter doesn't matter now. |
83 LOG(INFO) << "Starting Service Process IPC Server"; | 83 LOG(INFO) << "Starting Service Process IPC Server"; |
84 ipc_server_.reset(new ServiceIPCServer( | 84 ipc_server_.reset(new ServiceIPCServer( |
85 GetServiceProcessChannelName(kServiceProcessCloudPrint))); | 85 GetServiceProcessChannelName(kServiceProcessCloudPrint))); |
(...skipping 77 matching lines...) Loading... |
163 chromoting_context_->Start(); | 163 chromoting_context_->Start(); |
164 | 164 |
165 // Create capturer, encoder and executor. The ownership will be transfered | 165 // Create capturer, encoder and executor. The ownership will be transfered |
166 // to the chromoting host. | 166 // to the chromoting host. |
167 scoped_ptr<remoting::Capturer> capturer; | 167 scoped_ptr<remoting::Capturer> capturer; |
168 scoped_ptr<remoting::Encoder> encoder; | 168 scoped_ptr<remoting::Encoder> encoder; |
169 scoped_ptr<remoting::EventExecutor> executor; | 169 scoped_ptr<remoting::EventExecutor> executor; |
170 | 170 |
171 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
172 capturer.reset(new remoting::CapturerGdi()); | 172 capturer.reset(new remoting::CapturerGdi()); |
173 executor.reset(new remoting::EventExecutorWin()); | 173 executor.reset(new remoting::EventExecutorWin(capturer.get())); |
174 #elif defined(OS_LINUX) | 174 #elif defined(OS_LINUX) |
175 capturer.reset(new remoting::CapturerFake()); | 175 capturer.reset(new remoting::CapturerFake()); |
176 executor.reset(new remoting::EventExecutorLinux()); | 176 executor.reset(new remoting::EventExecutorLinux(capturer.get())); |
177 #elif defined(OS_MACOSX) | 177 #elif defined(OS_MACOSX) |
178 capturer.reset(new remoting::CapturerMac()); | 178 capturer.reset(new remoting::CapturerMac()); |
179 executor.reset(new remoting::EventExecutorMac()); | 179 executor.reset(new remoting::EventExecutorMac(capturer.get())); |
180 #endif | 180 #endif |
181 encoder.reset(new remoting::EncoderZlib()); | 181 encoder.reset(new remoting::EncoderZlib()); |
182 | 182 |
183 // Create a chromoting host object. | 183 // Create a chromoting host object. |
184 chromoting_host_ = new remoting::ChromotingHost(chromoting_context_.get(), | 184 chromoting_host_ = new remoting::ChromotingHost(chromoting_context_.get(), |
185 chromoting_config_, | 185 chromoting_config_, |
186 capturer.release(), | 186 capturer.release(), |
187 encoder.release(), | 187 encoder.release(), |
188 executor.release()); | 188 executor.release()); |
189 | 189 |
(...skipping 105 matching lines...) Loading... |
295 #endif | 295 #endif |
296 | 296 |
297 ServiceProcess::~ServiceProcess() { | 297 ServiceProcess::~ServiceProcess() { |
298 Teardown(); | 298 Teardown(); |
299 g_service_process = NULL; | 299 g_service_process = NULL; |
300 } | 300 } |
301 | 301 |
302 // Disable refcounting for runnable method because it is really not needed | 302 // Disable refcounting for runnable method because it is really not needed |
303 // when we post tasks on the main message loop. | 303 // when we post tasks on the main message loop. |
304 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcess); | 304 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcess); |
OLD | NEW |