| 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 |
| 250 // Initialize DBusThreadManager for the browser. This must be done after | 260 // Initialize DBusThreadManager for the browser. This must be done after |
| 251 // the main message loop is started, as it uses the message loop. | 261 // the main message loop is started, as it uses the message loop. |
| 252 DBusThreadManager::Initialize(); | 262 DBusThreadManager::Initialize(); |
| 253 CrosDBusService::Initialize(); | 263 CrosDBusService::Initialize(); |
| 254 | 264 |
| 255 // Initialize PowerDataCollector after DBusThreadManager is initialized. | 265 // Initialize PowerDataCollector after DBusThreadManager is initialized. |
| 256 PowerDataCollector::Initialize(); | 266 PowerDataCollector::Initialize(); |
| 257 | 267 |
| 258 LoginState::Initialize(); | 268 LoginState::Initialize(); |
| 259 SystemSaltGetter::Initialize(); | 269 SystemSaltGetter::Initialize(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { | 397 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { |
| 388 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific | 398 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific |
| 389 // implementation. This must be done before BrowserMainLoop calls | 399 // implementation. This must be done before BrowserMainLoop calls |
| 390 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). | 400 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). |
| 391 net::NetworkChangeNotifier::SetFactory( | 401 net::NetworkChangeNotifier::SetFactory( |
| 392 new NetworkChangeNotifierFactoryChromeos()); | 402 new NetworkChangeNotifierFactoryChromeos()); |
| 393 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); | 403 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); |
| 394 } | 404 } |
| 395 | 405 |
| 396 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 406 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 | |
| 406 dbus_services_.reset(new internal::DBusServices(parameters())); | 407 dbus_services_.reset(new internal::DBusServices(parameters())); |
| 407 | 408 |
| 408 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 409 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. | 412 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. |
| 412 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 413 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
| 413 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 414 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 414 // Set the crypto thread after the IO thread has been created/started. | 415 // Set the crypto thread after the IO thread has been created/started. |
| 415 TPMTokenLoader::Get()->SetCryptoTaskRunner( | 416 TPMTokenLoader::Get()->SetCryptoTaskRunner( |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // Destroy DBus services immediately after threads are stopped. | 858 // Destroy DBus services immediately after threads are stopped. |
| 858 dbus_services_.reset(); | 859 dbus_services_.reset(); |
| 859 | 860 |
| 860 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 861 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 861 | 862 |
| 862 // Destroy DeviceSettingsService after g_browser_process. | 863 // Destroy DeviceSettingsService after g_browser_process. |
| 863 DeviceSettingsService::Shutdown(); | 864 DeviceSettingsService::Shutdown(); |
| 864 } | 865 } |
| 865 | 866 |
| 866 } // namespace chromeos | 867 } // namespace chromeos |
| OLD | NEW |