OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 #include "chrome/browser/chromeos/cros/cros_library.h" | 136 #include "chrome/browser/chromeos/cros/cros_library.h" |
137 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 137 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
138 #include "chrome/browser/chromeos/customization_document.h" | 138 #include "chrome/browser/chromeos/customization_document.h" |
139 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 139 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
140 #include "chrome/browser/chromeos/external_metrics.h" | 140 #include "chrome/browser/chromeos/external_metrics.h" |
141 #include "chrome/browser/chromeos/login/authenticator.h" | 141 #include "chrome/browser/chromeos/login/authenticator.h" |
142 #include "chrome/browser/chromeos/login/login_utils.h" | 142 #include "chrome/browser/chromeos/login/login_utils.h" |
143 #include "chrome/browser/chromeos/login/ownership_service.h" | 143 #include "chrome/browser/chromeos/login/ownership_service.h" |
144 #include "chrome/browser/chromeos/login/screen_locker.h" | 144 #include "chrome/browser/chromeos/login/screen_locker.h" |
145 #include "chrome/browser/chromeos/login/user_manager.h" | 145 #include "chrome/browser/chromeos/login/user_manager.h" |
| 146 #include "chrome/browser/chromeos/system/runtime_environment.h" |
146 #include "chrome/browser/chromeos/system_key_event_listener.h" | 147 #include "chrome/browser/chromeos/system_key_event_listener.h" |
147 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 148 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
148 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 149 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
149 #include "chrome/browser/oom_priority_manager.h" | 150 #include "chrome/browser/oom_priority_manager.h" |
150 #include "chrome/browser/ui/views/browser_dialogs.h" | 151 #include "chrome/browser/ui/views/browser_dialogs.h" |
151 #endif | 152 #endif |
152 | 153 |
153 // TODO(port): several win-only methods have been pulled out of this, but | 154 // TODO(port): several win-only methods have been pulled out of this, but |
154 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 155 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
155 // other platforms. For now, it's just a stub. This is a serious work in | 156 // other platforms. For now, it's just a stub. This is a serious work in |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 fragmentation_checker::RecordFragmentationMetricForCurrentModule(); | 1811 fragmentation_checker::RecordFragmentationMetricForCurrentModule(); |
1811 #endif | 1812 #endif |
1812 | 1813 |
1813 #if defined(OS_CHROMEOS) | 1814 #if defined(OS_CHROMEOS) |
1814 metrics->StartExternalMetrics(); | 1815 metrics->StartExternalMetrics(); |
1815 | 1816 |
1816 // Initialize the audio handler on ChromeOS. | 1817 // Initialize the audio handler on ChromeOS. |
1817 chromeos::AudioHandler::Initialize(); | 1818 chromeos::AudioHandler::Initialize(); |
1818 | 1819 |
1819 // Listen for system key events so that the user will be able to adjust the | 1820 // Listen for system key events so that the user will be able to adjust the |
1820 // volume on the login screen. | 1821 // volume on the login screen, if Chrome is running on Chrome OS |
1821 chromeos::SystemKeyEventListener::Initialize(); | 1822 // (i.e. not Linux desktop), and in non-test mode. |
| 1823 if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && |
| 1824 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 1825 chromeos::SystemKeyEventListener::Initialize(); |
| 1826 } |
1822 | 1827 |
1823 // Listen for XI_HierarchyChanged events. | 1828 // Listen for XI_HierarchyChanged events. |
1824 chromeos::XInputHierarchyChangedEventListener::GetInstance(); | 1829 chromeos::XInputHierarchyChangedEventListener::GetInstance(); |
1825 #endif | 1830 #endif |
1826 | 1831 |
1827 // The extension service may be available at this point. If the command line | 1832 // The extension service may be available at this point. If the command line |
1828 // specifies --uninstall-extension, attempt the uninstall extension startup | 1833 // specifies --uninstall-extension, attempt the uninstall extension startup |
1829 // action. | 1834 // action. |
1830 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { | 1835 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { |
1831 ExtensionsStartupUtil ext_startup_util; | 1836 ExtensionsStartupUtil ext_startup_util; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 // Stop all tasks that might run on WatchDogThread. | 2037 // Stop all tasks that might run on WatchDogThread. |
2033 ThreadWatcherList::StopWatchingAll(); | 2038 ThreadWatcherList::StopWatchingAll(); |
2034 | 2039 |
2035 g_browser_process->metrics_service()->Stop(); | 2040 g_browser_process->metrics_service()->Stop(); |
2036 | 2041 |
2037 #if defined(OS_CHROMEOS) | 2042 #if defined(OS_CHROMEOS) |
2038 // The XInput2 event listener needs to be shut down earlier than when | 2043 // The XInput2 event listener needs to be shut down earlier than when |
2039 // Singletons are finally destroyed in AtExitManager. | 2044 // Singletons are finally destroyed in AtExitManager. |
2040 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 2045 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
2041 | 2046 |
| 2047 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, |
| 2048 // even if Initialize() wasn't called. |
2042 chromeos::SystemKeyEventListener::Shutdown(); | 2049 chromeos::SystemKeyEventListener::Shutdown(); |
2043 chromeos::AudioHandler::Shutdown(); | 2050 chromeos::AudioHandler::Shutdown(); |
2044 #endif | 2051 #endif |
2045 | 2052 |
2046 // browser_shutdown takes care of deleting browser_process, so we need to | 2053 // browser_shutdown takes care of deleting browser_process, so we need to |
2047 // release it. | 2054 // release it. |
2048 ignore_result(browser_process_.release()); | 2055 ignore_result(browser_process_.release()); |
2049 browser_shutdown::Shutdown(); | 2056 browser_shutdown::Shutdown(); |
2050 master_prefs_.reset(); | 2057 master_prefs_.reset(); |
2051 process_singleton_.reset(); | 2058 process_singleton_.reset(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2103 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2097 (pre_read == "0" || pre_read == "1")) { | 2104 (pre_read == "0" || pre_read == "1")) { |
2098 std::string uma_name(name); | 2105 std::string uma_name(name); |
2099 uma_name += "_PreRead"; | 2106 uma_name += "_PreRead"; |
2100 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2107 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2101 AddPreReadHistogramTime(uma_name.c_str(), time); | 2108 AddPreReadHistogramTime(uma_name.c_str(), time); |
2102 } | 2109 } |
2103 #endif | 2110 #endif |
2104 #endif | 2111 #endif |
2105 } | 2112 } |
OLD | NEW |