OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 42 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" | 44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
46 #include "chrome/browser/chromeos/language_preferences.h" | 46 #include "chrome/browser/chromeos/language_preferences.h" |
47 #include "chrome/browser/chromeos/login/helper.h" | 47 #include "chrome/browser/chromeos/login/helper.h" |
48 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 48 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
49 #include "chrome/browser/chromeos/login/login_wizard.h" | 49 #include "chrome/browser/chromeos/login/login_wizard.h" |
50 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 50 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
51 #include "chrome/browser/chromeos/login/startup_utils.h" | 51 #include "chrome/browser/chromeos/login/startup_utils.h" |
52 #include "chrome/browser/chromeos/login/users/user_manager.h" | 52 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
53 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 53 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
54 #include "chrome/browser/chromeos/login/wizard_controller.h" | 54 #include "chrome/browser/chromeos/login/wizard_controller.h" |
55 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 55 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
56 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" | 56 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" |
57 #include "chrome/browser/chromeos/options/cert_library.h" | 57 #include "chrome/browser/chromeos/options/cert_library.h" |
58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
59 #include "chrome/browser/chromeos/policy/device_local_account.h" | 59 #include "chrome/browser/chromeos/policy/device_local_account.h" |
60 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h" | 60 #include "chrome/browser/chromeos/power/idle_action_warning_observer.h" |
61 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" | 61 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
62 #include "chrome/browser/chromeos/power/power_button_observer.h" | 62 #include "chrome/browser/chromeos/power/power_button_observer.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 #include "chromeos/login/user_names.h" | 100 #include "chromeos/login/user_names.h" |
101 #include "chromeos/login_event_recorder.h" | 101 #include "chromeos/login_event_recorder.h" |
102 #include "chromeos/network/network_change_notifier_chromeos.h" | 102 #include "chromeos/network/network_change_notifier_chromeos.h" |
103 #include "chromeos/network/network_change_notifier_factory_chromeos.h" | 103 #include "chromeos/network/network_change_notifier_factory_chromeos.h" |
104 #include "chromeos/network/network_handler.h" | 104 #include "chromeos/network/network_handler.h" |
105 #include "chromeos/system/statistics_provider.h" | 105 #include "chromeos/system/statistics_provider.h" |
106 #include "chromeos/tpm_token_loader.h" | 106 #include "chromeos/tpm_token_loader.h" |
107 #include "components/metrics/metrics_service.h" | 107 #include "components/metrics/metrics_service.h" |
108 #include "components/session_manager/core/session_manager.h" | 108 #include "components/session_manager/core/session_manager.h" |
109 #include "components/user_manager/user.h" | 109 #include "components/user_manager/user.h" |
| 110 #include "components/user_manager/user_manager.h" |
110 #include "content/public/browser/browser_thread.h" | 111 #include "content/public/browser/browser_thread.h" |
111 #include "content/public/browser/notification_service.h" | 112 #include "content/public/browser/notification_service.h" |
112 #include "content/public/browser/power_save_blocker.h" | 113 #include "content/public/browser/power_save_blocker.h" |
113 #include "content/public/common/main_function_params.h" | 114 #include "content/public/common/main_function_params.h" |
114 #include "media/audio/sounds/sounds_manager.h" | 115 #include "media/audio/sounds/sounds_manager.h" |
115 #include "net/base/network_change_notifier.h" | 116 #include "net/base/network_change_notifier.h" |
116 #include "net/url_request/url_request.h" | 117 #include "net/url_request/url_request.h" |
117 #include "net/url_request/url_request_context_getter.h" | 118 #include "net/url_request/url_request_context_getter.h" |
118 #include "ui/base/touch/touch_device.h" | 119 #include "ui/base/touch/touch_device.h" |
119 #include "ui/events/event_utils.h" | 120 #include "ui/events/event_utils.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // Now that the file thread exists we can record our stats. | 335 // Now that the file thread exists we can record our stats. |
335 BootTimesLoader::Get()->RecordChromeMainStats(); | 336 BootTimesLoader::Get()->RecordChromeMainStats(); |
336 LoginEventRecorder::Get()->SetDelegate(BootTimesLoader::Get()); | 337 LoginEventRecorder::Get()->SetDelegate(BootTimesLoader::Get()); |
337 | 338 |
338 // Trigger prefetching of ownership status. | 339 // Trigger prefetching of ownership status. |
339 DeviceSettingsService::Get()->Load(); | 340 DeviceSettingsService::Get()->Load(); |
340 | 341 |
341 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 342 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
342 // -- just before CreateProfile(). | 343 // -- just before CreateProfile(). |
343 | 344 |
344 UserManager::Initialize(); | 345 g_browser_process->platform_part()->InitializeChromeUserManager(); |
345 | 346 |
346 // Initialize the screen locker now so that it can receive | 347 // Initialize the screen locker now so that it can receive |
347 // LOGIN_USER_CHANGED notification from UserManager. | 348 // LOGIN_USER_CHANGED notification from UserManager. |
348 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 349 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
349 KioskModeIdleLogout::Initialize(); | 350 KioskModeIdleLogout::Initialize(); |
350 else | 351 else |
351 ScreenLocker::InitClass(); | 352 ScreenLocker::InitClass(); |
352 | 353 |
353 // This forces the ProfileManager to be created and register for the | 354 // This forces the ProfileManager to be created and register for the |
354 // notification it needs to track the logged in user. | 355 // notification it needs to track the logged in user. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 409 |
409 power_prefs_.reset(new PowerPrefs( | 410 power_prefs_.reset(new PowerPrefs( |
410 DBusThreadManager::Get()->GetPowerPolicyController())); | 411 DBusThreadManager::Get()->GetPowerPolicyController())); |
411 | 412 |
412 // In Aura builds this will initialize ash::Shell. | 413 // In Aura builds this will initialize ash::Shell. |
413 ChromeBrowserMainPartsLinux::PreProfileInit(); | 414 ChromeBrowserMainPartsLinux::PreProfileInit(); |
414 | 415 |
415 if (immediate_login) { | 416 if (immediate_login) { |
416 const std::string user_id = login::CanonicalizeUserID( | 417 const std::string user_id = login::CanonicalizeUserID( |
417 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); | 418 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); |
418 UserManager* user_manager = UserManager::Get(); | 419 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
419 | 420 |
420 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && | 421 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && |
421 !user_manager->IsKnownUser(user_id)) { | 422 !user_manager->IsKnownUser(user_id)) { |
422 // When a device-local account is removed, its policy is deleted from disk | 423 // When a device-local account is removed, its policy is deleted from disk |
423 // immediately. If a session using this account happens to be in progress, | 424 // immediately. If a session using this account happens to be in progress, |
424 // the session is allowed to continue with policy served from an in-memory | 425 // the session is allowed to continue with policy served from an in-memory |
425 // cache. If Chrome crashes later in the session, the policy becomes | 426 // cache. If Chrome crashes later in the session, the policy becomes |
426 // completely unavailable. Exit the session in that case, rather than | 427 // completely unavailable. Exit the session in that case, rather than |
427 // allowing it to continue without policy. | 428 // allowing it to continue without policy. |
428 chrome::AttemptUserExit(); | 429 chrome::AttemptUserExit(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 detector->Enable(true); | 524 detector->Enable(true); |
524 } | 525 } |
525 | 526 |
526 bool is_running_test = parameters().ui_task != NULL; | 527 bool is_running_test = parameters().ui_task != NULL; |
527 g_browser_process->platform_part()->InitializeSessionManager( | 528 g_browser_process->platform_part()->InitializeSessionManager( |
528 parsed_command_line(), profile(), is_running_test); | 529 parsed_command_line(), profile(), is_running_test); |
529 g_browser_process->platform_part()->SessionManager()->Start(); | 530 g_browser_process->platform_part()->SessionManager()->Start(); |
530 | 531 |
531 // Guest user profile is never initialized with locale settings, | 532 // Guest user profile is never initialized with locale settings, |
532 // so we need special handling for Guest session. | 533 // so we need special handling for Guest session. |
533 if (UserManager::Get()->IsLoggedInAsGuest()) | 534 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) |
534 SetGuestLocale(profile()); | 535 SetGuestLocale(profile()); |
535 | 536 |
536 // These observers must be initialized after the profile because | 537 // These observers must be initialized after the profile because |
537 // they use the profile to dispatch extension events. | 538 // they use the profile to dispatch extension events. |
538 extension_system_event_observer_.reset(new ExtensionSystemEventObserver()); | 539 extension_system_event_observer_.reset(new ExtensionSystemEventObserver()); |
539 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { | 540 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { |
540 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( | 541 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( |
541 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 542 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
542 "Retail mode"); | 543 "Retail mode"); |
543 } | 544 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 AccessibilityManager::Shutdown(); | 686 AccessibilityManager::Shutdown(); |
686 | 687 |
687 media::SoundsManager::Shutdown(); | 688 media::SoundsManager::Shutdown(); |
688 | 689 |
689 system::StatisticsProvider::GetInstance()->Shutdown(); | 690 system::StatisticsProvider::GetInstance()->Shutdown(); |
690 | 691 |
691 // Let the UserManager and WallpaperManager unregister itself as an observer | 692 // Let the UserManager and WallpaperManager unregister itself as an observer |
692 // of the CrosSettings singleton before it is destroyed. This also ensures | 693 // of the CrosSettings singleton before it is destroyed. This also ensures |
693 // that the UserManager has no URLRequest pending (see | 694 // that the UserManager has no URLRequest pending (see |
694 // http://crbug.com/276659). | 695 // http://crbug.com/276659). |
695 UserManager::Get()->Shutdown(); | 696 g_browser_process->platform_part()->user_manager()->Shutdown(); |
696 WallpaperManager::Get()->Shutdown(); | 697 WallpaperManager::Get()->Shutdown(); |
697 | 698 |
698 // Let the AutomaticRebootManager unregister itself as an observer of several | 699 // Let the AutomaticRebootManager unregister itself as an observer of several |
699 // subsystems. | 700 // subsystems. |
700 g_browser_process->platform_part()->ShutdownAutomaticRebootManager(); | 701 g_browser_process->platform_part()->ShutdownAutomaticRebootManager(); |
701 | 702 |
702 // Clean up dependency on CrosSettings and stop pending data fetches. | 703 // Clean up dependency on CrosSettings and stop pending data fetches. |
703 KioskAppManager::Shutdown(); | 704 KioskAppManager::Shutdown(); |
704 | 705 |
705 // Let the DeviceCloudPolicyInvalidator unregister itself as an observer of | 706 // Let the DeviceCloudPolicyInvalidator unregister itself as an observer of |
(...skipping 11 matching lines...) Expand all Loading... |
717 | 718 |
718 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. | 719 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. |
719 DeviceOAuth2TokenServiceFactory::Shutdown(); | 720 DeviceOAuth2TokenServiceFactory::Shutdown(); |
720 | 721 |
721 // Called after | 722 // Called after |
722 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() to be | 723 // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() to be |
723 // executed after execution of chrome::CloseAsh(), because some | 724 // executed after execution of chrome::CloseAsh(), because some |
724 // parts of WebUI depends on NetworkPortalDetector. | 725 // parts of WebUI depends on NetworkPortalDetector. |
725 NetworkPortalDetector::Shutdown(); | 726 NetworkPortalDetector::Shutdown(); |
726 | 727 |
727 UserManager::Destroy(); | 728 g_browser_process->platform_part()->DestroyChromeUserManager(); |
728 | 729 |
729 g_browser_process->platform_part()->ShutdownSessionManager(); | 730 g_browser_process->platform_part()->ShutdownSessionManager(); |
730 } | 731 } |
731 | 732 |
732 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { | 733 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() { |
733 // Destroy DBus services immediately after threads are stopped. | 734 // Destroy DBus services immediately after threads are stopped. |
734 dbus_services_.reset(); | 735 dbus_services_.reset(); |
735 | 736 |
736 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 737 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
737 | 738 |
738 // Destroy DeviceSettingsService after g_browser_process. | 739 // Destroy DeviceSettingsService after g_browser_process. |
739 DeviceSettingsService::Shutdown(); | 740 DeviceSettingsService::Shutdown(); |
740 } | 741 } |
741 | 742 |
742 } // namespace chromeos | 743 } // namespace chromeos |
OLD | NEW |