OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // If no locale was specified anywhere, use the default one. | 168 // If no locale was specified anywhere, use the default one. |
169 if (locale.empty()) | 169 if (locale.empty()) |
170 locale = kDefaultServiceProcessLocale; | 170 locale = kDefaultServiceProcessLocale; |
171 } | 171 } |
172 ResourceBundle::InitSharedInstance(locale); | 172 ResourceBundle::InitSharedInstance(locale); |
173 | 173 |
174 PrepareRestartOnCrashEnviroment(command_line); | 174 PrepareRestartOnCrashEnviroment(command_line); |
175 | 175 |
176 #if defined(ENABLE_REMOTING) | 176 #if defined(ENABLE_REMOTING) |
177 // Load media codecs, required by the Chromoting host | 177 // Load media codecs, required by the Chromoting host |
178 bool initialized_media_library = false; | |
179 #if defined(OS_MACOSX) | |
180 FilePath bundle_path = base::mac::MainAppBundlePath(); | |
181 | |
182 initialized_media_library = | |
183 media::InitializeMediaLibrary(bundle_path.Append("Libraries")); | |
184 #else | |
185 FilePath module_path; | 178 FilePath module_path; |
186 initialized_media_library = | 179 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &module_path) && |
187 PathService::Get(base::DIR_MODULE, &module_path) && | 180 media::InitializeMediaLibrary(module_path)) { |
188 media::InitializeMediaLibrary(module_path); | 181 // Initialize chromoting host manager. |
189 #endif | 182 remoting_host_manager_ = new remoting::ChromotingHostManager(this); |
190 | 183 remoting_host_manager_->Initialize(message_loop, |
191 // Initialize chromoting host manager. | 184 file_thread_->message_loop_proxy()); |
192 remoting_host_manager_ = new remoting::ChromotingHostManager(this); | 185 } |
193 remoting_host_manager_->Initialize(message_loop, | |
194 file_thread_->message_loop_proxy()); | |
195 #endif // ENABLE_REMOTING | 186 #endif // ENABLE_REMOTING |
196 | 187 |
197 // Enable Cloud Print if needed. First check the command-line. | 188 // Enable Cloud Print if needed. First check the command-line. |
198 bool cloud_print_proxy_enabled = | 189 bool cloud_print_proxy_enabled = |
199 command_line.HasSwitch(switches::kEnableCloudPrintProxy); | 190 command_line.HasSwitch(switches::kEnableCloudPrintProxy); |
200 if (!cloud_print_proxy_enabled) { | 191 if (!cloud_print_proxy_enabled) { |
201 // Then check if the cloud print proxy was previously enabled. | 192 // Then check if the cloud print proxy was previously enabled. |
202 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled, | 193 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled, |
203 &cloud_print_proxy_enabled); | 194 &cloud_print_proxy_enabled); |
204 } | 195 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } else { | 343 } else { |
353 Shutdown(); | 344 Shutdown(); |
354 } | 345 } |
355 } | 346 } |
356 } | 347 } |
357 | 348 |
358 ServiceProcess::~ServiceProcess() { | 349 ServiceProcess::~ServiceProcess() { |
359 Teardown(); | 350 Teardown(); |
360 g_service_process = NULL; | 351 g_service_process = NULL; |
361 } | 352 } |
362 | |
363 // Disable refcounting for runnable method because it is really not needed | |
364 // when we post tasks on the main message loop. | |
365 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcess); | |
OLD | NEW |