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/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h" | 12 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h" |
13 #include "chrome/browser/chromeos/boot_times_loader.h" | 13 #include "chrome/browser/chromeos/boot_times_loader.h" |
14 #include "chrome/browser/chromeos/brightness_observer.h" | 14 #include "chrome/browser/chromeos/brightness_observer.h" |
15 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
16 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 16 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
17 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 17 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
18 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 18 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
19 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
20 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 20 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
21 #include "chrome/browser/chromeos/login/session_manager_observer.h" | 21 #include "chrome/browser/chromeos/login/session_manager_observer.h" |
22 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" | 22 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" |
23 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" | 23 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" |
24 #include "chrome/browser/chromeos/system/runtime_environment.h" | 24 #include "chrome/browser/chromeos/system/runtime_environment.h" |
25 #include "chrome/browser/chromeos/system/statistics_provider.h" | 25 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 26 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
26 #include "chrome/browser/defaults.h" | 27 #include "chrome/browser/defaults.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "content/public/common/main_function_params.h" | 29 #include "content/public/common/main_function_params.h" |
29 #include "net/base/network_change_notifier.h" | 30 #include "net/base/network_change_notifier.h" |
30 | 31 |
31 #if defined(TOOLKIT_USES_GTK) | 32 #if defined(TOOLKIT_USES_GTK) |
32 #include <gtk/gtk.h> | 33 #include <gtk/gtk.h> |
33 #endif | 34 #endif |
34 | 35 |
35 class MessageLoopObserver : public MessageLoopForUI::Observer { | 36 class MessageLoopObserver : public MessageLoopForUI::Observer { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer = | 76 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer = |
76 LAZY_INSTANCE_INITIALIZER; | 77 LAZY_INSTANCE_INITIALIZER; |
77 | 78 |
78 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 79 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
79 const content::MainFunctionParams& parameters) | 80 const content::MainFunctionParams& parameters) |
80 : ChromeBrowserMainPartsLinux(parameters) { | 81 : ChromeBrowserMainPartsLinux(parameters) { |
81 } | 82 } |
82 | 83 |
83 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 84 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
| 85 // Shutdown the upgrade detector for Chrome OS. The upgrade detector |
| 86 // stops monitoring changes from the update engine. |
| 87 if (UpgradeDetectorChromeos::GetInstance()) |
| 88 UpgradeDetectorChromeos::GetInstance()->Shutdown(); |
| 89 |
84 // Shutdown the network change notifier for Chrome OS. The network | 90 // Shutdown the network change notifier for Chrome OS. The network |
85 // change notifier stops monitoring changes from the power manager and | 91 // change notifier stops monitoring changes from the power manager and |
86 // the network manager. | 92 // the network manager. |
87 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance()) | 93 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance()) |
88 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); | 94 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); |
89 | 95 |
90 chromeos::BluetoothManager::Shutdown(); | 96 chromeos::BluetoothManager::Shutdown(); |
91 | 97 |
92 // We should remove observers attached to D-Bus clients before | 98 // We should remove observers attached to D-Bus clients before |
93 // DBusThreadManager is shut down. | 99 // DBusThreadManager is shut down. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Initialize the Chrome OS bluetooth subsystem | 174 // Initialize the Chrome OS bluetooth subsystem |
169 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { | 175 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { |
170 chromeos::BluetoothManager::Initialize(); | 176 chromeos::BluetoothManager::Initialize(); |
171 } | 177 } |
172 | 178 |
173 // Initialize the network change notifier for Chrome OS. The network | 179 // Initialize the network change notifier for Chrome OS. The network |
174 // change notifier starts to monitor changes from the power manager and | 180 // change notifier starts to monitor changes from the power manager and |
175 // the network manager. | 181 // the network manager. |
176 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | 182 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); |
177 | 183 |
| 184 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade |
| 185 // detector starts to monitor changes from the update engine. |
| 186 UpgradeDetectorChromeos::GetInstance()->Init(); |
| 187 |
178 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245. | 188 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245. |
179 // Enable Num Lock on X start up. | 189 // Enable Num Lock on X start up. |
180 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { | 190 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { |
181 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard()-> | 191 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard()-> |
182 SetNumLockEnabled(true); | 192 SetNumLockEnabled(true); |
183 } | 193 } |
184 } | 194 } |
OLD | NEW |