| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/login/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (about_flags::AreSwitchesIdenticalToCurrentCommandLine( | 289 if (about_flags::AreSwitchesIdenticalToCurrentCommandLine( |
| 290 user_flags, *base::CommandLine::ForCurrentProcess(), | 290 user_flags, *base::CommandLine::ForCurrentProcess(), |
| 291 out_command_line_difference)) { | 291 out_command_line_difference)) { |
| 292 return false; | 292 return false; |
| 293 } | 293 } |
| 294 | 294 |
| 295 return true; | 295 return true; |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool CanPerformEarlyRestart() { | 298 bool CanPerformEarlyRestart() { |
| 299 // Desktop build is used for development only. Early restart is not supported. | |
| 300 if (!base::SysInfo::IsRunningOnChromeOS()) | |
| 301 return false; | |
| 302 | |
| 303 if (!ChromeUserManager::Get() | 299 if (!ChromeUserManager::Get() |
| 304 ->GetCurrentUserFlow() | 300 ->GetCurrentUserFlow() |
| 305 ->SupportsEarlyRestartToApplyFlags()) { | 301 ->SupportsEarlyRestartToApplyFlags()) { |
| 306 return false; | 302 return false; |
| 307 } | 303 } |
| 308 | 304 |
| 309 const ExistingUserController* controller = | 305 const ExistingUserController* controller = |
| 310 ExistingUserController::current_controller(); | 306 ExistingUserController::current_controller(); |
| 311 if (!controller) | 307 if (!controller) |
| 312 return true; | 308 return true; |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 locale_util::SwitchLanguage(pref_locale, enable_layouts, | 709 locale_util::SwitchLanguage(pref_locale, enable_layouts, |
| 714 false /* login_layouts_only */, callback, | 710 false /* login_layouts_only */, callback, |
| 715 profile); | 711 profile); |
| 716 | 712 |
| 717 return true; | 713 return true; |
| 718 } | 714 } |
| 719 | 715 |
| 720 bool UserSessionManager::RestartToApplyPerSessionFlagsIfNeed( | 716 bool UserSessionManager::RestartToApplyPerSessionFlagsIfNeed( |
| 721 Profile* profile, | 717 Profile* profile, |
| 722 bool early_restart) { | 718 bool early_restart) { |
| 719 SessionManagerClient* session_manager_client = |
| 720 DBusThreadManager::Get()->GetSessionManagerClient(); |
| 721 if (!session_manager_client->SupportsRestartToApplyUserFlags()) |
| 722 return false; |
| 723 |
| 723 if (ProfileHelper::IsSigninProfile(profile)) | 724 if (ProfileHelper::IsSigninProfile(profile)) |
| 724 return false; | 725 return false; |
| 725 | 726 |
| 726 // Kiosk sessions keeps the startup flags. | 727 // Kiosk sessions keeps the startup flags. |
| 727 if (user_manager::UserManager::Get() && | 728 if (user_manager::UserManager::Get() && |
| 728 user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) { | 729 user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) { |
| 729 return false; | 730 return false; |
| 730 } | 731 } |
| 731 | 732 |
| 732 if (early_restart && !CanPerformEarlyRestart()) | 733 if (early_restart && !CanPerformEarlyRestart()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 749 | 750 |
| 750 LogCustomSwitches(command_line_difference); | 751 LogCustomSwitches(command_line_difference); |
| 751 | 752 |
| 752 about_flags::ReportAboutFlagsHistogram( | 753 about_flags::ReportAboutFlagsHistogram( |
| 753 "Login.CustomFlags", command_line_difference, std::set<std::string>()); | 754 "Login.CustomFlags", command_line_difference, std::set<std::string>()); |
| 754 | 755 |
| 755 base::CommandLine::StringVector flags; | 756 base::CommandLine::StringVector flags; |
| 756 // argv[0] is the program name |base::CommandLine::NO_PROGRAM|. | 757 // argv[0] is the program name |base::CommandLine::NO_PROGRAM|. |
| 757 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); | 758 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); |
| 758 LOG(WARNING) << "Restarting to apply per-session flags..."; | 759 LOG(WARNING) << "Restarting to apply per-session flags..."; |
| 759 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( | 760 session_manager_client->SetFlagsForUser( |
| 760 cryptohome::Identification( | 761 cryptohome::Identification( |
| 761 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()), | 762 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()), |
| 762 flags); | 763 flags); |
| 763 AttemptRestart(profile); | 764 AttemptRestart(profile); |
| 764 return true; | 765 return true; |
| 765 } | 766 } |
| 766 | 767 |
| 767 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 768 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
| 768 return user_context_.GetAccountId().is_valid() && | 769 return user_context_.GetAccountId().is_valid() && |
| 769 user_manager::User::TypeHasGaiaAccount(user_context_.GetUserType()) && | 770 user_manager::User::TypeHasGaiaAccount(user_context_.GetUserType()) && |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 ->browser_policy_connector_chromeos() | 1887 ->browser_policy_connector_chromeos() |
| 1887 ->IsEnterpriseManaged()) { | 1888 ->IsEnterpriseManaged()) { |
| 1888 return false; | 1889 return false; |
| 1889 } | 1890 } |
| 1890 | 1891 |
| 1891 // Do not show end of life notification if this is a guest session | 1892 // Do not show end of life notification if this is a guest session |
| 1892 return !profile->IsGuestSession(); | 1893 return !profile->IsGuestSession(); |
| 1893 } | 1894 } |
| 1894 | 1895 |
| 1895 } // namespace chromeos | 1896 } // namespace chromeos |
| OLD | NEW |