Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 8271024: chromeos: Add power supply info reading capability (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased after http://codereview.chromium.org/8423077 Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/session_manager_client.h" 18 #include "chrome/browser/chromeos/dbus/session_manager_client.h"
18 #include "chrome/browser/chromeos/login/session_manager_observer.h" 19 #include "chrome/browser/chromeos/login/session_manager_observer.h"
19 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" 20 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h"
20 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" 21 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
21 #include "chrome/browser/chromeos/system/statistics_provider.h" 22 #include "chrome/browser/chromeos/system/statistics_provider.h"
22 #include "chrome/browser/defaults.h" 23 #include "chrome/browser/defaults.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "content/public/common/main_function_params.h" 25 #include "content/public/common/main_function_params.h"
25 #include "net/base/network_change_notifier.h" 26 #include "net/base/network_change_notifier.h"
26 27
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 115 }
115 116
116 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { 117 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
117 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); 118 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
118 // Initialize CrosLibrary only for the browser, unless running tests 119 // Initialize CrosLibrary only for the browser, unless running tests
119 // (which do their own CrosLibrary setup). 120 // (which do their own CrosLibrary setup).
120 if (!parameters().ui_task) { 121 if (!parameters().ui_task) {
121 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros); 122 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros);
122 chromeos::CrosLibrary::Initialize(use_stub); 123 chromeos::CrosLibrary::Initialize(use_stub);
123 } 124 }
124 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
125 // implementation.
126 net::NetworkChangeNotifier::SetFactory(
127 new chromeos::CrosNetworkChangeNotifierFactory());
128 } 125 }
129 126
130 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { 127 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
131 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). 128 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun().
132 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); 129 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun();
133 // Get the statistics provider instance here to start loading statistcs 130 // Get the statistics provider instance here to start loading statistcs
134 // on the background FILE thread. 131 // on the background FILE thread.
135 chromeos::system::StatisticsProvider::GetInstance(); 132 chromeos::system::StatisticsProvider::GetInstance();
136 } 133 }
137 134
138 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { 135 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
139 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); 136 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart();
140 MessageLoopForUI* message_loop = MessageLoopForUI::current(); 137 MessageLoopForUI* message_loop = MessageLoopForUI::current();
141 message_loop->AddObserver(g_message_loop_observer.Pointer()); 138 message_loop->AddObserver(g_message_loop_observer.Pointer());
142 139
143 // Initialize DBusThreadManager for the browser. This must be done after 140 // Initialize DBusThreadManager for the browser. This must be done after
144 // the main message loop is started, as it uses the message loop. 141 // the main message loop is started, as it uses the message loop.
145 chromeos::DBusThreadManager::Initialize(); 142 chromeos::DBusThreadManager::Initialize();
146 143
144 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
145 // implementation. This should be done after DBusThreadManager init.
146 net::NetworkChangeNotifier::SetFactory(
147 new chromeos::CrosNetworkChangeNotifierFactory());
satorux1 2011/11/03 23:38:47 Please move this back to the original place. We no
Simon Que 2011/11/04 22:35:31 Done.
148
147 // Initialize the brightness observer so that we'll display an onscreen 149 // Initialize the brightness observer so that we'll display an onscreen
148 // indication of brightness changes during login. 150 // indication of brightness changes.
149 brightness_observer_.reset(new chromeos::BrightnessObserver()); 151 brightness_observer_.reset(new chromeos::BrightnessObserver());
150 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( 152 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
151 brightness_observer_.get()); 153 brightness_observer_.get());
154
152 // Initialize the session manager observer so that we'll take actions 155 // Initialize the session manager observer so that we'll take actions
153 // per signals sent from the session manager. 156 // per signals sent from the session manager.
154 session_manager_observer_.reset(new chromeos::SessionManagerObserver); 157 session_manager_observer_.reset(new chromeos::SessionManagerObserver);
155 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> 158 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
156 AddObserver(session_manager_observer_.get()); 159 AddObserver(session_manager_observer_.get());
157 160
158 // Initialize the Chrome OS bluetooth subsystem 161 // Initialize the Chrome OS bluetooth subsystem
159 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { 162 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) {
160 chromeos::BluetoothManager::Initialize(); 163 chromeos::BluetoothManager::Initialize();
161 } 164 }
162 165
163 // Initialize the network change notifier for Chrome OS. The network 166 // Initialize the network change notifier for Chrome OS. The network
164 // change notifier starts to monitor changes from the power manager and 167 // change notifier starts to monitor changes from the power manager and
165 // the network manager. 168 // the network manager.
166 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); 169 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init();
167 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698