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" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 net::NetworkChangeNotifier::SetFactory( | 136 net::NetworkChangeNotifier::SetFactory( |
137 new chromeos::CrosNetworkChangeNotifierFactory()); | 137 new chromeos::CrosNetworkChangeNotifierFactory()); |
138 } | 138 } |
139 | 139 |
140 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 140 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
141 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). | 141 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). |
142 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 142 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
143 // Get the statistics provider instance here to start loading statistcs | 143 // Get the statistics provider instance here to start loading statistcs |
144 // on the background FILE thread. | 144 // on the background FILE thread. |
145 chromeos::system::StatisticsProvider::GetInstance(); | 145 chromeos::system::StatisticsProvider::GetInstance(); |
| 146 |
| 147 // Initialize the Chrome OS bluetooth subsystem. |
| 148 // We defer this to PreMainMessageLoopRun because we don't want to check the |
| 149 // parsed command line until after about_flags::ConvertFlagsToSwitches has |
| 150 // been called. |
| 151 // TODO(vlaviano): Move this back to PostMainMessageLoopStart when we remove |
| 152 // the --enable-bluetooth flag. |
| 153 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { |
| 154 chromeos::BluetoothManager::Initialize(); |
| 155 } |
146 } | 156 } |
147 | 157 |
148 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 158 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { |
149 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); | 159 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); |
150 MessageLoopForUI* message_loop = MessageLoopForUI::current(); | 160 MessageLoopForUI* message_loop = MessageLoopForUI::current(); |
151 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 161 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
152 | 162 |
153 // Initialize DBusThreadManager for the browser. This must be done after | 163 // Initialize DBusThreadManager for the browser. This must be done after |
154 // the main message loop is started, as it uses the message loop. | 164 // the main message loop is started, as it uses the message loop. |
155 chromeos::DBusThreadManager::Initialize(); | 165 chromeos::DBusThreadManager::Initialize(); |
156 | 166 |
157 // Initialize the brightness observer so that we'll display an onscreen | 167 // Initialize the brightness observer so that we'll display an onscreen |
158 // indication of brightness changes during login. | 168 // indication of brightness changes during login. |
159 brightness_observer_.reset(new chromeos::BrightnessObserver()); | 169 brightness_observer_.reset(new chromeos::BrightnessObserver()); |
160 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 170 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
161 brightness_observer_.get()); | 171 brightness_observer_.get()); |
162 // Initialize the session manager observer so that we'll take actions | 172 // Initialize the session manager observer so that we'll take actions |
163 // per signals sent from the session manager. | 173 // per signals sent from the session manager. |
164 session_manager_observer_.reset(new chromeos::SessionManagerObserver); | 174 session_manager_observer_.reset(new chromeos::SessionManagerObserver); |
165 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 175 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
166 AddObserver(session_manager_observer_.get()); | 176 AddObserver(session_manager_observer_.get()); |
167 | 177 |
168 // Initialize the Chrome OS bluetooth subsystem | |
169 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { | |
170 chromeos::BluetoothManager::Initialize(); | |
171 } | |
172 | |
173 // Initialize the network change notifier for Chrome OS. The network | 178 // Initialize the network change notifier for Chrome OS. The network |
174 // change notifier starts to monitor changes from the power manager and | 179 // change notifier starts to monitor changes from the power manager and |
175 // the network manager. | 180 // the network manager. |
176 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | 181 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); |
177 | 182 |
178 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245. | 183 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245. |
179 // Enable Num Lock on X start up. | 184 // Enable Num Lock on X start up. |
180 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { | 185 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { |
181 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard()-> | 186 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard()-> |
182 SetNumLockEnabled(true); | 187 SetNumLockEnabled(true); |
183 } | 188 } |
184 } | 189 } |
OLD | NEW |