| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 chromeos::input_method::Initialize( | 297 chromeos::input_method::Initialize( |
| 298 content::BrowserThread::GetMessageLoopProxyForThread( | 298 content::BrowserThread::GetMessageLoopProxyForThread( |
| 299 content::BrowserThread::UI), | 299 content::BrowserThread::UI), |
| 300 content::BrowserThread::GetMessageLoopProxyForThread( | 300 content::BrowserThread::GetMessageLoopProxyForThread( |
| 301 content::BrowserThread::FILE)); | 301 content::BrowserThread::FILE)); |
| 302 disks::DiskMountManager::Initialize(); | 302 disks::DiskMountManager::Initialize(); |
| 303 cryptohome::AsyncMethodCaller::Initialize(); | 303 cryptohome::AsyncMethodCaller::Initialize(); |
| 304 | 304 |
| 305 // Always initialize these handlers which should not conflict with | 305 // Always initialize these handlers which should not conflict with |
| 306 // NetworkLibrary. | 306 // NetworkLibrary. |
| 307 NetworkHandler::Initialize(); | 307 NetworkHandler::Initialize( |
| 308 content::BrowserThread::GetMessageLoopProxyForThread( |
| 309 content::BrowserThread::IO)); |
| 308 CertLibrary::Initialize(); | 310 CertLibrary::Initialize(); |
| 309 | 311 |
| 310 // Initialize the network change notifier for Chrome OS. The network | 312 // Initialize the network change notifier for Chrome OS. The network |
| 311 // change notifier starts to monitor changes from the power manager and | 313 // change notifier starts to monitor changes from the power manager and |
| 312 // the network manager. | 314 // the network manager. |
| 313 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 315 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 314 chromeos::switches::kDisableNewNetworkChangeNotifier)) { | 316 chromeos::switches::kDisableNewNetworkChangeNotifier)) { |
| 315 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); | 317 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); |
| 316 } else { | 318 } else { |
| 317 CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | 319 CrosNetworkChangeNotifierFactory::GetInstance()->Init(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 377 |
| 376 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 378 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
| 377 const content::MainFunctionParams& parameters) | 379 const content::MainFunctionParams& parameters) |
| 378 : ChromeBrowserMainPartsLinux(parameters) { | 380 : ChromeBrowserMainPartsLinux(parameters) { |
| 379 } | 381 } |
| 380 | 382 |
| 381 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 383 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
| 382 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 384 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 383 ShutdownKioskModeScreensaver(); | 385 ShutdownKioskModeScreensaver(); |
| 384 | 386 |
| 385 dbus_services_.reset(); | |
| 386 | |
| 387 // To be precise, logout (browser shutdown) is not yet done, but the | 387 // To be precise, logout (browser shutdown) is not yet done, but the |
| 388 // remaining work is negligible, hence we say LogoutDone here. | 388 // remaining work is negligible, hence we say LogoutDone here. |
| 389 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); | 389 BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", false); |
| 390 BootTimesLoader::Get()->WriteLogoutTimes(); | 390 BootTimesLoader::Get()->WriteLogoutTimes(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- | 393 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides --------- |
| 394 | 394 |
| 395 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { | 395 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { |
| 396 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 396 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 831 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
| 832 | 832 |
| 833 // Destroy the UserManager after ash has been destroyed and | 833 // Destroy the UserManager after ash has been destroyed and |
| 834 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might | 834 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun run. The latter might |
| 835 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires | 835 // trigger MergeSessionThrottle::ShouldShowMergeSessionPage, which requires |
| 836 // the UserManager to exist. | 836 // the UserManager to exist. |
| 837 UserManager::Destroy(); | 837 UserManager::Destroy(); |
| 838 } | 838 } |
| 839 | 839 |
| 840 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { | 840 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { |
| 841 // Destroy DBus services immediately after threads are stopped. |
| 842 dbus_services_.reset(); |
| 843 |
| 841 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 844 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 845 |
| 842 // Destroy DeviceSettingsService after g_browser_process. | 846 // Destroy DeviceSettingsService after g_browser_process. |
| 843 DeviceSettingsService::Shutdown(); | 847 DeviceSettingsService::Shutdown(); |
| 844 } | 848 } |
| 845 | 849 |
| 846 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 850 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 847 SetupZramFieldTrial(); | 851 SetupZramFieldTrial(); |
| 848 default_pinned_apps_field_trial::SetupTrial(); | 852 default_pinned_apps_field_trial::SetupTrial(); |
| 849 } | 853 } |
| 850 | 854 |
| 851 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { | 855 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); | 890 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); |
| 887 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); | 891 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); |
| 888 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); | 892 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); |
| 889 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); | 893 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); |
| 890 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); | 894 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); |
| 891 // This is necessary to start the experiment as a side effect. | 895 // This is necessary to start the experiment as a side effect. |
| 892 trial->group(); | 896 trial->group(); |
| 893 } | 897 } |
| 894 | 898 |
| 895 } // namespace chromeos | 899 } // namespace chromeos |
| OLD | NEW |