| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 CrosDBusService::Initialize(); | 202 CrosDBusService::Initialize(); |
| 203 | 203 |
| 204 // Initialize PowerDataCollector after DBusThreadManager is initialized. | 204 // Initialize PowerDataCollector after DBusThreadManager is initialized. |
| 205 PowerDataCollector::Initialize(); | 205 PowerDataCollector::Initialize(); |
| 206 | 206 |
| 207 LoginState::Initialize(); | 207 LoginState::Initialize(); |
| 208 SystemSaltGetter::Initialize(); | 208 SystemSaltGetter::Initialize(); |
| 209 TPMTokenLoader::Initialize(); | 209 TPMTokenLoader::Initialize(); |
| 210 CertLoader::Initialize(); | 210 CertLoader::Initialize(); |
| 211 | 211 |
| 212 // This function and SystemKeyEventListener use InputMethodManager. | |
| 213 chromeos::input_method::Initialize( | |
| 214 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 215 content::BrowserThread::UI), | |
| 216 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 217 content::BrowserThread::FILE)); | |
| 218 disks::DiskMountManager::Initialize(); | 212 disks::DiskMountManager::Initialize(); |
| 219 cryptohome::AsyncMethodCaller::Initialize(); | 213 cryptohome::AsyncMethodCaller::Initialize(); |
| 220 cryptohome::HomedirMethods::Initialize(); | 214 cryptohome::HomedirMethods::Initialize(); |
| 221 | 215 |
| 222 NetworkHandler::Initialize(); | 216 NetworkHandler::Initialize(); |
| 223 CertLibrary::Initialize(); | 217 CertLibrary::Initialize(); |
| 224 | 218 |
| 225 // Initialize the network change notifier for Chrome OS. The network | 219 // Initialize the network change notifier for Chrome OS. The network |
| 226 // change notifier starts to monitor changes from the power manager and | 220 // change notifier starts to monitor changes from the power manager and |
| 227 // the network manager. | 221 // the network manager. |
| 228 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); | 222 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); |
| 229 | 223 |
| 230 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade | 224 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade |
| 231 // detector starts to monitor changes from the update engine. | 225 // detector starts to monitor changes from the update engine. |
| 232 UpgradeDetectorChromeos::GetInstance()->Init(); | 226 UpgradeDetectorChromeos::GetInstance()->Init(); |
| 233 | 227 |
| 234 if (base::SysInfo::IsRunningOnChromeOS()) { | |
| 235 // Disable Num Lock on X start up for http://crosbug.com/29169. | |
| 236 input_method::InputMethodManager::Get() | |
| 237 ->GetImeKeyboard() | |
| 238 ->DisableNumLock(); | |
| 239 } | |
| 240 | |
| 241 // Initialize the device settings service so that we'll take actions per | 228 // Initialize the device settings service so that we'll take actions per |
| 242 // signals sent from the session manager. This needs to happen before | 229 // signals sent from the session manager. This needs to happen before |
| 243 // g_browser_process initializes BrowserPolicyConnector. | 230 // g_browser_process initializes BrowserPolicyConnector. |
| 244 DeviceSettingsService::Initialize(); | 231 DeviceSettingsService::Initialize(); |
| 245 DeviceSettingsService::Get()->SetSessionManager( | 232 DeviceSettingsService::Get()->SetSessionManager( |
| 246 DBusThreadManager::Get()->GetSessionManagerClient(), | 233 DBusThreadManager::Get()->GetSessionManagerClient(), |
| 247 OwnerKeyUtil::Create()); | 234 OwnerKeyUtil::Create()); |
| 248 } | 235 } |
| 249 | 236 |
| 250 ~DBusServices() { | 237 ~DBusServices() { |
| 251 CertLibrary::Shutdown(); | 238 CertLibrary::Shutdown(); |
| 252 NetworkHandler::Shutdown(); | 239 NetworkHandler::Shutdown(); |
| 253 | 240 |
| 254 cryptohome::AsyncMethodCaller::Shutdown(); | 241 cryptohome::AsyncMethodCaller::Shutdown(); |
| 255 disks::DiskMountManager::Shutdown(); | 242 disks::DiskMountManager::Shutdown(); |
| 256 input_method::Shutdown(); | |
| 257 | 243 |
| 258 SystemSaltGetter::Shutdown(); | 244 SystemSaltGetter::Shutdown(); |
| 259 LoginState::Shutdown(); | 245 LoginState::Shutdown(); |
| 260 CertLoader::Shutdown(); | 246 CertLoader::Shutdown(); |
| 261 TPMTokenLoader::Shutdown(); | 247 TPMTokenLoader::Shutdown(); |
| 262 | 248 |
| 263 CrosDBusService::Shutdown(); | 249 CrosDBusService::Shutdown(); |
| 264 | 250 |
| 265 // Shutdown the PowerDataCollector before shutting down DBusThreadManager. | 251 // Shutdown the PowerDataCollector before shutting down DBusThreadManager. |
| 266 PowerDataCollector::Shutdown(); | 252 PowerDataCollector::Shutdown(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // LOGIN_USER_CHANGED notification from UserManager. | 391 // LOGIN_USER_CHANGED notification from UserManager. |
| 406 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 392 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 407 KioskModeIdleLogout::Initialize(); | 393 KioskModeIdleLogout::Initialize(); |
| 408 else | 394 else |
| 409 ScreenLocker::InitClass(); | 395 ScreenLocker::InitClass(); |
| 410 | 396 |
| 411 // This forces the ProfileManager to be created and register for the | 397 // This forces the ProfileManager to be created and register for the |
| 412 // notification it needs to track the logged in user. | 398 // notification it needs to track the logged in user. |
| 413 g_browser_process->profile_manager(); | 399 g_browser_process->profile_manager(); |
| 414 | 400 |
| 401 // AccessibilityManager and SystemKeyEventListener use InputMethodManager. |
| 402 input_method::Initialize(); |
| 403 |
| 415 // ProfileHelper has to be initialized after UserManager instance is created. | 404 // ProfileHelper has to be initialized after UserManager instance is created. |
| 416 ProfileHelper::Get()->Initialize(); | 405 ProfileHelper::Get()->Initialize(); |
| 417 | 406 |
| 418 // TODO(abarth): Should this move to InitializeNetworkOptions()? | 407 // TODO(abarth): Should this move to InitializeNetworkOptions()? |
| 419 // Allow access to file:// on ChromeOS for tests. | 408 // Allow access to file:// on ChromeOS for tests. |
| 420 if (parsed_command_line().HasSwitch(::switches::kAllowFileAccess)) | 409 if (parsed_command_line().HasSwitch(::switches::kAllowFileAccess)) |
| 421 ChromeNetworkDelegate::AllowAccessToAllFiles(); | 410 ChromeNetworkDelegate::AllowAccessToAllFiles(); |
| 422 | 411 |
| 423 // If kLoginUser is passed this indicates that user has already | 412 // If kLoginUser is passed this indicates that user has already |
| 424 // logged in and we should behave accordingly. | 413 // logged in and we should behave accordingly. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 625 } |
| 637 | 626 |
| 638 peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); | 627 peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); |
| 639 | 628 |
| 640 g_browser_process->platform_part()->InitializeAutomaticRebootManager(); | 629 g_browser_process->platform_part()->InitializeAutomaticRebootManager(); |
| 641 | 630 |
| 642 // This observer cannot be created earlier because it requires the shell to be | 631 // This observer cannot be created earlier because it requires the shell to be |
| 643 // available. | 632 // available. |
| 644 idle_action_warning_observer_.reset(new IdleActionWarningObserver()); | 633 idle_action_warning_observer_.reset(new IdleActionWarningObserver()); |
| 645 | 634 |
| 635 input_method::InputMethodManager::Get()->InitializeComponentExtension(); |
| 636 |
| 646 ChromeBrowserMainPartsLinux::PostProfileInit(); | 637 ChromeBrowserMainPartsLinux::PostProfileInit(); |
| 647 } | 638 } |
| 648 | 639 |
| 649 void ChromeBrowserMainPartsChromeos::PreBrowserStart() { | 640 void ChromeBrowserMainPartsChromeos::PreBrowserStart() { |
| 650 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 641 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 651 // -- just before MetricsService::LogNeedForCleanShutdown(). | 642 // -- just before MetricsService::LogNeedForCleanShutdown(). |
| 652 | 643 |
| 653 // Start the external metrics service, which collects metrics from Chrome OS | 644 // Start the external metrics service, which collects metrics from Chrome OS |
| 654 // and passes them to the browser process. | 645 // and passes them to the browser process. |
| 655 external_metrics_ = new chromeos::ExternalMetrics; | 646 external_metrics_ = new chromeos::ExternalMetrics; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 // per-Profile InvalidationServices and the device-global | 784 // per-Profile InvalidationServices and the device-global |
| 794 // invalidation::TiclInvalidationService it may have created as an observer of | 785 // invalidation::TiclInvalidationService it may have created as an observer of |
| 795 // the DeviceOAuth2TokenService that is about to be destroyed. | 786 // the DeviceOAuth2TokenService that is about to be destroyed. |
| 796 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | 787 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 797 ShutdownInvalidator(); | 788 ShutdownInvalidator(); |
| 798 | 789 |
| 799 // We first call PostMainMessageLoopRun and then destroy UserManager, because | 790 // We first call PostMainMessageLoopRun and then destroy UserManager, because |
| 800 // Ash needs to be closed before UserManager is destroyed. | 791 // Ash needs to be closed before UserManager is destroyed. |
| 801 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 792 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
| 802 | 793 |
| 794 input_method::Shutdown(); |
| 795 |
| 803 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. | 796 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. |
| 804 DeviceOAuth2TokenServiceFactory::Shutdown(); | 797 DeviceOAuth2TokenServiceFactory::Shutdown(); |
| 805 | 798 |
| 806 // Called after | 799 // Called after |
| 807 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() to be | 800 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() to be |
| 808 // executed after execution of chrome::CloseAsh(), because some | 801 // executed after execution of chrome::CloseAsh(), because some |
| 809 // parts of WebUI depends on NetworkPortalDetector. | 802 // parts of WebUI depends on NetworkPortalDetector. |
| 810 NetworkPortalDetector::Shutdown(); | 803 NetworkPortalDetector::Shutdown(); |
| 811 | 804 |
| 812 UserManager::Destroy(); | 805 UserManager::Destroy(); |
| 813 } | 806 } |
| 814 | 807 |
| 815 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { | 808 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { |
| 816 // Destroy DBus services immediately after threads are stopped. | 809 // Destroy DBus services immediately after threads are stopped. |
| 817 dbus_services_.reset(); | 810 dbus_services_.reset(); |
| 818 | 811 |
| 819 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 812 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 820 | 813 |
| 821 // Destroy DeviceSettingsService after g_browser_process. | 814 // Destroy DeviceSettingsService after g_browser_process. |
| 822 DeviceSettingsService::Shutdown(); | 815 DeviceSettingsService::Shutdown(); |
| 823 } | 816 } |
| 824 | 817 |
| 825 } // namespace chromeos | 818 } // namespace chromeos |
| OLD | NEW |