| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } // namespace | 240 } // namespace |
| 241 | 241 |
| 242 namespace internal { | 242 namespace internal { |
| 243 | 243 |
| 244 // Wrapper class for initializing dbus related services and shutting them | 244 // Wrapper class for initializing dbus related services and shutting them |
| 245 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the | 245 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the |
| 246 // destructor will get called if and only if this has been instantiated. | 246 // destructor will get called if and only if this has been instantiated. |
| 247 class DBusServices { | 247 class DBusServices { |
| 248 public: | 248 public: |
| 249 explicit DBusServices(const content::MainFunctionParams& parameters) { | 249 explicit DBusServices(const content::MainFunctionParams& parameters) { |
| 250 if (!base::SysInfo::IsRunningOnChromeOS()) { | |
| 251 // Override this path on the desktop, so that the user policy key can be | |
| 252 // stored by the stub SessionManagerClient. | |
| 253 base::FilePath user_data_dir; | |
| 254 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | |
| 255 PathService::Override(chromeos::DIR_USER_POLICY_KEYS, | |
| 256 user_data_dir.AppendASCII("stub_user_policy")); | |
| 257 } | |
| 258 } | |
| 259 | |
| 260 // Initialize DBusThreadManager for the browser. This must be done after | 250 // Initialize DBusThreadManager for the browser. This must be done after |
| 261 // the main message loop is started, as it uses the message loop. | 251 // the main message loop is started, as it uses the message loop. |
| 262 DBusThreadManager::Initialize(); | 252 DBusThreadManager::Initialize(); |
| 263 CrosDBusService::Initialize(); | 253 CrosDBusService::Initialize(); |
| 264 | 254 |
| 265 // Initialize PowerDataCollector after DBusThreadManager is initialized. | 255 // Initialize PowerDataCollector after DBusThreadManager is initialized. |
| 266 PowerDataCollector::Initialize(); | 256 PowerDataCollector::Initialize(); |
| 267 | 257 |
| 268 LoginState::Initialize(); | 258 LoginState::Initialize(); |
| 269 SystemSaltGetter::Initialize(); | 259 SystemSaltGetter::Initialize(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { | 387 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { |
| 398 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific | 388 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific |
| 399 // implementation. This must be done before BrowserMainLoop calls | 389 // implementation. This must be done before BrowserMainLoop calls |
| 400 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). | 390 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). |
| 401 net::NetworkChangeNotifier::SetFactory( | 391 net::NetworkChangeNotifier::SetFactory( |
| 402 new NetworkChangeNotifierFactoryChromeos()); | 392 new NetworkChangeNotifierFactoryChromeos()); |
| 403 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); | 393 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); |
| 404 } | 394 } |
| 405 | 395 |
| 406 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 396 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { |
| 397 base::FilePath user_data_dir; |
| 398 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 399 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 400 // Override some paths with stub locations so that cloud policy and |
| 401 // enterprise enrollment work on desktop builds, for ease of |
| 402 // development. |
| 403 chromeos::RegisterStubPathOverrides(user_data_dir); |
| 404 } |
| 405 |
| 407 dbus_services_.reset(new internal::DBusServices(parameters())); | 406 dbus_services_.reset(new internal::DBusServices(parameters())); |
| 408 | 407 |
| 409 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 408 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
| 410 } | 409 } |
| 411 | 410 |
| 412 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. | 411 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. |
| 413 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 412 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
| 414 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 413 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 415 // Set the crypto thread after the IO thread has been created/started. | 414 // Set the crypto thread after the IO thread has been created/started. |
| 416 TPMTokenLoader::Get()->SetCryptoTaskRunner( | 415 TPMTokenLoader::Get()->SetCryptoTaskRunner( |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 // Destroy DBus services immediately after threads are stopped. | 857 // Destroy DBus services immediately after threads are stopped. |
| 859 dbus_services_.reset(); | 858 dbus_services_.reset(); |
| 860 | 859 |
| 861 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 860 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 862 | 861 |
| 863 // Destroy DeviceSettingsService after g_browser_process. | 862 // Destroy DeviceSettingsService after g_browser_process. |
| 864 DeviceSettingsService::Shutdown(); | 863 DeviceSettingsService::Shutdown(); |
| 865 } | 864 } |
| 866 | 865 |
| 867 } // namespace chromeos | 866 } // namespace chromeos |
| OLD | NEW |