| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 24 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 27 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 27 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 30 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" | 30 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" |
| 31 #include "chrome/browser/chromeos/boot_times_loader.h" | 31 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 32 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 32 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 33 #include "chrome/browser/chromeos/events/event_rewriter.h" | |
| 34 #include "chrome/browser/chromeos/events/system_key_event_listener.h" | |
| 35 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener
.h" | |
| 36 #include "chrome/browser/chromeos/extensions/default_app_order.h" | 33 #include "chrome/browser/chromeos/extensions/default_app_order.h" |
| 37 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h" | 34 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h" |
| 38 #include "chrome/browser/chromeos/external_metrics.h" | 35 #include "chrome/browser/chromeos/external_metrics.h" |
| 39 #include "chrome/browser/chromeos/imageburner/burn_manager.h" | 36 #include "chrome/browser/chromeos/imageburner/burn_manager.h" |
| 40 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 37 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 41 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 38 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 39 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
| 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" | 40 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
| 44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 45 #include "chrome/browser/chromeos/language_preferences.h" | 42 #include "chrome/browser/chromeos/language_preferences.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 #include "media/audio/sounds/sounds_manager.h" | 103 #include "media/audio/sounds/sounds_manager.h" |
| 107 #include "net/base/network_change_notifier.h" | 104 #include "net/base/network_change_notifier.h" |
| 108 #include "net/url_request/url_request.h" | 105 #include "net/url_request/url_request.h" |
| 109 #include "net/url_request/url_request_context_getter.h" | 106 #include "net/url_request/url_request_context_getter.h" |
| 110 #include "ui/base/touch/touch_device.h" | 107 #include "ui/base/touch/touch_device.h" |
| 111 #include "ui/events/event_utils.h" | 108 #include "ui/events/event_utils.h" |
| 112 | 109 |
| 113 // Exclude X11 dependents for ozone | 110 // Exclude X11 dependents for ozone |
| 114 #if defined(USE_X11) | 111 #if defined(USE_X11) |
| 115 #include "chrome/browser/chromeos/device_uma.h" | 112 #include "chrome/browser/chromeos/device_uma.h" |
| 113 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 114 #include "chrome/browser/chromeos/events/system_key_event_listener.h" |
| 115 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener
.h" |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 namespace chromeos { | 118 namespace chromeos { |
| 119 | 119 |
| 120 namespace { | 120 namespace { |
| 121 | 121 |
| 122 void ChromeOSVersionCallback(const std::string& version) { | 122 void ChromeOSVersionCallback(const std::string& version) { |
| 123 base::SetLinuxDistro(std::string("CrOS ") + version); | 123 base::SetLinuxDistro(std::string("CrOS ") + version); |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( | 418 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( |
| 419 content::BrowserThread::GetMessageLoopProxyForThread( | 419 content::BrowserThread::GetMessageLoopProxyForThread( |
| 420 content::BrowserThread::FILE), | 420 content::BrowserThread::FILE), |
| 421 load_oem_statistics); | 421 load_oem_statistics); |
| 422 | 422 |
| 423 base::FilePath downloads_directory; | 423 base::FilePath downloads_directory; |
| 424 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); | 424 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); |
| 425 imageburner::BurnManager::Initialize( | 425 imageburner::BurnManager::Initialize( |
| 426 downloads_directory, g_browser_process->system_request_context()); | 426 downloads_directory, g_browser_process->system_request_context()); |
| 427 | 427 |
| 428 #if defined(USE_X11) |
| 428 // Listen for system key events so that the user will be able to adjust the | 429 // Listen for system key events so that the user will be able to adjust the |
| 429 // volume on the login screen, if Chrome is running on Chrome OS | 430 // volume on the login screen, if Chrome is running on Chrome OS |
| 430 // (i.e. not Linux desktop), and in non-test mode. | 431 // (i.e. not Linux desktop), and in non-test mode. |
| 431 // Note: SystemKeyEventListener depends on the DBus thread. | 432 // Note: SystemKeyEventListener depends on the DBus thread. |
| 432 if (base::SysInfo::IsRunningOnChromeOS() && | 433 if (base::SysInfo::IsRunningOnChromeOS() && |
| 433 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 434 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 434 SystemKeyEventListener::Initialize(); | 435 SystemKeyEventListener::Initialize(); |
| 435 } | 436 } |
| 437 #endif |
| 436 | 438 |
| 437 DeviceOAuth2TokenServiceFactory::Initialize(); | 439 DeviceOAuth2TokenServiceFactory::Initialize(); |
| 438 | 440 |
| 439 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 441 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
| 440 } | 442 } |
| 441 | 443 |
| 442 void ChromeBrowserMainPartsChromeos::PreProfileInit() { | 444 void ChromeBrowserMainPartsChromeos::PreProfileInit() { |
| 443 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 445 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 444 // -- immediately before Profile creation(). | 446 // -- immediately before Profile creation(). |
| 445 | 447 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 686 |
| 685 ChromeBrowserMainPartsLinux::PostProfileInit(); | 687 ChromeBrowserMainPartsLinux::PostProfileInit(); |
| 686 } | 688 } |
| 687 | 689 |
| 688 void ChromeBrowserMainPartsChromeos::PreBrowserStart() { | 690 void ChromeBrowserMainPartsChromeos::PreBrowserStart() { |
| 689 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 691 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 690 // -- just before MetricsService::LogNeedForCleanShutdown(). | 692 // -- just before MetricsService::LogNeedForCleanShutdown(). |
| 691 | 693 |
| 692 g_browser_process->metrics_service()->StartExternalMetrics(); | 694 g_browser_process->metrics_service()->StartExternalMetrics(); |
| 693 | 695 |
| 696 #if defined(USE_X11) |
| 694 // Listen for XI_HierarchyChanged events. Note: if this is moved to | 697 // Listen for XI_HierarchyChanged events. Note: if this is moved to |
| 695 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown | 698 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown |
| 696 // reasons, see http://crosbug.com/24833. | 699 // reasons, see http://crosbug.com/24833. |
| 697 XInputHierarchyChangedEventListener::GetInstance(); | 700 XInputHierarchyChangedEventListener::GetInstance(); |
| 698 | 701 |
| 699 #if defined(USE_X11) | |
| 700 // Start the CrOS input device UMA watcher | 702 // Start the CrOS input device UMA watcher |
| 701 DeviceUMA::GetInstance(); | 703 DeviceUMA::GetInstance(); |
| 702 #endif | |
| 703 | 704 |
| 704 event_rewriter_.reset(new EventRewriter()); | 705 event_rewriter_.reset(new EventRewriter()); |
| 706 #endif |
| 705 | 707 |
| 706 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 708 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 707 // -- immediately after ChildProcess::WaitForDebugger(). | 709 // -- immediately after ChildProcess::WaitForDebugger(). |
| 708 | 710 |
| 709 // Start the out-of-memory priority manager here so that we give the most | 711 // Start the out-of-memory priority manager here so that we give the most |
| 710 // amount of time for the other services to start up before we start | 712 // amount of time for the other services to start up before we start |
| 711 // adjusting the oom priority. | 713 // adjusting the oom priority. |
| 712 g_browser_process->platform_part()->oom_priority_manager()->Start(); | 714 g_browser_process->platform_part()->oom_priority_manager()->Start(); |
| 713 | 715 |
| 714 if (ui::ShouldDefaultToNaturalScroll()) { | 716 if (ui::ShouldDefaultToNaturalScroll()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 // shutdown DeviceSettingsService yet, it might still be accessed by | 759 // shutdown DeviceSettingsService yet, it might still be accessed by |
| 758 // BrowserPolicyConnector (owned by g_browser_process). | 760 // BrowserPolicyConnector (owned by g_browser_process). |
| 759 DeviceSettingsService::Get()->UnsetSessionManager(); | 761 DeviceSettingsService::Get()->UnsetSessionManager(); |
| 760 | 762 |
| 761 // We should remove observers attached to D-Bus clients before | 763 // We should remove observers attached to D-Bus clients before |
| 762 // DBusThreadManager is shut down. | 764 // DBusThreadManager is shut down. |
| 763 extension_system_event_observer_.reset(); | 765 extension_system_event_observer_.reset(); |
| 764 retail_mode_power_save_blocker_.reset(); | 766 retail_mode_power_save_blocker_.reset(); |
| 765 peripheral_battery_observer_.reset(); | 767 peripheral_battery_observer_.reset(); |
| 766 power_prefs_.reset(); | 768 power_prefs_.reset(); |
| 767 event_rewriter_.reset(); | |
| 768 | 769 |
| 769 // Let the ScreenLocker unregister itself from SessionManagerClient before | 770 // Let the ScreenLocker unregister itself from SessionManagerClient before |
| 770 // DBusThreadManager is shut down. | 771 // DBusThreadManager is shut down. |
| 771 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) | 772 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 772 ScreenLocker::ShutDownClass(); | 773 ScreenLocker::ShutDownClass(); |
| 773 | 774 |
| 775 #if defined(USE_X11) |
| 776 event_rewriter_.reset(); |
| 777 |
| 774 // The XInput2 event listener needs to be shut down earlier than when | 778 // The XInput2 event listener needs to be shut down earlier than when |
| 775 // Singletons are finally destroyed in AtExitManager. | 779 // Singletons are finally destroyed in AtExitManager. |
| 776 XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 780 XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
| 777 | 781 |
| 778 #if defined(USE_X11) | |
| 779 DeviceUMA::GetInstance()->Stop(); | 782 DeviceUMA::GetInstance()->Stop(); |
| 780 #endif | |
| 781 | 783 |
| 782 // SystemKeyEventListener::Shutdown() is always safe to call, | 784 // SystemKeyEventListener::Shutdown() is always safe to call, |
| 783 // even if Initialize() wasn't called. | 785 // even if Initialize() wasn't called. |
| 784 SystemKeyEventListener::Shutdown(); | 786 SystemKeyEventListener::Shutdown(); |
| 787 #endif |
| 788 |
| 785 imageburner::BurnManager::Shutdown(); | 789 imageburner::BurnManager::Shutdown(); |
| 786 CrasAudioHandler::Shutdown(); | 790 CrasAudioHandler::Shutdown(); |
| 787 | 791 |
| 788 // Detach D-Bus clients before DBusThreadManager is shut down. | 792 // Detach D-Bus clients before DBusThreadManager is shut down. |
| 789 power_button_observer_.reset(); | 793 power_button_observer_.reset(); |
| 790 idle_action_warning_observer_.reset(); | 794 idle_action_warning_observer_.reset(); |
| 791 | 795 |
| 792 MagnificationManager::Shutdown(); | 796 MagnificationManager::Shutdown(); |
| 793 AccessibilityManager::Shutdown(); | 797 AccessibilityManager::Shutdown(); |
| 794 | 798 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 // Destroy DBus services immediately after threads are stopped. | 834 // Destroy DBus services immediately after threads are stopped. |
| 831 dbus_services_.reset(); | 835 dbus_services_.reset(); |
| 832 | 836 |
| 833 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 837 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 834 | 838 |
| 835 // Destroy DeviceSettingsService after g_browser_process. | 839 // Destroy DeviceSettingsService after g_browser_process. |
| 836 DeviceSettingsService::Shutdown(); | 840 DeviceSettingsService::Shutdown(); |
| 837 } | 841 } |
| 838 | 842 |
| 839 } // namespace chromeos | 843 } // namespace chromeos |
| OLD | NEW |