| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 28 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 28 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 30 #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h" | 30 #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h" |
| 31 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 31 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 32 #include "chrome/browser/chromeos/boot_times_loader.h" | 32 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 33 #include "chrome/browser/chromeos/contacts/contact_manager.h" | 33 #include "chrome/browser/chromeos/contacts/contact_manager.h" |
| 34 #include "chrome/browser/chromeos/cros/cert_library.h" | 34 #include "chrome/browser/chromeos/cros/cert_library.h" |
| 35 #include "chrome/browser/chromeos/cros/network_library.h" |
| 35 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 36 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 36 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 37 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
| 37 #include "chrome/browser/chromeos/extensions/default_app_order.h" | 38 #include "chrome/browser/chromeos/extensions/default_app_order.h" |
| 38 #include "chrome/browser/chromeos/external_metrics.h" | 39 #include "chrome/browser/chromeos/external_metrics.h" |
| 39 #include "chrome/browser/chromeos/imageburner/burn_manager.h" | 40 #include "chrome/browser/chromeos/imageburner/burn_manager.h" |
| 40 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 41 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
| 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" | 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
| 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 44 #include "chrome/browser/chromeos/login/authenticator.h" | 45 #include "chrome/browser/chromeos/login/authenticator.h" |
| 45 #include "chrome/browser/chromeos/login/default_pinned_apps_field_trial.h" | 46 #include "chrome/browser/chromeos/login/default_pinned_apps_field_trial.h" |
| 46 #include "chrome/browser/chromeos/login/login_utils.h" | 47 #include "chrome/browser/chromeos/login/login_utils.h" |
| 47 #include "chrome/browser/chromeos/login/login_wizard.h" | 48 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 48 #include "chrome/browser/chromeos/login/screen_locker.h" | 49 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 49 #include "chrome/browser/chromeos/login/startup_utils.h" | 50 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 50 #include "chrome/browser/chromeos/login/user_manager.h" | 51 #include "chrome/browser/chromeos/login/user_manager.h" |
| 51 #include "chrome/browser/chromeos/login/wallpaper_manager.h" | 52 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 52 #include "chrome/browser/chromeos/login/wizard_controller.h" | 53 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 53 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 54 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
| 54 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" | |
| 55 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" | |
| 56 #include "chrome/browser/chromeos/net/network_change_notifier_network_library.h" | |
| 57 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 55 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 58 #include "chrome/browser/chromeos/power/brightness_observer.h" | 56 #include "chrome/browser/chromeos/power/brightness_observer.h" |
| 59 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h" | 57 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h" |
| 60 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" | 58 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
| 61 #include "chrome/browser/chromeos/power/power_button_observer.h" | 59 #include "chrome/browser/chromeos/power/power_button_observer.h" |
| 62 #include "chrome/browser/chromeos/power/power_prefs.h" | 60 #include "chrome/browser/chromeos/power/power_prefs.h" |
| 63 #include "chrome/browser/chromeos/power/resume_observer.h" | 61 #include "chrome/browser/chromeos/power/resume_observer.h" |
| 64 #include "chrome/browser/chromeos/power/screen_lock_observer.h" | 62 #include "chrome/browser/chromeos/power/screen_lock_observer.h" |
| 65 #include "chrome/browser/chromeos/power/suspend_observer.h" | 63 #include "chrome/browser/chromeos/power/suspend_observer.h" |
| 66 #include "chrome/browser/chromeos/power/user_activity_notifier.h" | 64 #include "chrome/browser/chromeos/power/user_activity_notifier.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 294 } |
| 297 | 295 |
| 298 // Always initialize these handlers which should not conflict with | 296 // Always initialize these handlers which should not conflict with |
| 299 // NetworkLibrary. | 297 // NetworkLibrary. |
| 300 NetworkHandler::Initialize(); | 298 NetworkHandler::Initialize(); |
| 301 CertLibrary::Initialize(); | 299 CertLibrary::Initialize(); |
| 302 | 300 |
| 303 // Initialize the network change notifier for Chrome OS. The network | 301 // Initialize the network change notifier for Chrome OS. The network |
| 304 // change notifier starts to monitor changes from the power manager and | 302 // change notifier starts to monitor changes from the power manager and |
| 305 // the network manager. | 303 // the network manager. |
| 306 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 304 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); |
| 307 chromeos::switches::kDisableNewNetworkChangeNotifier)) { | |
| 308 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); | |
| 309 } else { | |
| 310 CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | |
| 311 } | |
| 312 | 305 |
| 313 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade | 306 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade |
| 314 // detector starts to monitor changes from the update engine. | 307 // detector starts to monitor changes from the update engine. |
| 315 UpgradeDetectorChromeos::GetInstance()->Init(); | 308 UpgradeDetectorChromeos::GetInstance()->Init(); |
| 316 | 309 |
| 317 if (base::chromeos::IsRunningOnChromeOS()) { | 310 if (base::chromeos::IsRunningOnChromeOS()) { |
| 318 // Disable Num Lock on X start up for http://crosbug.com/29169. | 311 // Disable Num Lock on X start up for http://crosbug.com/29169. |
| 319 input_method::InputMethodManager::Get()->GetXKeyboard()-> | 312 input_method::InputMethodManager::Get()->GetXKeyboard()-> |
| 320 SetNumLockEnabled(false); | 313 SetNumLockEnabled(false); |
| 321 } | 314 } |
| 322 | 315 |
| 323 // Initialize the device settings service so that we'll take actions per | 316 // Initialize the device settings service so that we'll take actions per |
| 324 // signals sent from the session manager. This needs to happen before | 317 // signals sent from the session manager. This needs to happen before |
| 325 // g_browser_process initializes BrowserPolicyConnector. | 318 // g_browser_process initializes BrowserPolicyConnector. |
| 326 DeviceSettingsService::Initialize(); | 319 DeviceSettingsService::Initialize(); |
| 327 DeviceSettingsService::Get()->SetSessionManager( | 320 DeviceSettingsService::Get()->SetSessionManager( |
| 328 DBusThreadManager::Get()->GetSessionManagerClient(), | 321 DBusThreadManager::Get()->GetSessionManagerClient(), |
| 329 OwnerKeyUtil::Create()); | 322 OwnerKeyUtil::Create()); |
| 330 ConnectivityStateHelper::Initialize(); | |
| 331 } | 323 } |
| 332 | 324 |
| 333 ~DBusServices() { | 325 ~DBusServices() { |
| 334 ConnectivityStateHelper::Shutdown(); | |
| 335 | |
| 336 CertLibrary::Shutdown(); | 326 CertLibrary::Shutdown(); |
| 337 NetworkHandler::Shutdown(); | 327 NetworkHandler::Shutdown(); |
| 338 if (network_library_initialized_) | 328 if (network_library_initialized_) |
| 339 NetworkLibrary::Shutdown(); | 329 NetworkLibrary::Shutdown(); |
| 340 | 330 |
| 341 cryptohome::AsyncMethodCaller::Shutdown(); | 331 cryptohome::AsyncMethodCaller::Shutdown(); |
| 342 disks::DiskMountManager::Shutdown(); | 332 disks::DiskMountManager::Shutdown(); |
| 343 input_method::Shutdown(); | 333 input_method::Shutdown(); |
| 344 | 334 |
| 345 CryptohomeLibrary::Shutdown(); | 335 CryptohomeLibrary::Shutdown(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // channel info is read and made available early. | 401 // channel info is read and made available early. |
| 412 system::StatisticsProvider::GetInstance()->Init(); | 402 system::StatisticsProvider::GetInstance()->Init(); |
| 413 | 403 |
| 414 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); | 404 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); |
| 415 } | 405 } |
| 416 | 406 |
| 417 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { | 407 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { |
| 418 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific | 408 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific |
| 419 // implementation. This must be done before BrowserMainLoop calls | 409 // implementation. This must be done before BrowserMainLoop calls |
| 420 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). | 410 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). |
| 421 net::NetworkChangeNotifierFactory* network_change_factory; | 411 net::NetworkChangeNotifier::SetFactory( |
| 422 // Note: At the time this is called, we have not processed about:flags | 412 new NetworkChangeNotifierFactoryChromeos()); |
| 423 // so this requires that the network handler flag was passed in at the command | |
| 424 // line. | |
| 425 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
| 426 chromeos::switches::kDisableNewNetworkChangeNotifier)) { | |
| 427 LOG(WARNING) << "Using new connection change notifier."; | |
| 428 network_change_factory = new NetworkChangeNotifierFactoryChromeos(); | |
| 429 } else { | |
| 430 network_change_factory = new CrosNetworkChangeNotifierFactory(); | |
| 431 } | |
| 432 net::NetworkChangeNotifier::SetFactory(network_change_factory); | |
| 433 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); | 413 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); |
| 434 } | 414 } |
| 435 | 415 |
| 436 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 416 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { |
| 437 base::MessageLoopForUI* message_loop = base::MessageLoopForUI::current(); | 417 base::MessageLoopForUI* message_loop = base::MessageLoopForUI::current(); |
| 438 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 418 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
| 439 | 419 |
| 440 dbus_services_.reset(new internal::DBusServices(parameters())); | 420 dbus_services_.reset(new internal::DBusServices(parameters())); |
| 441 | 421 |
| 442 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 422 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 DeviceOAuth2TokenServiceFactory::Shutdown(); | 713 DeviceOAuth2TokenServiceFactory::Shutdown(); |
| 734 | 714 |
| 735 // Shutdown the upgrade detector for Chrome OS. The upgrade detector | 715 // Shutdown the upgrade detector for Chrome OS. The upgrade detector |
| 736 // stops monitoring changes from the update engine. | 716 // stops monitoring changes from the update engine. |
| 737 if (UpgradeDetectorChromeos::GetInstance()) | 717 if (UpgradeDetectorChromeos::GetInstance()) |
| 738 UpgradeDetectorChromeos::GetInstance()->Shutdown(); | 718 UpgradeDetectorChromeos::GetInstance()->Shutdown(); |
| 739 | 719 |
| 740 // Shutdown the network change notifier for Chrome OS. The network | 720 // Shutdown the network change notifier for Chrome OS. The network |
| 741 // change notifier stops monitoring changes from the power manager and | 721 // change notifier stops monitoring changes from the power manager and |
| 742 // the network manager. | 722 // the network manager. |
| 743 if (CrosNetworkChangeNotifierFactory::GetInstance()) | |
| 744 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); | |
| 745 if (NetworkChangeNotifierFactoryChromeos::GetInstance()) | 723 if (NetworkChangeNotifierFactoryChromeos::GetInstance()) |
| 746 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown(); | 724 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown(); |
| 747 | 725 |
| 748 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); | 726 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); |
| 749 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) | 727 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) |
| 750 detector->Shutdown(); | 728 detector->Shutdown(); |
| 751 | 729 |
| 752 // Tell DeviceSettingsService to stop talking to session_manager. Do not | 730 // Tell DeviceSettingsService to stop talking to session_manager. Do not |
| 753 // shutdown DeviceSettingsService yet, it might still be accessed by | 731 // shutdown DeviceSettingsService yet, it might still be accessed by |
| 754 // BrowserPolicyConnector (owned by g_browser_process). | 732 // BrowserPolicyConnector (owned by g_browser_process). |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 802 |
| 825 // Destroy DeviceSettingsService after g_browser_process. | 803 // Destroy DeviceSettingsService after g_browser_process. |
| 826 DeviceSettingsService::Shutdown(); | 804 DeviceSettingsService::Shutdown(); |
| 827 } | 805 } |
| 828 | 806 |
| 829 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 807 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 830 default_pinned_apps_field_trial::SetupTrial(); | 808 default_pinned_apps_field_trial::SetupTrial(); |
| 831 } | 809 } |
| 832 | 810 |
| 833 } // namespace chromeos | 811 } // namespace chromeos |
| OLD | NEW |