| 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/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "chrome/browser/chromeos/power/brightness_observer.h" | 59 #include "chrome/browser/chromeos/power/brightness_observer.h" |
| 60 #include "chrome/browser/chromeos/power/output_observer.h" | 60 #include "chrome/browser/chromeos/power/output_observer.h" |
| 61 #include "chrome/browser/chromeos/power/power_button_observer.h" | 61 #include "chrome/browser/chromeos/power/power_button_observer.h" |
| 62 #include "chrome/browser/chromeos/power/resume_observer.h" | 62 #include "chrome/browser/chromeos/power/resume_observer.h" |
| 63 #include "chrome/browser/chromeos/power/screen_dimming_observer.h" | 63 #include "chrome/browser/chromeos/power/screen_dimming_observer.h" |
| 64 #include "chrome/browser/chromeos/power/screen_lock_observer.h" | 64 #include "chrome/browser/chromeos/power/screen_lock_observer.h" |
| 65 #include "chrome/browser/chromeos/power/suspend_observer.h" | 65 #include "chrome/browser/chromeos/power/suspend_observer.h" |
| 66 #include "chrome/browser/chromeos/power/user_activity_notifier.h" | 66 #include "chrome/browser/chromeos/power/user_activity_notifier.h" |
| 67 #include "chrome/browser/chromeos/power/video_activity_notifier.h" | 67 #include "chrome/browser/chromeos/power/video_activity_notifier.h" |
| 68 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h" | 68 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h" |
| 69 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 69 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 70 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 70 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 71 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 71 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 72 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
| 72 #include "chrome/browser/chromeos/system/statistics_provider.h" | 73 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 73 #include "chrome/browser/chromeos/system_key_event_listener.h" | 74 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 74 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 75 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 75 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" | 76 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" |
| 76 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 77 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
| 77 #include "chrome/browser/defaults.h" | 78 #include "chrome/browser/defaults.h" |
| 78 #include "chrome/browser/metrics/metrics_service.h" | 79 #include "chrome/browser/metrics/metrics_service.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 444 |
| 444 // Listen for system key events so that the user will be able to adjust the | 445 // Listen for system key events so that the user will be able to adjust the |
| 445 // volume on the login screen, if Chrome is running on Chrome OS | 446 // volume on the login screen, if Chrome is running on Chrome OS |
| 446 // (i.e. not Linux desktop), and in non-test mode. | 447 // (i.e. not Linux desktop), and in non-test mode. |
| 447 // Note: SystemKeyEventListener depends on the DBus thread. | 448 // Note: SystemKeyEventListener depends on the DBus thread. |
| 448 if (base::chromeos::IsRunningOnChromeOS() && | 449 if (base::chromeos::IsRunningOnChromeOS() && |
| 449 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 450 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 450 SystemKeyEventListener::Initialize(); | 451 SystemKeyEventListener::Initialize(); |
| 451 } | 452 } |
| 452 | 453 |
| 454 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
| 455 |
| 453 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 456 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
| 454 } | 457 } |
| 455 | 458 |
| 456 void ChromeBrowserMainPartsChromeos::PreProfileInit() { | 459 void ChromeBrowserMainPartsChromeos::PreProfileInit() { |
| 457 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 460 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 458 // -- immediately before Profile creation(). | 461 // -- immediately before Profile creation(). |
| 459 | 462 |
| 460 // Now that the file thread exists we can record our stats. | 463 // Now that the file thread exists we can record our stats. |
| 461 BootTimesLoader::Get()->RecordChromeMainStats(); | 464 BootTimesLoader::Get()->RecordChromeMainStats(); |
| 462 | 465 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", | 685 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", |
| 683 true); | 686 true); |
| 684 | 687 |
| 685 g_browser_process->oom_priority_manager()->Stop(); | 688 g_browser_process->oom_priority_manager()->Stop(); |
| 686 | 689 |
| 687 // Stops LoginUtils background fetchers. This is needed because IO thread is | 690 // Stops LoginUtils background fetchers. This is needed because IO thread is |
| 688 // going to stop soon after this function. The pending background jobs could | 691 // going to stop soon after this function. The pending background jobs could |
| 689 // cause it to crash during shutdown. | 692 // cause it to crash during shutdown. |
| 690 LoginUtils::Get()->StopBackgroundFetchers(); | 693 LoginUtils::Get()->StopBackgroundFetchers(); |
| 691 | 694 |
| 695 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. |
| 696 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); |
| 697 |
| 692 // Shutdown the upgrade detector for Chrome OS. The upgrade detector | 698 // Shutdown the upgrade detector for Chrome OS. The upgrade detector |
| 693 // stops monitoring changes from the update engine. | 699 // stops monitoring changes from the update engine. |
| 694 if (UpgradeDetectorChromeos::GetInstance()) | 700 if (UpgradeDetectorChromeos::GetInstance()) |
| 695 UpgradeDetectorChromeos::GetInstance()->Shutdown(); | 701 UpgradeDetectorChromeos::GetInstance()->Shutdown(); |
| 696 | 702 |
| 697 // Shutdown the network change notifier for Chrome OS. The network | 703 // Shutdown the network change notifier for Chrome OS. The network |
| 698 // change notifier stops monitoring changes from the power manager and | 704 // change notifier stops monitoring changes from the power manager and |
| 699 // the network manager. | 705 // the network manager. |
| 700 if (CrosNetworkChangeNotifierFactory::GetInstance()) | 706 if (CrosNetworkChangeNotifierFactory::GetInstance()) |
| 701 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); | 707 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return; | 867 return; |
| 862 | 868 |
| 863 // If failed to launch, go back to login screen. | 869 // If failed to launch, go back to login screen. |
| 864 LOG(ERROR) << "Failed to launch kiosk app. Fall back to login screen"; | 870 LOG(ERROR) << "Failed to launch kiosk app. Fall back to login screen"; |
| 865 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 871 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
| 866 | 872 |
| 867 // TODO(xiyuan): Show error message. | 873 // TODO(xiyuan): Show error message. |
| 868 } | 874 } |
| 869 | 875 |
| 870 } // namespace chromeos | 876 } // namespace chromeos |
| OLD | NEW |