| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "chrome/browser/chromeos/power/brightness_observer.h" | 44 #include "chrome/browser/chromeos/power/brightness_observer.h" |
| 45 #include "chrome/browser/chromeos/power/output_observer.h" | 45 #include "chrome/browser/chromeos/power/output_observer.h" |
| 46 #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeo
s.h" | 46 #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeo
s.h" |
| 47 #include "chrome/browser/chromeos/power/power_button_observer.h" | 47 #include "chrome/browser/chromeos/power/power_button_observer.h" |
| 48 #include "chrome/browser/chromeos/power/power_state_override.h" | 48 #include "chrome/browser/chromeos/power/power_state_override.h" |
| 49 #include "chrome/browser/chromeos/power/resume_observer.h" | 49 #include "chrome/browser/chromeos/power/resume_observer.h" |
| 50 #include "chrome/browser/chromeos/power/screen_dimming_observer.h" | 50 #include "chrome/browser/chromeos/power/screen_dimming_observer.h" |
| 51 #include "chrome/browser/chromeos/power/screen_lock_observer.h" | 51 #include "chrome/browser/chromeos/power/screen_lock_observer.h" |
| 52 #include "chrome/browser/chromeos/power/user_activity_notifier.h" | 52 #include "chrome/browser/chromeos/power/user_activity_notifier.h" |
| 53 #include "chrome/browser/chromeos/power/video_activity_notifier.h" | 53 #include "chrome/browser/chromeos/power/video_activity_notifier.h" |
| 54 #include "chrome/browser/chromeos/settings/ownership_service.h" | 54 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 55 #include "chrome/browser/chromeos/settings/session_manager_observer.h" | 55 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 56 #include "chrome/browser/chromeos/system/statistics_provider.h" | 56 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 57 #include "chrome/browser/chromeos/system_key_event_listener.h" | 57 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 58 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 58 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 59 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" | 59 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" |
| 60 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 60 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
| 61 #include "chrome/browser/defaults.h" | 61 #include "chrome/browser/defaults.h" |
| 62 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h" | 62 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h" |
| 63 #include "chrome/browser/metrics/metrics_service.h" | 63 #include "chrome/browser/metrics/metrics_service.h" |
| 64 #include "chrome/browser/net/chrome_network_delegate.h" | 64 #include "chrome/browser/net/chrome_network_delegate.h" |
| 65 #include "chrome/browser/policy/browser_policy_connector.h" | 65 #include "chrome/browser/policy/browser_policy_connector.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 // Initialize DBusThreadManager for the browser. This must be done after | 296 // Initialize DBusThreadManager for the browser. This must be done after |
| 297 // the main message loop is started, as it uses the message loop. | 297 // the main message loop is started, as it uses the message loop. |
| 298 chromeos::DBusThreadManager::Initialize(); | 298 chromeos::DBusThreadManager::Initialize(); |
| 299 // Add observers for WallpaperManager. WallpaperManager is initialized before | 299 // Add observers for WallpaperManager. WallpaperManager is initialized before |
| 300 // DBusThreadManager. | 300 // DBusThreadManager. |
| 301 chromeos::WallpaperManager::Get()->AddObservers(); | 301 chromeos::WallpaperManager::Get()->AddObservers(); |
| 302 | 302 |
| 303 chromeos::CrosDBusService::Initialize(); | 303 chromeos::CrosDBusService::Initialize(); |
| 304 | 304 |
| 305 // Initialize the session manager observer so that we'll take actions | 305 // Initialize the device settings service so that we'll take actions per |
| 306 // per signals sent from the session manager. | 306 // signals sent from the session manager. |
| 307 session_manager_observer_.reset(new chromeos::SessionManagerObserver); | 307 chromeos::DeviceSettingsService::Get()->Initialize( |
| 308 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| 309 chromeos::OwnerKeyUtil::Create()); |
| 308 | 310 |
| 309 chromeos::disks::DiskMountManager::Initialize(); | 311 chromeos::disks::DiskMountManager::Initialize(); |
| 310 chromeos::mtp::MediaTransferProtocolManager::Initialize(); | 312 chromeos::mtp::MediaTransferProtocolManager::Initialize(); |
| 311 cryptohome::AsyncMethodCaller::Initialize(); | 313 cryptohome::AsyncMethodCaller::Initialize(); |
| 312 | 314 |
| 313 // Initialize the network change notifier for Chrome OS. The network | 315 // Initialize the network change notifier for Chrome OS. The network |
| 314 // change notifier starts to monitor changes from the power manager and | 316 // change notifier starts to monitor changes from the power manager and |
| 315 // the network manager. | 317 // the network manager. |
| 316 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); | 318 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Init(); |
| 317 | 319 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 352 } |
| 351 | 353 |
| 352 void ChromeBrowserMainPartsChromeos::PreProfileInit() { | 354 void ChromeBrowserMainPartsChromeos::PreProfileInit() { |
| 353 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 355 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 354 // -- immediately before Profile creation(). | 356 // -- immediately before Profile creation(). |
| 355 | 357 |
| 356 // Now that the file thread exists we can record our stats. | 358 // Now that the file thread exists we can record our stats. |
| 357 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); | 359 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); |
| 358 | 360 |
| 359 // Trigger prefetching of ownership status. | 361 // Trigger prefetching of ownership status. |
| 360 chromeos::OwnershipService::GetSharedInstance()->Prewarm(); | 362 chromeos::DeviceSettingsService::Get()->Load(); |
| 361 | 363 |
| 362 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 364 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 363 // -- just before CreateProfile(). | 365 // -- just before CreateProfile(). |
| 364 | 366 |
| 365 // Initialize the screen locker now so that it can receive | 367 // Initialize the screen locker now so that it can receive |
| 366 // LOGIN_USER_CHANGED notification from UserManager. | 368 // LOGIN_USER_CHANGED notification from UserManager. |
| 367 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | 369 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { |
| 368 chromeos::KioskModeIdleLogout::Initialize(); | 370 chromeos::KioskModeIdleLogout::Initialize(); |
| 369 } else { | 371 } else { |
| 370 chromeos::ScreenLocker::InitClass(); | 372 chromeos::ScreenLocker::InitClass(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // stops monitoring changes from the update engine. | 523 // stops monitoring changes from the update engine. |
| 522 if (UpgradeDetectorChromeos::GetInstance()) | 524 if (UpgradeDetectorChromeos::GetInstance()) |
| 523 UpgradeDetectorChromeos::GetInstance()->Shutdown(); | 525 UpgradeDetectorChromeos::GetInstance()->Shutdown(); |
| 524 | 526 |
| 525 // Shutdown the network change notifier for Chrome OS. The network | 527 // Shutdown the network change notifier for Chrome OS. The network |
| 526 // change notifier stops monitoring changes from the power manager and | 528 // change notifier stops monitoring changes from the power manager and |
| 527 // the network manager. | 529 // the network manager. |
| 528 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance()) | 530 if (chromeos::CrosNetworkChangeNotifierFactory::GetInstance()) |
| 529 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); | 531 chromeos::CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); |
| 530 | 532 |
| 533 // Tell DeviceSettingsService to stop talking to session_manager. |
| 534 chromeos::DeviceSettingsService::Get()->Shutdown(); |
| 535 |
| 531 // We should remove observers attached to D-Bus clients before | 536 // We should remove observers attached to D-Bus clients before |
| 532 // DBusThreadManager is shut down. | 537 // DBusThreadManager is shut down. |
| 533 session_manager_observer_.reset(); | |
| 534 screen_lock_observer_.reset(); | 538 screen_lock_observer_.reset(); |
| 535 resume_observer_.reset(); | 539 resume_observer_.reset(); |
| 536 brightness_observer_.reset(); | 540 brightness_observer_.reset(); |
| 537 output_observer_.reset(); | 541 output_observer_.reset(); |
| 538 | 542 |
| 539 // The XInput2 event listener needs to be shut down earlier than when | 543 // The XInput2 event listener needs to be shut down earlier than when |
| 540 // Singletons are finally destroyed in AtExitManager. | 544 // Singletons are finally destroyed in AtExitManager. |
| 541 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 545 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
| 542 | 546 |
| 543 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, | 547 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; | 611 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; |
| 608 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); | 612 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); |
| 609 } else if (trial->group() == margin_200mb) { | 613 } else if (trial->group() == margin_200mb) { |
| 610 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; | 614 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; |
| 611 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); | 615 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); |
| 612 } else { | 616 } else { |
| 613 LOG(WARNING) << "low_mem: Part of 'default' experiment"; | 617 LOG(WARNING) << "low_mem: Part of 'default' experiment"; |
| 614 } | 618 } |
| 615 } | 619 } |
| 616 } | 620 } |
| OLD | NEW |