| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer = | 82 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer = |
| 83 LAZY_INSTANCE_INITIALIZER; | 83 LAZY_INSTANCE_INITIALIZER; |
| 84 | 84 |
| 85 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 85 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
| 86 const content::MainFunctionParams& parameters) | 86 const content::MainFunctionParams& parameters) |
| 87 : ChromeBrowserMainPartsLinux(parameters) { | 87 : ChromeBrowserMainPartsLinux(parameters) { |
| 88 } | 88 } |
| 89 | 89 |
| 90 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 90 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
| 91 chromeos::accessibility::SystemEventObserver::Shutdown(); |
| 92 |
| 91 chromeos::disks::DiskMountManager::Shutdown(); | 93 chromeos::disks::DiskMountManager::Shutdown(); |
| 92 | 94 |
| 93 chromeos::BluetoothManager::Shutdown(); | 95 chromeos::BluetoothManager::Shutdown(); |
| 94 | 96 |
| 95 chromeos::DBusThreadManager::Shutdown(); | 97 chromeos::DBusThreadManager::Shutdown(); |
| 96 | 98 |
| 97 chromeos::accessibility::SystemEventObserver::Shutdown(); | |
| 98 | |
| 99 if (!parameters().ui_task && chromeos::CrosLibrary::Get()) | 99 if (!parameters().ui_task && chromeos::CrosLibrary::Get()) |
| 100 chromeos::CrosLibrary::Shutdown(); | 100 chromeos::CrosLibrary::Shutdown(); |
| 101 | 101 |
| 102 // To be precise, logout (browser shutdown) is not yet done, but the | 102 // To be precise, logout (browser shutdown) is not yet done, but the |
| 103 // remaining work is negligible, hence we say LogoutDone here. | 103 // remaining work is negligible, hence we say LogoutDone here. |
| 104 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 104 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 105 false); | 105 false); |
| 106 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 106 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 107 } | 107 } |
| 108 | 108 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 122 // Initialize CrosLibrary only for the browser, unless running tests | 122 // Initialize CrosLibrary only for the browser, unless running tests |
| 123 // (which do their own CrosLibrary setup). | 123 // (which do their own CrosLibrary setup). |
| 124 if (!parameters().ui_task) { | 124 if (!parameters().ui_task) { |
| 125 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros); | 125 bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros); |
| 126 chromeos::CrosLibrary::Initialize(use_stub); | 126 chromeos::CrosLibrary::Initialize(use_stub); |
| 127 } | 127 } |
| 128 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific | 128 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific |
| 129 // implementation. | 129 // implementation. |
| 130 net::NetworkChangeNotifier::SetFactory( | 130 net::NetworkChangeNotifier::SetFactory( |
| 131 new chromeos::CrosNetworkChangeNotifierFactory()); | 131 new chromeos::CrosNetworkChangeNotifierFactory()); |
| 132 | |
| 133 chromeos::accessibility::SystemEventObserver::Initialize(); | |
| 134 } | 132 } |
| 135 | 133 |
| 136 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 134 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 137 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). | 135 // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). |
| 138 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 136 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
| 139 // Get the statistics provider instance here to start loading statistcs | 137 // Get the statistics provider instance here to start loading statistcs |
| 140 // on the background FILE thread. | 138 // on the background FILE thread. |
| 141 chromeos::system::StatisticsProvider::GetInstance(); | 139 chromeos::system::StatisticsProvider::GetInstance(); |
| 142 | 140 |
| 143 // Initialize the Chrome OS bluetooth subsystem. | 141 // Initialize the Chrome OS bluetooth subsystem. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 167 brightness_observer_.get()); | 165 brightness_observer_.get()); |
| 168 // Initialize the session manager observer so that we'll take actions | 166 // Initialize the session manager observer so that we'll take actions |
| 169 // per signals sent from the session manager. | 167 // per signals sent from the session manager. |
| 170 session_manager_observer_.reset(new chromeos::SessionManagerObserver); | 168 session_manager_observer_.reset(new chromeos::SessionManagerObserver); |
| 171 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 169 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 172 AddObserver(session_manager_observer_.get()); | 170 AddObserver(session_manager_observer_.get()); |
| 173 | 171 |
| 174 // Initialize the disk mount manager. | 172 // Initialize the disk mount manager. |
| 175 chromeos::disks::DiskMountManager::Initialize(); | 173 chromeos::disks::DiskMountManager::Initialize(); |
| 176 | 174 |
| 175 // Initialize the system event observer. |
| 176 chromeos::accessibility::SystemEventObserver::Initialize(); |
| 177 |
| 177 // Initialize the network change notifier for Chrome OS. The network | 178 // Initialize the network change notifier for Chrome OS. The network |
| 178 // change notifier starts to monitor changes from the power manager and | 179 // change notifier starts to monitor changes from the power manager and |
| 179 // the network manager. | 180 // the network manager. |
| 180 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | 181 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); |
| 181 | 182 |
| 182 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade | 183 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade |
| 183 // detector starts to monitor changes from the update engine. | 184 // detector starts to monitor changes from the update engine. |
| 184 UpgradeDetectorChromeos::GetInstance()->Init(); | 185 UpgradeDetectorChromeos::GetInstance()->Init(); |
| 185 | 186 |
| 186 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { | 187 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 215 // DBusThreadManager is shut down. | 216 // DBusThreadManager is shut down. |
| 216 if (session_manager_observer_.get()) { | 217 if (session_manager_observer_.get()) { |
| 217 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 218 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 218 RemoveObserver(session_manager_observer_.get()); | 219 RemoveObserver(session_manager_observer_.get()); |
| 219 } | 220 } |
| 220 if (brightness_observer_.get()) { | 221 if (brightness_observer_.get()) { |
| 221 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() | 222 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() |
| 222 ->RemoveObserver(brightness_observer_.get()); | 223 ->RemoveObserver(brightness_observer_.get()); |
| 223 } | 224 } |
| 224 } | 225 } |
| OLD | NEW |