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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 // Initialize DBusThreadManager for the browser. This must be done after | 274 // Initialize DBusThreadManager for the browser. This must be done after |
275 // the main message loop is started, as it uses the message loop. | 275 // the main message loop is started, as it uses the message loop. |
276 DBusThreadManager::Initialize(); | 276 DBusThreadManager::Initialize(); |
277 CrosDBusService::Initialize(); | 277 CrosDBusService::Initialize(); |
278 | 278 |
279 LoginState::Initialize(); | 279 LoginState::Initialize(); |
280 CryptohomeLibrary::Initialize(); | 280 CryptohomeLibrary::Initialize(); |
| 281 CertLoader::Initialize(); |
281 | 282 |
282 // This function and SystemKeyEventListener use InputMethodManager. | 283 // This function and SystemKeyEventListener use InputMethodManager. |
283 chromeos::input_method::Initialize( | 284 chromeos::input_method::Initialize( |
284 content::BrowserThread::GetMessageLoopProxyForThread( | 285 content::BrowserThread::GetMessageLoopProxyForThread( |
285 content::BrowserThread::UI), | 286 content::BrowserThread::UI), |
286 content::BrowserThread::GetMessageLoopProxyForThread( | 287 content::BrowserThread::GetMessageLoopProxyForThread( |
287 content::BrowserThread::FILE)); | 288 content::BrowserThread::FILE)); |
288 disks::DiskMountManager::Initialize(); | 289 disks::DiskMountManager::Initialize(); |
289 cryptohome::AsyncMethodCaller::Initialize(); | 290 cryptohome::AsyncMethodCaller::Initialize(); |
290 | 291 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 366 |
366 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 367 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
367 const content::MainFunctionParams& parameters) | 368 const content::MainFunctionParams& parameters) |
368 : ChromeBrowserMainPartsLinux(parameters) { | 369 : ChromeBrowserMainPartsLinux(parameters) { |
369 } | 370 } |
370 | 371 |
371 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 372 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
372 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 373 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
373 ShutdownKioskModeScreensaver(); | 374 ShutdownKioskModeScreensaver(); |
374 | 375 |
375 dbus_services_.reset(); | |
376 | |
377 // To be precise, logout (browser shutdown) is not yet done, but the | 376 // To be precise, logout (browser shutdown) is not yet done, but the |
378 // remaining work is negligible, hence we say LogoutDone here. | 377 // remaining work is negligible, hence we say LogoutDone here. |
379 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); | 378 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); |
380 BootTimesLoader::Get()->WriteLogoutTimes(); | 379 BootTimesLoader::Get()->WriteLogoutTimes(); |
381 } | 380 } |
382 | 381 |
383 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- | 382 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- |
384 | 383 |
385 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { | 384 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { |
386 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 385 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 441 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
443 | 442 |
444 dbus_services_.reset(new internal::DBusServices(parameters())); | 443 dbus_services_.reset(new internal::DBusServices(parameters())); |
445 | 444 |
446 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 445 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
447 } | 446 } |
448 | 447 |
449 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. | 448 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. |
450 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 449 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
451 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 450 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 451 // Set the crypto thread after the IO thread has been created/started. |
| 452 CertLoader::Get()->SetCryptoTaskRunner( |
| 453 content::BrowserThread::GetMessageLoopProxyForThread( |
| 454 content::BrowserThread::IO)); |
| 455 |
452 if (ash::switches::UseNewAudioHandler()) { | 456 if (ash::switches::UseNewAudioHandler()) { |
453 CrasAudioHandler::Initialize( | 457 CrasAudioHandler::Initialize( |
454 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); | 458 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); |
455 } else { | 459 } else { |
456 AudioHandler::Initialize( | 460 AudioHandler::Initialize( |
457 AudioPrefHandler::Create(g_browser_process->local_state())); | 461 AudioPrefHandler::Create(g_browser_process->local_state())); |
458 } | 462 } |
459 | 463 |
460 if (!StartupUtils::IsOobeCompleted()) | 464 if (!StartupUtils::IsOobeCompleted()) |
461 system::StatisticsProvider::GetInstance()->LoadOemManifest(); | 465 system::StatisticsProvider::GetInstance()->LoadOemManifest(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 824 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
821 | 825 |
822 // Destroy the UserManager after ash has been destroyed and | 826 // Destroy the UserManager after ash has been destroyed and |
823 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might | 827 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might |
824 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires | 828 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires |
825 // the UserManager to exist. | 829 // the UserManager to exist. |
826 UserManager::Destroy(); | 830 UserManager::Destroy(); |
827 } | 831 } |
828 | 832 |
829 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { | 833 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { |
| 834 // Destroy DBus services immediately after threads are stopped. |
| 835 dbus_services_.reset(); |
| 836 |
830 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 837 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 838 |
831 // Destroy DeviceSettingsService after g_browser_process. | 839 // Destroy DeviceSettingsService after g_browser_process. |
832 DeviceSettingsService::Shutdown(); | 840 DeviceSettingsService::Shutdown(); |
833 } | 841 } |
834 | 842 |
835 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 843 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
836 default_pinned_apps_field_trial::SetupTrial(); | 844 default_pinned_apps_field_trial::SetupTrial(); |
837 } | 845 } |
838 | 846 |
839 } // namespace chromeos | 847 } // namespace chromeos |
OLD | NEW |