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

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

Issue 23618026: NOT FOR SUBMIT: Remove NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/browser_process_platform_part_chromeos.h" 25 #include "chrome/browser/browser_process_platform_part_chromeos.h"
26 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
28 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 28 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
30 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 30 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
31 #include "chrome/browser/chromeos/boot_times_loader.h" 31 #include "chrome/browser/chromeos/boot_times_loader.h"
32 #include "chrome/browser/chromeos/contacts/contact_manager.h" 32 #include "chrome/browser/chromeos/contacts/contact_manager.h"
33 #include "chrome/browser/chromeos/cros/cert_library.h" 33 #include "chrome/browser/chromeos/cros/cert_library.h"
34 #include "chrome/browser/chromeos/cros/network_library.h"
35 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" 34 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
36 #include "chrome/browser/chromeos/display/display_configuration_observer.h" 35 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
37 #include "chrome/browser/chromeos/extensions/default_app_order.h" 36 #include "chrome/browser/chromeos/extensions/default_app_order.h"
38 #include "chrome/browser/chromeos/external_metrics.h" 37 #include "chrome/browser/chromeos/external_metrics.h"
39 #include "chrome/browser/chromeos/imageburner/burn_manager.h" 38 #include "chrome/browser/chromeos/imageburner/burn_manager.h"
40 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 39 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" 40 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h"
42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" 41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
44 #include "chrome/browser/chromeos/login/authenticator.h" 43 #include "chrome/browser/chromeos/login/authenticator.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 245
247 } // namespace 246 } // namespace
248 247
249 namespace internal { 248 namespace internal {
250 249
251 // Wrapper class for initializing dbus related services and shutting them 250 // Wrapper class for initializing dbus related services and shutting them
252 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the 251 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the
253 // destructor will get called if and only if this has been instantiated. 252 // destructor will get called if and only if this has been instantiated.
254 class DBusServices { 253 class DBusServices {
255 public: 254 public:
256 explicit DBusServices(const content::MainFunctionParams& parameters) 255 explicit DBusServices(const content::MainFunctionParams& parameters) {
257 : network_library_initialized_(false) {
258 if (!base::chromeos::IsRunningOnChromeOS()) { 256 if (!base::chromeos::IsRunningOnChromeOS()) {
259 // Override this path on the desktop, so that the user policy key can be 257 // Override this path on the desktop, so that the user policy key can be
260 // stored by the stub SessionManagerClient. 258 // stored by the stub SessionManagerClient.
261 base::FilePath user_data_dir; 259 base::FilePath user_data_dir;
262 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { 260 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
263 PathService::Override(chromeos::DIR_USER_POLICY_KEYS, 261 PathService::Override(chromeos::DIR_USER_POLICY_KEYS,
264 user_data_dir.AppendASCII("stub_user_policy")); 262 user_data_dir.AppendASCII("stub_user_policy"));
265 } 263 }
266 } 264 }
267 265
268 // Initialize DBusThreadManager for the browser. This must be done after 266 // Initialize DBusThreadManager for the browser. This must be done after
269 // the main message loop is started, as it uses the message loop. 267 // the main message loop is started, as it uses the message loop.
270 DBusThreadManager::Initialize(); 268 DBusThreadManager::Initialize();
271 CrosDBusService::Initialize(); 269 CrosDBusService::Initialize();
272 270
273 LoginState::Initialize(); 271 LoginState::Initialize();
274 CryptohomeLibrary::Initialize(); 272 CryptohomeLibrary::Initialize();
275 CertLoader::Initialize(); 273 CertLoader::Initialize();
276 274
277 // This function and SystemKeyEventListener use InputMethodManager. 275 // This function and SystemKeyEventListener use InputMethodManager.
278 chromeos::input_method::Initialize( 276 chromeos::input_method::Initialize(
279 content::BrowserThread::GetMessageLoopProxyForThread( 277 content::BrowserThread::GetMessageLoopProxyForThread(
280 content::BrowserThread::UI), 278 content::BrowserThread::UI),
281 content::BrowserThread::GetMessageLoopProxyForThread( 279 content::BrowserThread::GetMessageLoopProxyForThread(
282 content::BrowserThread::FILE)); 280 content::BrowserThread::FILE));
283 disks::DiskMountManager::Initialize(); 281 disks::DiskMountManager::Initialize();
284 cryptohome::AsyncMethodCaller::Initialize(); 282 cryptohome::AsyncMethodCaller::Initialize();
285 283
286 // Initialize NetworkLibrary only for the browser, unless running tests
287 // (which do their own NetworkLibrary setup with
288 // ScopedStubNetworkLibraryEnabler in InProcessBrowserTest).
289 if (!parameters.ui_task) {
290 const bool use_stub = !base::chromeos::IsRunningOnChromeOS();
291 NetworkLibrary::Initialize(use_stub);
292 network_library_initialized_ = true;
293 }
294
295 // Always initialize these handlers which should not conflict with
296 // NetworkLibrary.
297 NetworkHandler::Initialize(); 284 NetworkHandler::Initialize();
298 CertLibrary::Initialize(); 285 CertLibrary::Initialize();
299 286
300 // Initialize the network change notifier for Chrome OS. The network 287 // Initialize the network change notifier for Chrome OS. The network
301 // change notifier starts to monitor changes from the power manager and 288 // change notifier starts to monitor changes from the power manager and
302 // the network manager. 289 // the network manager.
303 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); 290 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize();
304 291
305 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade 292 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade
306 // detector starts to monitor changes from the update engine. 293 // detector starts to monitor changes from the update engine.
(...skipping 10 matching lines...) Expand all
317 // g_browser_process initializes BrowserPolicyConnector. 304 // g_browser_process initializes BrowserPolicyConnector.
318 DeviceSettingsService::Initialize(); 305 DeviceSettingsService::Initialize();
319 DeviceSettingsService::Get()->SetSessionManager( 306 DeviceSettingsService::Get()->SetSessionManager(
320 DBusThreadManager::Get()->GetSessionManagerClient(), 307 DBusThreadManager::Get()->GetSessionManagerClient(),
321 OwnerKeyUtil::Create()); 308 OwnerKeyUtil::Create());
322 } 309 }
323 310
324 ~DBusServices() { 311 ~DBusServices() {
325 CertLibrary::Shutdown(); 312 CertLibrary::Shutdown();
326 NetworkHandler::Shutdown(); 313 NetworkHandler::Shutdown();
327 if (network_library_initialized_)
328 NetworkLibrary::Shutdown();
329 314
330 cryptohome::AsyncMethodCaller::Shutdown(); 315 cryptohome::AsyncMethodCaller::Shutdown();
331 disks::DiskMountManager::Shutdown(); 316 disks::DiskMountManager::Shutdown();
332 input_method::Shutdown(); 317 input_method::Shutdown();
333 318
334 CryptohomeLibrary::Shutdown(); 319 CryptohomeLibrary::Shutdown();
335 LoginState::Shutdown(); 320 LoginState::Shutdown();
336 321
337 CrosDBusService::Shutdown(); 322 CrosDBusService::Shutdown();
338 323
339 // NOTE: This must only be called if Initialize() was called. 324 // NOTE: This must only be called if Initialize() was called.
340 DBusThreadManager::Shutdown(); 325 DBusThreadManager::Shutdown();
341 } 326 }
342 327
343 private: 328 private:
344 bool network_library_initialized_;
345
346 DISALLOW_COPY_AND_ASSIGN(DBusServices); 329 DISALLOW_COPY_AND_ASSIGN(DBusServices);
347 }; 330 };
348 331
349 } // namespace internal 332 } // namespace internal
350 333
351 // ChromeBrowserMainPartsChromeos ---------------------------------------------- 334 // ChromeBrowserMainPartsChromeos ----------------------------------------------
352 335
353 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( 336 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos(
354 const content::MainFunctionParams& parameters) 337 const content::MainFunctionParams& parameters)
355 : ChromeBrowserMainPartsLinux(parameters) { 338 : ChromeBrowserMainPartsLinux(parameters) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { 598 if (KioskModeSettings::Get()->IsKioskModeEnabled()) {
616 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( 599 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create(
617 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 600 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
618 "Retail mode"); 601 "Retail mode");
619 } 602 }
620 603
621 peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); 604 peripheral_battery_observer_.reset(new PeripheralBatteryObserver());
622 605
623 // Initialize the network portal detector for Chrome OS. The network 606 // Initialize the network portal detector for Chrome OS. The network
624 // portal detector starts to listen for notifications from 607 // portal detector starts to listen for notifications from
625 // NetworkLibrary about changes in the NetworkManager and initiates 608 // NetworkHandler about changes in the NetworkManager and initiates
626 // captive portal detection for active networks. 609 // captive portal detection for active networks.
627 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); 610 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance();
628 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) { 611 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) {
629 detector->Init(); 612 detector->Init();
630 #if defined(GOOGLE_CHROME_BUILD) 613 #if defined(GOOGLE_CHROME_BUILD)
631 bool is_official_build = true; 614 bool is_official_build = true;
632 #else 615 #else
633 bool is_official_build = false; 616 bool is_official_build = false;
634 #endif 617 #endif
635 // Enable portal detector if EULA was previously accepted or if 618 // Enable portal detector if EULA was previously accepted or if
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 783
801 // Destroy DeviceSettingsService after g_browser_process. 784 // Destroy DeviceSettingsService after g_browser_process.
802 DeviceSettingsService::Shutdown(); 785 DeviceSettingsService::Shutdown();
803 } 786 }
804 787
805 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 788 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
806 default_pinned_apps_field_trial::SetupTrial(); 789 default_pinned_apps_field_trial::SetupTrial();
807 } 790 }
808 791
809 } // namespace chromeos 792 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider_chromeos.cc ('k') | chrome/browser/chromeos/cros/enum_mapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698