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" | |
sadrul
2014/04/23 19:32:53
These should move out of the USE_X11 block?
kpschoedel
2014/04/23 21:33:15
Done. Likewise event_rewriter.h in the other CL.
| |
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 // Listen for XI_HierarchyChanged events. Note: if this is moved to | 700 // Listen for XI_HierarchyChanged events. Note: if this is moved to |
699 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown | 701 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown |
700 // reasons, see http://crosbug.com/24833. | 702 // reasons, see http://crosbug.com/24833. |
701 XInputHierarchyChangedEventListener::GetInstance(); | 703 XInputHierarchyChangedEventListener::GetInstance(); |
702 | 704 |
703 // Start the CrOS input device UMA watcher | 705 // Start the CrOS input device UMA watcher |
704 DeviceUMA::GetInstance(); | 706 DeviceUMA::GetInstance(); |
705 | 707 |
706 event_rewriter_.reset(new EventRewriter()); | 708 event_rewriter_.reset(new EventRewriter()); |
707 #endif | 709 #endif |
710 keyboard_event_rewriters_.reset(new EventRewriterController()); | |
711 keyboard_event_rewriters_->AddEventRewriter( | |
712 scoped_ptr<ui::EventRewriter>(new KeyboardDrivenEventRewriter()).Pass()); | |
sadrul
2014/04/23 19:33:56
From your other CL, you don't need .Pass() here.
kpschoedel
2014/04/23 21:33:15
Done.
| |
708 | 713 |
709 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 714 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
710 // -- immediately after ChildProcess::WaitForDebugger(). | 715 // -- immediately after ChildProcess::WaitForDebugger(). |
711 | 716 |
712 // Start the out-of-memory priority manager here so that we give the most | 717 // Start the out-of-memory priority manager here so that we give the most |
713 // amount of time for the other services to start up before we start | 718 // amount of time for the other services to start up before we start |
714 // adjusting the oom priority. | 719 // adjusting the oom priority. |
715 g_browser_process->platform_part()->oom_priority_manager()->Start(); | 720 g_browser_process->platform_part()->oom_priority_manager()->Start(); |
716 | 721 |
717 if (ui::ShouldDefaultToNaturalScroll()) { | 722 if (ui::ShouldDefaultToNaturalScroll()) { |
718 CommandLine::ForCurrentProcess()->AppendSwitch( | 723 CommandLine::ForCurrentProcess()->AppendSwitch( |
719 chromeos::switches::kNaturalScrollDefault); | 724 chromeos::switches::kNaturalScrollDefault); |
720 system::InputDeviceSettings::Get()->SetTapToClick(true); | 725 system::InputDeviceSettings::Get()->SetTapToClick(true); |
721 } | 726 } |
722 | 727 |
723 ChromeBrowserMainPartsLinux::PreBrowserStart(); | 728 ChromeBrowserMainPartsLinux::PreBrowserStart(); |
724 } | 729 } |
725 | 730 |
726 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { | 731 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { |
727 // These are dependent on the ash::Shell singleton already having been | 732 // These are dependent on the ash::Shell singleton already having been |
728 // initialized. | 733 // initialized. |
729 power_button_observer_.reset(new PowerButtonObserver); | 734 power_button_observer_.reset(new PowerButtonObserver); |
730 data_promo_notification_.reset(new DataPromoNotification()), | 735 data_promo_notification_.reset(new DataPromoNotification()), |
736 keyboard_event_rewriters_->Init(); | |
731 | 737 |
732 ChromeBrowserMainPartsLinux::PostBrowserStart(); | 738 ChromeBrowserMainPartsLinux::PostBrowserStart(); |
733 } | 739 } |
734 | 740 |
735 // Shut down services before the browser process, etc are destroyed. | 741 // Shut down services before the browser process, etc are destroyed. |
736 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { | 742 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { |
737 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); | 743 BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); |
738 | 744 |
739 g_browser_process->platform_part()->oom_priority_manager()->Stop(); | 745 g_browser_process->platform_part()->oom_priority_manager()->Stop(); |
740 | 746 |
(...skipping 25 matching lines...) Expand all Loading... | |
766 extension_system_event_observer_.reset(); | 772 extension_system_event_observer_.reset(); |
767 retail_mode_power_save_blocker_.reset(); | 773 retail_mode_power_save_blocker_.reset(); |
768 peripheral_battery_observer_.reset(); | 774 peripheral_battery_observer_.reset(); |
769 power_prefs_.reset(); | 775 power_prefs_.reset(); |
770 | 776 |
771 // Let the ScreenLocker unregister itself from SessionManagerClient before | 777 // Let the ScreenLocker unregister itself from SessionManagerClient before |
772 // DBusThreadManager is shut down. | 778 // DBusThreadManager is shut down. |
773 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) | 779 if (!KioskModeSettings::Get()->IsKioskModeEnabled()) |
774 ScreenLocker::ShutDownClass(); | 780 ScreenLocker::ShutDownClass(); |
775 | 781 |
782 keyboard_event_rewriters_->Shutdown(); | |
776 #if defined(USE_X11) | 783 #if defined(USE_X11) |
777 event_rewriter_.reset(); | 784 event_rewriter_.reset(); |
778 | 785 |
779 // The XInput2 event listener needs to be shut down earlier than when | 786 // The XInput2 event listener needs to be shut down earlier than when |
780 // Singletons are finally destroyed in AtExitManager. | 787 // Singletons are finally destroyed in AtExitManager. |
781 XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 788 XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
782 | 789 |
783 DeviceUMA::GetInstance()->Stop(); | 790 DeviceUMA::GetInstance()->Stop(); |
784 | 791 |
785 // SystemKeyEventListener::Shutdown() is always safe to call, | 792 // SystemKeyEventListener::Shutdown() is always safe to call, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 // Destroy DBus services immediately after threads are stopped. | 842 // Destroy DBus services immediately after threads are stopped. |
836 dbus_services_.reset(); | 843 dbus_services_.reset(); |
837 | 844 |
838 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 845 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
839 | 846 |
840 // Destroy DeviceSettingsService after g_browser_process. | 847 // Destroy DeviceSettingsService after g_browser_process. |
841 DeviceSettingsService::Shutdown(); | 848 DeviceSettingsService::Shutdown(); |
842 } | 849 } |
843 | 850 |
844 } // namespace chromeos | 851 } // namespace chromeos |
OLD | NEW |