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

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

Issue 8670001: Move chromeos specific code to ChromeBrowserMainPartsChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 | Annotate | Revision Log
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 "base/string_number_conversions.h"
13 #include "chrome/browser/browser_process_impl.h"
12 #include "chrome/browser/chromeos/accessibility/system_event_observer.h" 14 #include "chrome/browser/chromeos/accessibility/system_event_observer.h"
15 #include "chrome/browser/chromeos/audio_handler.h"
16 #include "chrome/browser/chromeos/audio_handler.h"
13 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h" 17 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h"
14 #include "chrome/browser/chromeos/boot_times_loader.h" 18 #include "chrome/browser/chromeos/boot_times_loader.h"
15 #include "chrome/browser/chromeos/brightness_observer.h" 19 #include "chrome/browser/chromeos/brightness_observer.h"
16 #include "chrome/browser/chromeos/cros/cros_library.h" 20 #include "chrome/browser/chromeos/cros/cros_library.h"
21 #include "chrome/browser/chromeos/cros/cros_library.h"
22 #include "chrome/browser/chromeos/cros/screen_lock_library.h"
17 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 23 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
18 #include "chrome/browser/chromeos/dbus/power_manager_client.h" 24 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
19 #include "chrome/browser/chromeos/dbus/session_manager_client.h" 25 #include "chrome/browser/chromeos/dbus/session_manager_client.h"
20 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" 26 #include "chrome/browser/chromeos/disks/disk_mount_manager.h"
21 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 27 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
22 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 28 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
29 #include "chrome/browser/chromeos/login/authenticator.h"
30 #include "chrome/browser/chromeos/login/login_utils.h"
31 #include "chrome/browser/chromeos/login/ownership_service.h"
32 #include "chrome/browser/chromeos/login/screen_locker.h"
23 #include "chrome/browser/chromeos/login/session_manager_observer.h" 33 #include "chrome/browser/chromeos/login/session_manager_observer.h"
34 #include "chrome/browser/chromeos/login/user_manager.h"
24 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" 35 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h"
25 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" 36 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
26 #include "chrome/browser/chromeos/system/runtime_environment.h" 37 #include "chrome/browser/chromeos/system/runtime_environment.h"
27 #include "chrome/browser/chromeos/system/statistics_provider.h" 38 #include "chrome/browser/chromeos/system/statistics_provider.h"
39 #include "chrome/browser/chromeos/system_key_event_listener.h"
28 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" 40 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h"
41 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
29 #include "chrome/browser/defaults.h" 42 #include "chrome/browser/defaults.h"
43 #include "chrome/browser/oom_priority_manager.h"
44 #include "chrome/browser/policy/browser_policy_connector.h"
45 #include "chrome/browser/profiles/profile.h"
46 #include "chrome/browser/profiles/profile_manager.h"
47 #include "chrome/browser/ui/views/browser_dialogs.h"
30 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/logging_chrome.h"
31 #include "content/public/common/main_function_params.h" 50 #include "content/public/common/main_function_params.h"
51 #include "grit/platform_locale_settings.h"
32 #include "net/base/network_change_notifier.h" 52 #include "net/base/network_change_notifier.h"
53 #include "net/url_request/url_request.h"
54 #include "chrome/browser/chromeos/boot_times_loader.h"
55 #include "chrome/browser/chromeos/external_metrics.h"
56 #include "ui/base/l10n/l10n_util.h"
33 57
34 #if defined(TOOLKIT_USES_GTK) 58 #if defined(TOOLKIT_USES_GTK)
35 #include <gtk/gtk.h> 59 #include <gtk/gtk.h>
36 #endif 60 #endif
37 61
38 #if defined(USE_AURA) 62 #if defined(USE_AURA)
39 #include "chrome/browser/chromeos/legacy_window_manager/initial_browser_window_o bserver.h" 63 #include "chrome/browser/chromeos/legacy_window_manager/initial_browser_window_o bserver.h"
40 #endif 64 #endif
41 65
42 class MessageLoopObserver : public MessageLoopForUI::Observer { 66 class MessageLoopObserver : public MessageLoopForUI::Observer {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 99 }
76 100
77 virtual void DidProcessEvent(GdkEvent* event) { 101 virtual void DidProcessEvent(GdkEvent* event) {
78 } 102 }
79 #endif 103 #endif
80 }; 104 };
81 105
82 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer = 106 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer =
83 LAZY_INSTANCE_INITIALIZER; 107 LAZY_INSTANCE_INITIALIZER;
84 108
109 // Login -----------------------------------------------------------------------
110
111 // Class is used to login using passed username and password.
112 // The instance will be deleted upon success or failure.
113 class StubLogin : public chromeos::LoginStatusConsumer,
114 public chromeos::LoginUtils::Delegate {
115 public:
116 StubLogin(std::string username, std::string password)
117 : pending_requests_(false),
118 profile_prepared_(false) {
119 authenticator_ = chromeos::LoginUtils::Get()->CreateAuthenticator(this);
120 authenticator_.get()->AuthenticateToLogin(
121 g_browser_process->profile_manager()->GetDefaultProfile(),
122 username,
123 password,
124 std::string(),
125 std::string());
126 }
127
128 ~StubLogin() {
129 chromeos::LoginUtils::Get()->DelegateDeleted(this);
130 }
131
132 void OnLoginFailure(const chromeos::LoginFailure& error) {
133 LOG(ERROR) << "Login Failure: " << error.GetErrorString();
134 delete this;
135 }
136
137 void OnLoginSuccess(const std::string& username,
138 const std::string& password,
139 const GaiaAuthConsumer::ClientLoginResult& credentials,
140 bool pending_requests,
141 bool using_oauth) {
142 pending_requests_ = pending_requests;
143 if (!profile_prepared_) {
144 // Will call OnProfilePrepared in the end.
145 chromeos::LoginUtils::Get()->PrepareProfile(username,
146 password,
147 credentials,
148 pending_requests,
149 using_oauth,
150 false,
151 this);
152 } else if (!pending_requests) {
153 delete this;
154 }
155 }
156
157 // LoginUtils::Delegate implementation:
158 virtual void OnProfilePrepared(Profile* profile) {
159 profile_prepared_ = true;
160 chromeos::LoginUtils::DoBrowserLaunch(profile, NULL);
161 if (!pending_requests_)
162 delete this;
163 }
164
165 scoped_refptr<chromeos::Authenticator> authenticator_;
166 bool pending_requests_;
167 bool profile_prepared_;
168 };
169
170 // Allows authenticator to be invoked without adding refcounting. The instances
171 // will delete themselves upon completion.
172 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin);
173
174 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line,
175 Profile* profile) {
176 if (parsed_command_line.HasSwitch(switches::kLoginManager)) {
177 std::string first_screen =
178 parsed_command_line.GetSwitchValueASCII(switches::kLoginScreen);
179 std::string size_arg =
180 parsed_command_line.GetSwitchValueASCII(
181 switches::kLoginScreenSize);
182 gfx::Size size(0, 0);
183 // Allow the size of the login window to be set explicitly. If not set,
184 // default to the entire screen. This is mostly useful for testing.
185 if (size_arg.size()) {
186 std::vector<std::string> dimensions;
187 base::SplitString(size_arg, ',', &dimensions);
188 if (dimensions.size() == 2) {
189 int width, height;
190 if (base::StringToInt(dimensions[0], &width) &&
191 base::StringToInt(dimensions[1], &height))
192 size.SetSize(width, height);
193 }
194 }
195 browser::ShowLoginWizard(first_screen, size);
196 } else if (parsed_command_line.HasSwitch(switches::kLoginUser) &&
197 parsed_command_line.HasSwitch(switches::kLoginPassword)) {
198 chromeos::BootTimesLoader::Get()->RecordLoginAttempted();
199 new StubLogin(
200 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser),
201 parsed_command_line.GetSwitchValueASCII(switches::kLoginPassword));
202 } else {
203 if (!parsed_command_line.HasSwitch(switches::kTestName)) {
204 // We did not log in (we crashed or are debugging), so we need to
205 // set the user name for sync.
206 chromeos::LoginUtils::Get()->RestoreAuthenticationSession(
207 chromeos::UserManager::Get()->logged_in_user().email(), profile);
208 }
209 }
210 }
211
212 // ChromeBrowserMainPartsChromeos ----------------------------------------------
213
85 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( 214 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos(
86 const content::MainFunctionParams& parameters) 215 const content::MainFunctionParams& parameters)
87 : ChromeBrowserMainPartsLinux(parameters) { 216 : ChromeBrowserMainPartsLinux(parameters) {
88 } 217 }
89 218
90 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { 219 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() {
91 chromeos::disks::DiskMountManager::Shutdown(); 220 chromeos::disks::DiskMountManager::Shutdown();
92 221
93 chromeos::BluetoothManager::Shutdown(); 222 chromeos::BluetoothManager::Shutdown();
94 223
95 chromeos::DBusThreadManager::Shutdown(); 224 chromeos::DBusThreadManager::Shutdown();
96 225
97 chromeos::accessibility::SystemEventObserver::Shutdown(); 226 chromeos::accessibility::SystemEventObserver::Shutdown();
98 227
99 if (!parameters().ui_task && chromeos::CrosLibrary::Get()) 228 if (!parameters().ui_task && chromeos::CrosLibrary::Get())
100 chromeos::CrosLibrary::Shutdown(); 229 chromeos::CrosLibrary::Shutdown();
101 230
102 // To be precise, logout (browser shutdown) is not yet done, but the 231 // To be precise, logout (browser shutdown) is not yet done, but the
103 // remaining work is negligible, hence we say LogoutDone here. 232 // remaining work is negligible, hence we say LogoutDone here.
104 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 233 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
105 false); 234 false);
106 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 235 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
107 } 236 }
108 237
238 // content::BrowserMainParts and ChromeBrowserMainExtraParts overrides ---------
239
109 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { 240 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() {
110 ChromeBrowserMainPartsLinux::PreEarlyInitialization();
111 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { 241 if (parsed_command_line().HasSwitch(switches::kGuestSession)) {
112 // Disable sync and extensions if we're in "browse without sign-in" mode. 242 // Disable sync and extensions if we're in "browse without sign-in" mode.
113 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); 243 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
114 singleton_command_line->AppendSwitch(switches::kDisableSync); 244 singleton_command_line->AppendSwitch(switches::kDisableSync);
115 singleton_command_line->AppendSwitch(switches::kDisableExtensions); 245 singleton_command_line->AppendSwitch(switches::kDisableExtensions);
116 browser_defaults::bookmarks_enabled = false; 246 browser_defaults::bookmarks_enabled = false;
117 } 247 }
248
249 ChromeBrowserMainPartsLinux::PreEarlyInitialization();
118 } 250 }
119 251
120 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { 252 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
121 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
122 // Initialize CrosLibrary only for the browser, unless running tests 253 // Initialize CrosLibrary only for the browser, unless running tests
123 // (which do their own CrosLibrary setup). 254 // (which do their own CrosLibrary setup).
124 if (!parameters().ui_task) { 255 if (!parameters().ui_task) {
125 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros); 256 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros);
126 chromeos::CrosLibrary::Initialize(use_stub); 257 chromeos::CrosLibrary::Initialize(use_stub);
127 } 258 }
128 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific 259 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
129 // implementation. 260 // implementation.
130 net::NetworkChangeNotifier::SetFactory( 261 net::NetworkChangeNotifier::SetFactory(
131 new chromeos::CrosNetworkChangeNotifierFactory()); 262 new chromeos::CrosNetworkChangeNotifierFactory());
132 263
133 chromeos::accessibility::SystemEventObserver::Initialize(); 264 chromeos::accessibility::SystemEventObserver::Initialize();
265
266 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
134 } 267 }
135 268
136 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { 269 void ChromeBrowserMainPartsChromeos::PostBrowserProcessInit() {
270 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
271 // -- immediately after CreateChildThreads().
272
273 // Now that the file thread exists we can record our stats.
274 chromeos::BootTimesLoader::Get()->RecordChromeMainStats();
275
276 #if defined(TOOLKIT_USES_GTK)
277 // Read locale-specific GTK resource information.
278 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC);
279 if (!gtkrc.empty())
280 gtk_rc_parse_string(gtkrc.c_str());
281 #else
282 // TODO(saintlou): Need to provide an Aura equivalent.
283 NOTIMPLEMENTED();
284 #endif
285
286 // Trigger prefetching of ownership status.
287 chromeos::OwnershipService::GetSharedInstance()->Prewarm();
288
289 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
290 // -- just before CreateProfile().
291
292 // Initialize the screen locker now so that it can receive
293 // LOGIN_USER_CHANGED notification from UserManager.
294 chromeos::ScreenLocker::InitClass();
295
296 // This forces the ProfileManager to be created and register for the
297 // notification it needs to track the logged in user.
298 g_browser_process->profile_manager();
299
300 // TODO(abarth): Should this move to InitializeNetworkOptions()?
301 // Allow access to file:// on ChromeOS for tests.
302 if (parsed_command_line().HasSwitch(switches::kAllowFileAccess))
303 net::URLRequest::AllowFileAccess();
304
305 // There are two use cases for kLoginUser:
306 // 1) if passed in tandem with kLoginPassword, to drive a "StubLogin"
307 // 2) if passed alone, to signal that the indicated user has already
308 // logged in and we should behave accordingly.
309 // This handles case 2.
310 if (parsed_command_line().HasSwitch(switches::kLoginUser) &&
311 !parsed_command_line().HasSwitch(switches::kLoginPassword)) {
312 std::string username =
313 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser);
314 VLOG(1) << "Relaunching browser for user: " << username;
315 chromeos::UserManager::Get()->UserLoggedIn(username);
316
317 // Redirects Chrome logging to the user data dir.
318 logging::RedirectChromeLogging(parsed_command_line());
319
320 // Initialize user policy before creating the profile so the profile
321 // initialization code sees policy settings.
322 g_browser_process->browser_policy_connector()->InitializeUserPolicy(
323 username, false /* wait_for_policy_fetch */);
324 }
325
326 // In Aura builds this will initialize aura_shell::Shell.
327 ChromeBrowserMainPartsLinux::PostBrowserProcessInit();
328 }
329
330 void ChromeBrowserMainPartsChromeos::PostProfileInitialized() {
satorux1 2011/11/23 23:51:53 This looks like an useful hook. Maybe we can move
stevenjb 2011/11/24 01:35:39 Definitely sounds like a good idea. I will make a
331 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
332 // -- just after CreateProfile().
333
334 // Pass the TokenService pointer to the policy connector so user policy can
335 // grab a token and register with the policy server.
336 // TODO(mnissler): Remove once OAuth is the only authentication mechanism.
337 if (parsed_command_line().HasSwitch(switches::kLoginUser) &&
338 !parsed_command_line().HasSwitch(switches::kLoginPassword)) {
339 g_browser_process->browser_policy_connector()->SetUserPolicyTokenService(
340 profile()->GetTokenService());
341 }
342
343 // Tests should be able to tune login manager before showing it.
344 // Thus only show login manager in normal (non-testing) mode.
345 if (!parameters().ui_task)
346 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile());
347
348 ChromeBrowserMainPartsLinux::PostProfileInitialized();
349 }
350
351 void ChromeBrowserMainPartsChromeos::PreBrowserStart() {
352 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
353 // -- just before MetricsService::LogNeedForCleanShutdown().
354
355 // Initialize the audio handler on ChromeOS.
356 chromeos::AudioHandler::Initialize();
357
358 // Listen for system key events so that the user will be able to adjust the
359 // volume on the login screen, if Chrome is running on Chrome OS
360 // (i.e. not Linux desktop), and in non-test mode.
361 if (chromeos::system::runtime_environment::IsRunningOnChromeOS() &&
362 !parameters().ui_task) { // ui_task is non-NULL when running tests.
363 chromeos::SystemKeyEventListener::Initialize();
364 }
365
366 // Listen for XI_HierarchyChanged events.
367 chromeos::XInputHierarchyChangedEventListener::GetInstance();
368
369 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
370 // -- immediately after ChildProcess::WaitForDebugger().
371
372 // Start the out-of-memory priority manager here so that we give the most
373 // amount of time for the other services to start up before we start
374 // adjusting the oom priority.
375 g_browser_process->oom_priority_manager()->Start();
376
377 ChromeBrowserMainPartsLinux::PreBrowserStart();
378 }
379
380 void ChromeBrowserMainPartsChromeos::PostBrowserStart() {
137 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). 381 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun().
138 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); 382
139 // Get the statistics provider instance here to start loading statistcs 383 // Get the statistics provider instance here to start loading statistcs
140 // on the background FILE thread. 384 // on the background FILE thread.
141 chromeos::system::StatisticsProvider::GetInstance(); 385 chromeos::system::StatisticsProvider::GetInstance();
142 386
143 // Initialize the Chrome OS bluetooth subsystem. 387 // Initialize the Chrome OS bluetooth subsystem.
144 // We defer this to PreMainMessageLoopRun because we don't want to check the 388 // We defer this to PreMainMessageLoopRun because we don't want to check the
145 // parsed command line until after about_flags::ConvertFlagsToSwitches has 389 // parsed command line until after about_flags::ConvertFlagsToSwitches has
146 // been called. 390 // been called.
147 // TODO(vlaviano): Move this back to PostMainMessageLoopStart when we remove 391 // TODO(vlaviano): Move this back to PostMainMessageLoopStart when we remove
148 // the --enable-bluetooth flag. 392 // the --enable-bluetooth flag.
149 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { 393 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) {
150 chromeos::BluetoothManager::Initialize(); 394 chromeos::BluetoothManager::Initialize();
151 } 395 }
396
397 ChromeBrowserMainPartsLinux::PostBrowserStart();
152 } 398 }
153 399
154 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { 400 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
155 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart();
156 MessageLoopForUI* message_loop = MessageLoopForUI::current(); 401 MessageLoopForUI* message_loop = MessageLoopForUI::current();
157 message_loop->AddObserver(g_message_loop_observer.Pointer()); 402 message_loop->AddObserver(g_message_loop_observer.Pointer());
158 403
159 // Initialize DBusThreadManager for the browser. This must be done after 404 // Initialize DBusThreadManager for the browser. This must be done after
160 // the main message loop is started, as it uses the message loop. 405 // the main message loop is started, as it uses the message loop.
161 chromeos::DBusThreadManager::Initialize(); 406 chromeos::DBusThreadManager::Initialize();
162 407
163 // Initialize the brightness observer so that we'll display an onscreen 408 // Initialize the brightness observer so that we'll display an onscreen
164 // indication of brightness changes during login. 409 // indication of brightness changes during login.
165 brightness_observer_.reset(new chromeos::BrightnessObserver()); 410 brightness_observer_.reset(new chromeos::BrightnessObserver());
(...skipping 21 matching lines...) Expand all
187 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245. 432 // For http://crosbug.com/p/5795 and http://crosbug.com/p/6245.
188 // Enable Num Lock on X start up. 433 // Enable Num Lock on X start up.
189 chromeos::input_method::InputMethodManager::GetInstance()-> 434 chromeos::input_method::InputMethodManager::GetInstance()->
190 GetXKeyboard()->SetNumLockEnabled(true); 435 GetXKeyboard()->SetNumLockEnabled(true);
191 436
192 #if defined(USE_AURA) 437 #if defined(USE_AURA)
193 initial_browser_window_observer_.reset( 438 initial_browser_window_observer_.reset(
194 new chromeos::InitialBrowserWindowObserver); 439 new chromeos::InitialBrowserWindowObserver);
195 #endif 440 #endif
196 } 441 }
442
443 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart();
197 } 444 }
198 445
199 // Shut down services before the browser process, etc are destroyed. 446 // Shut down services before the browser process, etc are destroyed.
200 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { 447 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
201 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); 448 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded",
449 true);
450
451 g_browser_process->oom_priority_manager()->Stop();
452
453 // The XInput2 event listener needs to be shut down earlier than when
454 // Singletons are finally destroyed in AtExitManager.
455 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop();
456
457 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call,
458 // even if Initialize() wasn't called.
459 chromeos::SystemKeyEventListener::Shutdown();
460 chromeos::AudioHandler::Shutdown();
202 461
203 // Shutdown the upgrade detector for Chrome OS. The upgrade detector 462 // Shutdown the upgrade detector for Chrome OS. The upgrade detector
204 // stops monitoring changes from the update engine. 463 // stops monitoring changes from the update engine.
205 if (UpgradeDetectorChromeos::GetInstance()) 464 if (UpgradeDetectorChromeos::GetInstance())
206 UpgradeDetectorChromeos::GetInstance()->Shutdown(); 465 UpgradeDetectorChromeos::GetInstance()->Shutdown();
207 466
208 // Shutdown the network change notifier for Chrome OS. The network 467 // Shutdown the network change notifier for Chrome OS. The network
209 // change notifier stops monitoring changes from the power manager and 468 // change notifier stops monitoring changes from the power manager and
210 // the network manager. 469 // the network manager.
211 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance()) 470 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance())
212 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); 471 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
213 472
214 // We should remove observers attached to D-Bus clients before 473 // We should remove observers attached to D-Bus clients before
215 // DBusThreadManager is shut down. 474 // DBusThreadManager is shut down.
216 if (session_manager_observer_.get()) { 475 if (session_manager_observer_.get()) {
217 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> 476 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
218 RemoveObserver(session_manager_observer_.get()); 477 RemoveObserver(session_manager_observer_.get());
219 } 478 }
220 if (brightness_observer_.get()) { 479 if (brightness_observer_.get()) {
221 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() 480 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()
222 ->RemoveObserver(brightness_observer_.get()); 481 ->RemoveObserver(brightness_observer_.get());
223 } 482 }
483
484 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun();
224 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698