diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 01:42:58 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 01:42:58 +0000 |
commit | d15b7caaff3194a7ef042f45e301192f7d698a92 (patch) | |
tree | a09b50a1ff93bc3ebe075cd559766c3f4a3bb7f6 /chrome/browser/chromeos | |
parent | 339a39049a8a7d6d3517a4fdd82dab9c2005e92a (diff) | |
download | chromium_src-d15b7caaff3194a7ef042f45e301192f7d698a92.zip chromium_src-d15b7caaff3194a7ef042f45e301192f7d698a92.tar.gz chromium_src-d15b7caaff3194a7ef042f45e301192f7d698a92.tar.bz2 |
initialize system resources earlier so they are available during shell init.
Change-Id: I173e692ef9fce43be5860af88ce71e749a7a244c
BUG=105614
TEST=See issue + all chromeos tests should pass.
Review URL: http://codereview.chromium.org/9079001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
3 files changed, 83 insertions, 72 deletions
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index bb32a82..8c6cb74 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -259,6 +259,81 @@ void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); } +void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { + MessageLoopForUI* message_loop = MessageLoopForUI::current(); + message_loop->AddObserver(g_message_loop_observer.Pointer()); + + // Initialize DBusThreadManager for the browser. This must be done after + // the main message loop is started, as it uses the message loop. + chromeos::DBusThreadManager::Initialize(); + + // Initialize the brightness observer so that we'll display an onscreen + // indication of brightness changes during login. + brightness_observer_.reset(new chromeos::BrightnessObserver()); + chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( + brightness_observer_.get()); + // Initialize the session manager observer so that we'll take actions + // per signals sent from the session manager. + session_manager_observer_.reset(new chromeos::SessionManagerObserver); + chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> + AddObserver(session_manager_observer_.get()); + + // Initialize the disk mount manager. + chromeos::disks::DiskMountManager::Initialize(); + + // Initialize the system event observer. + chromeos::accessibility::SystemEventObserver::Initialize(); + + // Initialize the network change notifier for Chrome OS. The network + // change notifier starts to monitor changes from the power manager and + // the network manager. + chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); + + // Likewise, initialize the upgrade detector for Chrome OS. The upgrade + // detector starts to monitor changes from the update engine. + UpgradeDetectorChromeos::GetInstance()->Init(); + + if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { + // Enable Num Lock on X start up for http://crosbug.com/p/5795 and + // http://crosbug.com/p/6245. We don't do this for Chromium OS since many + // netbooks do not work as intended when Num Lock is on (e.g. On a netbook + // with a small keyboard, u, i, o, p, ... keys might be repurposed as + // cursor keys when Num Lock is on). +#if defined(GOOGLE_CHROME_BUILD) + chromeos::input_method::InputMethodManager::GetInstance()-> + GetXKeyboard()->SetNumLockEnabled(true); +#endif + +#if defined(USE_AURA) + initial_browser_window_observer_.reset( + new chromeos::InitialBrowserWindowObserver); +#endif + } + + ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); +} + +// Threads are initialized MainMessageLoopStart and MainMessageLoopRun. + +void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { + // Initialize the audio handler on ChromeOS. + chromeos::AudioHandler::Initialize(); + + // Listen for system key events so that the user will be able to adjust the + // volume on the login screen, if Chrome is running on Chrome OS + // (i.e. not Linux desktop), and in non-test mode. + // Note: SystemKeyEventListener depends on the DBus thread. + if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && + !parameters().ui_task) { // ui_task is non-NULL when running tests. + chromeos::SystemKeyEventListener::Initialize(); + } + + // Listen for XI_HierarchyChanged events. + chromeos::XInputHierarchyChangedEventListener::GetInstance(); + + ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); +} + void ChromeBrowserMainPartsChromeos::PreProfileInit() { // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() // -- immediately before Profile creation(). @@ -351,20 +426,6 @@ void ChromeBrowserMainPartsChromeos::PreBrowserStart() { metrics()->StartExternalMetrics(); - // Initialize the audio handler on ChromeOS. - chromeos::AudioHandler::Initialize(); - - // Listen for system key events so that the user will be able to adjust the - // volume on the login screen, if Chrome is running on Chrome OS - // (i.e. not Linux desktop), and in non-test mode. - if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && - !parameters().ui_task) { // ui_task is non-NULL when running tests. - chromeos::SystemKeyEventListener::Initialize(); - } - - // Listen for XI_HierarchyChanged events. - chromeos::XInputHierarchyChangedEventListener::GetInstance(); - // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() // -- immediately after ChildProcess::WaitForDebugger(). @@ -404,60 +465,6 @@ void ChromeBrowserMainPartsChromeos::PostBrowserStart() { ChromeBrowserMainPartsLinux::PostBrowserStart(); } -void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { - MessageLoopForUI* message_loop = MessageLoopForUI::current(); - message_loop->AddObserver(g_message_loop_observer.Pointer()); - - // Initialize DBusThreadManager for the browser. This must be done after - // the main message loop is started, as it uses the message loop. - chromeos::DBusThreadManager::Initialize(); - - // Initialize the brightness observer so that we'll display an onscreen - // indication of brightness changes during login. - brightness_observer_.reset(new chromeos::BrightnessObserver()); - chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( - brightness_observer_.get()); - // Initialize the session manager observer so that we'll take actions - // per signals sent from the session manager. - session_manager_observer_.reset(new chromeos::SessionManagerObserver); - chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> - AddObserver(session_manager_observer_.get()); - - // Initialize the disk mount manager. - chromeos::disks::DiskMountManager::Initialize(); - - // Initialize the system event observer. - chromeos::accessibility::SystemEventObserver::Initialize(); - - // Initialize the network change notifier for Chrome OS. The network - // change notifier starts to monitor changes from the power manager and - // the network manager. - chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); - - // Likewise, initialize the upgrade detector for Chrome OS. The upgrade - // detector starts to monitor changes from the update engine. - UpgradeDetectorChromeos::GetInstance()->Init(); - - if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { - // Enable Num Lock on X start up for http://crosbug.com/p/5795 and - // http://crosbug.com/p/6245. We don't do this for Chromium OS since many - // netbooks do not work as intended when Num Lock is on (e.g. On a netbook - // with a small keyboard, u, i, o, p, ... keys might be repurposed as - // cursor keys when Num Lock is on). -#if defined(GOOGLE_CHROME_BUILD) - chromeos::input_method::InputMethodManager::GetInstance()-> - GetXKeyboard()->SetNumLockEnabled(true); -#endif - -#if defined(USE_AURA) - initial_browser_window_observer_.reset( - new chromeos::InitialBrowserWindowObserver); -#endif - } - - ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); -} - // Shut down services before the browser process, etc are destroyed. void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() { chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.h b/chrome/browser/chromeos/chrome_browser_main_chromeos.h index 07c4648..6aa771f 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.h +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.h @@ -24,18 +24,20 @@ class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsLinux { const content::MainFunctionParams& parameters); virtual ~ChromeBrowserMainPartsChromeos(); - // content::BrowserMainParts overrides. + // ChromeBrowserMainParts overrides. virtual void PreEarlyInitialization() OVERRIDE; virtual void PreMainMessageLoopStart() OVERRIDE; virtual void PostMainMessageLoopStart() OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PreMainMessageLoopRun() OVERRIDE; - // ChromeBrowserMainExtraParts overrodes. + // Stages called from PreMainMessageLoopRun. virtual void PreProfileInit() OVERRIDE; virtual void PostProfileInit() OVERRIDE; virtual void PreBrowserStart() OVERRIDE; virtual void PostBrowserStart() OVERRIDE; + virtual void PostMainMessageLoopRun() OVERRIDE; + private: scoped_ptr<chromeos::BrightnessObserver> brightness_observer_; scoped_ptr<chromeos::SessionManagerObserver> session_manager_observer_; diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.cc b/chrome/browser/chromeos/status/caps_lock_menu_button.cc index 3928b81..4d9c853 100644 --- a/chrome/browser/chromeos/status/caps_lock_menu_button.cc +++ b/chrome/browser/chromeos/status/caps_lock_menu_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -70,6 +70,8 @@ CapsLockMenuButton::CapsLockMenuButton(StatusAreaButton::Delegate* delegate) UpdateUIFromCurrentCapsLock(input_method::XKeyboard::CapsLockIsEnabled()); if (SystemKeyEventListener::GetInstance()) SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); + else + LOG(ERROR) << "SystemKeyEventListener not initialized!"; } CapsLockMenuButton::~CapsLockMenuButton() { |