| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 376 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
| 377 const content::MainFunctionParams& parameters) | 377 const content::MainFunctionParams& parameters) |
| 378 : ChromeBrowserMainPartsLinux(parameters) { | 378 : ChromeBrowserMainPartsLinux(parameters) { |
| 379 } | 379 } |
| 380 | 380 |
| 381 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 381 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
| 382 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 382 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 383 ShutdownKioskModeScreensaver(); | 383 ShutdownKioskModeScreensaver(); |
| 384 | 384 |
| 385 dbus_services_.reset(); | |
| 386 | |
| 387 // To be precise, logout (browser shutdown) is not yet done, but the | 385 // To be precise, logout (browser shutdown) is not yet done, but the |
| 388 // remaining work is negligible, hence we say LogoutDone here. | 386 // remaining work is negligible, hence we say LogoutDone here. |
| 389 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); | 387 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); |
| 390 BootTimesLoader::Get()->WriteLogoutTimes(); | 388 BootTimesLoader::Get()->WriteLogoutTimes(); |
| 391 } | 389 } |
| 392 | 390 |
| 393 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- | 391 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- |
| 394 | 392 |
| 395 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { | 393 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { |
| 396 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 394 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 450 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
| 453 | 451 |
| 454 dbus_services_.reset(new internal::DBusServices(parameters())); | 452 dbus_services_.reset(new internal::DBusServices(parameters())); |
| 455 | 453 |
| 456 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 454 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
| 457 } | 455 } |
| 458 | 456 |
| 459 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. | 457 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. |
| 460 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 458 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
| 461 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 459 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 460 // Set the crypto thread after the IO thread has been created/started. |
| 461 NetworkHandler::Get()->cert_loader()->SetCryptoTaskRunner( |
| 462 content::BrowserThread::GetMessageLoopProxyForThread( |
| 463 content::BrowserThread::IO)); |
| 464 |
| 462 if (ash::switches::UseNewAudioHandler()) { | 465 if (ash::switches::UseNewAudioHandler()) { |
| 463 CrasAudioHandler::Initialize( | 466 CrasAudioHandler::Initialize( |
| 464 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); | 467 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); |
| 465 } else { | 468 } else { |
| 466 AudioHandler::Initialize( | 469 AudioHandler::Initialize( |
| 467 AudioPrefHandler::Create(g_browser_process->local_state())); | 470 AudioPrefHandler::Create(g_browser_process->local_state())); |
| 468 } | 471 } |
| 469 | 472 |
| 470 PowerManagerHandler::Initialize(); | 473 PowerManagerHandler::Initialize(); |
| 471 | 474 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 834 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
| 832 | 835 |
| 833 // Destroy the UserManager after ash has been destroyed and | 836 // Destroy the UserManager after ash has been destroyed and |
| 834 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might | 837 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might |
| 835 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires | 838 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires |
| 836 // the UserManager to exist. | 839 // the UserManager to exist. |
| 837 UserManager::Destroy(); | 840 UserManager::Destroy(); |
| 838 } | 841 } |
| 839 | 842 |
| 840 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { | 843 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { |
| 844 // Destroy DBus services immediately after threads are stopped. |
| 845 dbus_services_.reset(); |
| 846 |
| 841 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 847 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 848 |
| 842 // Destroy DeviceSettingsService after g_browser_process. | 849 // Destroy DeviceSettingsService after g_browser_process. |
| 843 DeviceSettingsService::Shutdown(); | 850 DeviceSettingsService::Shutdown(); |
| 844 } | 851 } |
| 845 | 852 |
| 846 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 853 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 847 SetupZramFieldTrial(); | 854 SetupZramFieldTrial(); |
| 848 default_pinned_apps_field_trial::SetupTrial(); | 855 default_pinned_apps_field_trial::SetupTrial(); |
| 849 } | 856 } |
| 850 | 857 |
| 851 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { | 858 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); | 893 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); |
| 887 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); | 894 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); |
| 888 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); | 895 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); |
| 889 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); | 896 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); |
| 890 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); | 897 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); |
| 891 // This is necessary to start the experiment as a side effect. | 898 // This is necessary to start the experiment as a side effect. |
| 892 trial->group(); | 899 trial->group(); |
| 893 } | 900 } |
| 894 | 901 |
| 895 } // namespace chromeos | 902 } // namespace chromeos |
| OLD | NEW |