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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 #include "net/base/network_change_notifier.h" | 105 #include "net/base/network_change_notifier.h" |
106 #include "net/url_request/url_request.h" | 106 #include "net/url_request/url_request.h" |
107 #include "net/url_request/url_request_context_getter.h" | 107 #include "net/url_request/url_request_context_getter.h" |
108 #include "ui/base/touch/touch_device.h" | 108 #include "ui/base/touch/touch_device.h" |
109 #include "ui/events/event_utils.h" | 109 #include "ui/events/event_utils.h" |
110 | 110 |
111 // Exclude X11 dependents for ozone | 111 // Exclude X11 dependents for ozone |
112 #if defined(USE_X11) | 112 #if defined(USE_X11) |
113 #include "chrome/browser/chromeos/device_uma.h" | 113 #include "chrome/browser/chromeos/device_uma.h" |
114 #include "chrome/browser/chromeos/events/event_rewriter.h" | 114 #include "chrome/browser/chromeos/events/event_rewriter.h" |
115 #include "chrome/browser/chromeos/events/event_rewriter_controller.h" | |
116 #include "chrome/browser/chromeos/events/keyboard_driven_event_rewriter.h" | |
115 #include "chrome/browser/chromeos/events/system_key_event_listener.h" | 117 #include "chrome/browser/chromeos/events/system_key_event_listener.h" |
116 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener .h" | 118 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener .h" |
117 #endif | 119 #endif |
118 | 120 |
119 namespace chromeos { | 121 namespace chromeos { |
120 | 122 |
121 namespace { | 123 namespace { |
122 | 124 |
123 void ChromeOSVersionCallback(const std::string& version) { | 125 void ChromeOSVersionCallback(const std::string& version) { |
124 base::SetLinuxDistro(std::string("CrOS ") + version); | 126 base::SetLinuxDistro(std::string("CrOS ") + version); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( | 423 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( |
422 content::BrowserThread::GetMessageLoopProxyForThread( | 424 content::BrowserThread::GetMessageLoopProxyForThread( |
423 content::BrowserThread::FILE), | 425 content::BrowserThread::FILE), |
424 load_oem_statistics); | 426 load_oem_statistics); |
425 | 427 |
426 base::FilePath downloads_directory; | 428 base::FilePath downloads_directory; |
427 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); | 429 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); |
428 imageburner::BurnManager::Initialize( | 430 imageburner::BurnManager::Initialize( |
429 downloads_directory, g_browser_process->system_request_context()); | 431 downloads_directory, g_browser_process->system_request_context()); |
430 | 432 |
431 #if defined(USE_X11) | 433 #if defined(USE_X11) |
kpschoedel
2014/04/22 19:53:08
Sorry, didn't notice the upstream change in time.
| |
432 // Listen for system key events so that the user will be able to adjust the | 434 // Listen for system key events so that the user will be able to adjust the |
433 // volume on the login screen, if Chrome is running on Chrome OS | 435 // volume on the login screen, if Chrome is running on Chrome OS |
434 // (i.e. not Linux desktop), and in non-test mode. | 436 // (i.e. not Linux desktop), and in non-test mode. |
435 // Note: SystemKeyEventListener depends on the DBus thread. | 437 // Note: SystemKeyEventListener depends on the DBus thread. |
436 if (base::SysInfo::IsRunningOnChromeOS() && | 438 if (base::SysInfo::IsRunningOnChromeOS() && |
437 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 439 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
438 SystemKeyEventListener::Initialize(); | 440 SystemKeyEventListener::Initialize(); |
439 } | 441 } |
440 #endif | 442 #endif |
441 | 443 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
699 #if defined(USE_X11) | 701 #if defined(USE_X11) |
700 // Listen for XI_HierarchyChanged events. Note: if this is moved to | 702 // Listen for XI_HierarchyChanged events. Note: if this is moved to |
701 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown | 703 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown |
702 // reasons, see http://crosbug.com/24833. | 704 // reasons, see http://crosbug.com/24833. |
703 XInputHierarchyChangedEventListener::GetInstance(); | 705 XInputHierarchyChangedEventListener::GetInstance(); |
704 | 706 |
705 // Start the CrOS input device UMA watcher | 707 // Start the CrOS input device UMA watcher |
706 DeviceUMA::GetInstance(); | 708 DeviceUMA::GetInstance(); |
707 | 709 |
708 event_rewriter_.reset(new EventRewriter()); | 710 event_rewriter_.reset(new EventRewriter()); |
711 keyboard_driven_event_rewriter_.reset( | |
712 new EventRewriterController(new KeyboardDrivenEventRewriter())); | |
709 #endif | 713 #endif |
710 | 714 |
711 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 715 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
712 // -- immediately after ChildProcess::WaitForDebugger(). | 716 // -- immediately after ChildProcess::WaitForDebugger(). |
713 | 717 |
714 // Start the out-of-memory priority manager here so that we give the most | 718 // Start the out-of-memory priority manager here so that we give the most |
715 // amount of time for the other services to start up before we start | 719 // amount of time for the other services to start up before we start |
716 // adjusting the oom priority. | 720 // adjusting the oom priority. |
717 g_browser_process->platform_part()->oom_priority_manager()->Start(); | 721 g_browser_process->platform_part()->oom_priority_manager()->Start(); |
718 | 722 |
719 if (ui::ShouldDefaultToNaturalScroll()) { | 723 if (ui::ShouldDefaultToNaturalScroll()) { |
720 CommandLine::ForCurrentProcess()->AppendSwitch( | 724 CommandLine::ForCurrentProcess()->AppendSwitch( |
721 chromeos::switches::kNaturalScrollDefault); | 725 chromeos::switches::kNaturalScrollDefault); |
722 system::InputDeviceSettings::Get()->SetTapToClick(true); | 726 system::InputDeviceSettings::Get()->SetTapToClick(true); |
723 } | 727 } |
724 | 728 |
725 ChromeBrowserMainPartsLinux::PreBrowserStart(); | 729 ChromeBrowserMainPartsLinux::PreBrowserStart(); |
726 } | 730 } |
727 | 731 |
728 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { | 732 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { |
729 // These are dependent on the ash::Shell singleton already having been | 733 // These are dependent on the ash::Shell singleton already having been |
730 // initialized. | 734 // initialized. |
731 power_button_observer_.reset(new PowerButtonObserver); | 735 power_button_observer_.reset(new PowerButtonObserver); |
732 data_promo_notification_.reset(new DataPromoNotification()), | 736 data_promo_notification_.reset(new DataPromoNotification()), |
733 | 737 |
738 #if defined(USE_X11) | |
739 keyboard_driven_event_rewriter_->Init(); | |
740 #endif | |
741 | |
734 ChromeBrowserMainPartsLinux::PostBrowserStart(); | 742 ChromeBrowserMainPartsLinux::PostBrowserStart(); |
735 } | 743 } |
736 | 744 |
737 // Shut down services before the browser process, etc are destroyed. | 745 // Shut down services before the browser process, etc are destroyed. |
738 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { | 746 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { |
739 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); | 747 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); |
740 | 748 |
741 g_browser_process->platform_part()->oom_priority_manager()->Stop(); | 749 g_browser_process->platform_part()->oom_priority_manager()->Stop(); |
742 | 750 |
743 // Destroy the application name notifier for Kiosk mode. | 751 // Destroy the application name notifier for Kiosk mode. |
(...skipping 25 matching lines...) Expand all Loading... | |
769 retail_mode_power_save_blocker_.reset(); | 777 retail_mode_power_save_blocker_.reset(); |
770 peripheral_battery_observer_.reset(); | 778 peripheral_battery_observer_.reset(); |
771 power_prefs_.reset(); | 779 power_prefs_.reset(); |
772 | 780 |
773 // Let the ScreenLocker unregister itself from SessionManagerClient before | 781 // Let the ScreenLocker unregister itself from SessionManagerClient before |
774 // DBusThreadManager is shut down. | 782 // DBusThreadManager is shut down. |
775 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) | 783 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) |
776 ScreenLocker::ShutDownClass(); | 784 ScreenLocker::ShutDownClass(); |
777 | 785 |
778 #if defined(USE_X11) | 786 #if defined(USE_X11) |
787 keyboard_driven_event_rewriter_.reset(); | |
779 event_rewriter_.reset(); | 788 event_rewriter_.reset(); |
780 | 789 |
781 // The XInput2 event listener needs to be shut down earlier than when | 790 // The XInput2 event listener needs to be shut down earlier than when |
782 // Singletons are finally destroyed in AtExitManager. | 791 // Singletons are finally destroyed in AtExitManager. |
783 XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 792 XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
784 | 793 |
785 DeviceUMA::GetInstance()->Stop(); | 794 DeviceUMA::GetInstance()->Stop(); |
786 | 795 |
787 // SystemKeyEventListener::Shutdown() is always safe to call, | 796 // SystemKeyEventListener::Shutdown() is always safe to call, |
788 // even if Initialize() wasn't called. | 797 // even if Initialize() wasn't called. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 // Destroy DBus services immediately after threads are stopped. | 846 // Destroy DBus services immediately after threads are stopped. |
838 dbus_services_.reset(); | 847 dbus_services_.reset(); |
839 | 848 |
840 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 849 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
841 | 850 |
842 // Destroy DeviceSettingsService after g_browser_process. | 851 // Destroy DeviceSettingsService after g_browser_process. |
843 DeviceSettingsService::Shutdown(); | 852 DeviceSettingsService::Shutdown(); |
844 } | 853 } |
845 | 854 |
846 } // namespace chromeos | 855 } // namespace chromeos |
OLD | NEW |