| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 462 |
| 463 power_prefs_.reset(new PowerPrefs( | 463 power_prefs_.reset(new PowerPrefs( |
| 464 DBusThreadManager::Get()->GetPowerPolicyController())); | 464 DBusThreadManager::Get()->GetPowerPolicyController())); |
| 465 | 465 |
| 466 // In Aura builds this will initialize ash::Shell. | 466 // In Aura builds this will initialize ash::Shell. |
| 467 ChromeBrowserMainPartsLinux::PreProfileInit(); | 467 ChromeBrowserMainPartsLinux::PreProfileInit(); |
| 468 | 468 |
| 469 if (immediate_login) { | 469 if (immediate_login) { |
| 470 const std::string user_id = login::CanonicalizeUserID( | 470 const std::string user_id = login::CanonicalizeUserID( |
| 471 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); | 471 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); |
| 472 UserManager* user_manager = UserManager::Get(); | 472 UserManager* user_manager = GetUserManager(); |
| 473 | 473 |
| 474 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && | 474 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && |
| 475 !user_manager->IsKnownUser(user_id)) { | 475 !user_manager->IsKnownUser(user_id)) { |
| 476 // When a device-local account is removed, its policy is deleted from disk | 476 // When a device-local account is removed, its policy is deleted from disk |
| 477 // immediately. If a session using this account happens to be in progress, | 477 // immediately. If a session using this account happens to be in progress, |
| 478 // the session is allowed to continue with policy served from an in-memory | 478 // the session is allowed to continue with policy served from an in-memory |
| 479 // cache. If Chrome crashes later in the session, the policy becomes | 479 // cache. If Chrome crashes later in the session, the policy becomes |
| 480 // completely unavailable. Exit the session in that case, rather than | 480 // completely unavailable. Exit the session in that case, rather than |
| 481 // allowing it to continue without policy. | 481 // allowing it to continue without policy. |
| 482 chrome::AttemptUserExit(); | 482 chrome::AttemptUserExit(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 575 |
| 576 // This is done in SessionManager::OnProfileCreated during normal login. | 576 // This is done in SessionManager::OnProfileCreated during normal login. |
| 577 UserSessionManager::GetInstance()->InitRlz(profile()); | 577 UserSessionManager::GetInstance()->InitRlz(profile()); |
| 578 | 578 |
| 579 // Send the PROFILE_PREPARED notification and call SessionStarted() | 579 // Send the PROFILE_PREPARED notification and call SessionStarted() |
| 580 // so that the Launcher and other Profile dependent classes are created. | 580 // so that the Launcher and other Profile dependent classes are created. |
| 581 content::NotificationService::current()->Notify( | 581 content::NotificationService::current()->Notify( |
| 582 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 582 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 583 content::NotificationService::AllSources(), | 583 content::NotificationService::AllSources(), |
| 584 content::Details<Profile>(profile())); | 584 content::Details<Profile>(profile())); |
| 585 UserManager::Get()->SessionStarted(); | 585 GetUserManager()->SessionStarted(); |
| 586 | 586 |
| 587 // Now is the good time to retrieve other logged in users for this session. | 587 // Now is the good time to retrieve other logged in users for this session. |
| 588 // First user has been already marked as logged in and active in | 588 // First user has been already marked as logged in and active in |
| 589 // PreProfileInit(). Chrome should tread other user in a session as active | 589 // PreProfileInit(). Chrome should tread other user in a session as active |
| 590 // in the background. | 590 // in the background. |
| 591 UserManager::Get()->RestoreActiveSessions(); | 591 GetUserManager()->RestoreActiveSessions(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 // Initialize the network portal detector for Chrome OS. The network | 594 // Initialize the network portal detector for Chrome OS. The network |
| 595 // portal detector starts to listen for notifications from | 595 // portal detector starts to listen for notifications from |
| 596 // NetworkStateHandler and initiates captive portal detection for | 596 // NetworkStateHandler and initiates captive portal detection for |
| 597 // active networks. Shoule be called before call to | 597 // active networks. Shoule be called before call to |
| 598 // OptionallyRunChromeOSLoginManager, because it depends on | 598 // OptionallyRunChromeOSLoginManager, because it depends on |
| 599 // NetworkPortalDetector. | 599 // NetworkPortalDetector. |
| 600 NetworkPortalDetectorImpl::Initialize( | 600 NetworkPortalDetectorImpl::Initialize( |
| 601 g_browser_process->system_request_context()); | 601 g_browser_process->system_request_context()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 614 | 614 |
| 615 // Tests should be able to tune login manager before showing it. | 615 // Tests should be able to tune login manager before showing it. |
| 616 // Thus only show login manager in normal (non-testing) mode. | 616 // Thus only show login manager in normal (non-testing) mode. |
| 617 if (!parameters().ui_task || | 617 if (!parameters().ui_task || |
| 618 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { | 618 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { |
| 619 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 619 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
| 620 } | 620 } |
| 621 | 621 |
| 622 // Guest user profile is never initialized with locale settings, | 622 // Guest user profile is never initialized with locale settings, |
| 623 // so we need special handling for Guest session. | 623 // so we need special handling for Guest session. |
| 624 if (UserManager::Get()->IsLoggedInAsGuest()) | 624 if (GetUserManager()->IsLoggedInAsGuest()) |
| 625 SetGuestLocale(profile()); | 625 SetGuestLocale(profile()); |
| 626 | 626 |
| 627 // These observers must be initialized after the profile because | 627 // These observers must be initialized after the profile because |
| 628 // they use the profile to dispatch extension events. | 628 // they use the profile to dispatch extension events. |
| 629 extension_system_event_observer_.reset(new ExtensionSystemEventObserver()); | 629 extension_system_event_observer_.reset(new ExtensionSystemEventObserver()); |
| 630 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { | 630 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { |
| 631 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( | 631 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( |
| 632 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 632 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 633 "Retail mode"); | 633 "Retail mode"); |
| 634 } | 634 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 AccessibilityManager::Shutdown(); | 770 AccessibilityManager::Shutdown(); |
| 771 | 771 |
| 772 media::SoundsManager::Shutdown(); | 772 media::SoundsManager::Shutdown(); |
| 773 | 773 |
| 774 system::StatisticsProvider::GetInstance()->Shutdown(); | 774 system::StatisticsProvider::GetInstance()->Shutdown(); |
| 775 | 775 |
| 776 // Let the UserManager and WallpaperManager unregister itself as an observer | 776 // Let the UserManager and WallpaperManager unregister itself as an observer |
| 777 // of the CrosSettings singleton before it is destroyed. This also ensures | 777 // of the CrosSettings singleton before it is destroyed. This also ensures |
| 778 // that the UserManager has no URLRequest pending (see | 778 // that the UserManager has no URLRequest pending (see |
| 779 // http://crbug.com/276659). | 779 // http://crbug.com/276659). |
| 780 UserManager::Get()->Shutdown(); | 780 GetUserManager()->Shutdown(); |
| 781 WallpaperManager::Get()->Shutdown(); | 781 WallpaperManager::Get()->Shutdown(); |
| 782 | 782 |
| 783 // Let the AutomaticRebootManager unregister itself as an observer of several | 783 // Let the AutomaticRebootManager unregister itself as an observer of several |
| 784 // subsystems. | 784 // subsystems. |
| 785 g_browser_process->platform_part()->ShutdownAutomaticRebootManager(); | 785 g_browser_process->platform_part()->ShutdownAutomaticRebootManager(); |
| 786 | 786 |
| 787 // Clean up dependency on CrosSettings and stop pending data fetches. | 787 // Clean up dependency on CrosSettings and stop pending data fetches. |
| 788 KioskAppManager::Shutdown(); | 788 KioskAppManager::Shutdown(); |
| 789 | 789 |
| 790 // Let the DeviceCloudPolicyInvalidator unregister itself as an observer of | 790 // Let the DeviceCloudPolicyInvalidator unregister itself as an observer of |
| (...skipping 23 matching lines...) Expand all Loading... |
| 814 // Destroy DBus services immediately after threads are stopped. | 814 // Destroy DBus services immediately after threads are stopped. |
| 815 dbus_services_.reset(); | 815 dbus_services_.reset(); |
| 816 | 816 |
| 817 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 817 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 818 | 818 |
| 819 // Destroy DeviceSettingsService after g_browser_process. | 819 // Destroy DeviceSettingsService after g_browser_process. |
| 820 DeviceSettingsService::Shutdown(); | 820 DeviceSettingsService::Shutdown(); |
| 821 } | 821 } |
| 822 | 822 |
| 823 } // namespace chromeos | 823 } // namespace chromeos |
| OLD | NEW |