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