| 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/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool CanPerformEarlyRestart() { | 145 bool CanPerformEarlyRestart() { |
| 146 // Desktop build is used for development only. Early restart is not supported. | 146 // Desktop build is used for development only. Early restart is not supported. |
| 147 if (!base::SysInfo::IsRunningOnChromeOS()) | 147 if (!base::SysInfo::IsRunningOnChromeOS()) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 if (!ChromeUserManager::Get()->GetCurrentUserFlow()-> |
| 151 SupportsEarlyRestartToApplyFlags()) { |
| 152 return false; |
| 153 } |
| 154 |
| 150 const ExistingUserController* controller = | 155 const ExistingUserController* controller = |
| 151 ExistingUserController::current_controller(); | 156 ExistingUserController::current_controller(); |
| 152 if (!controller) | 157 if (!controller) |
| 153 return true; | 158 return true; |
| 154 | 159 |
| 155 // Early restart is possible only if OAuth token is up to date. | 160 // Early restart is possible only if OAuth token is up to date. |
| 156 | 161 |
| 157 if (controller->password_changed()) | 162 if (controller->password_changed()) |
| 158 return false; | 163 return false; |
| 159 | 164 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 if (!NeedRestartToApplyPerSessionFlags(user_flags, &command_line_difference)) | 397 if (!NeedRestartToApplyPerSessionFlags(user_flags, &command_line_difference)) |
| 393 return false; | 398 return false; |
| 394 | 399 |
| 395 LogCustomSwitches(command_line_difference); | 400 LogCustomSwitches(command_line_difference); |
| 396 | 401 |
| 397 about_flags::ReportCustomFlags("Login.CustomFlags", command_line_difference); | 402 about_flags::ReportCustomFlags("Login.CustomFlags", command_line_difference); |
| 398 | 403 |
| 399 CommandLine::StringVector flags; | 404 CommandLine::StringVector flags; |
| 400 // argv[0] is the program name |CommandLine::NO_PROGRAM|. | 405 // argv[0] is the program name |CommandLine::NO_PROGRAM|. |
| 401 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); | 406 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); |
| 402 VLOG(1) << "Restarting to apply per-session flags..."; | 407 LOG(WARNING) << "Restarting to apply per-session flags..."; |
| 403 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( | 408 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( |
| 404 user_manager::UserManager::Get()->GetActiveUser()->email(), flags); | 409 user_manager::UserManager::Get()->GetActiveUser()->email(), flags); |
| 405 AttemptRestart(profile); | 410 AttemptRestart(profile); |
| 406 return true; | 411 return true; |
| 407 } | 412 } |
| 408 | 413 |
| 409 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( | 414 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( |
| 410 AuthStatusConsumer* consumer) { | 415 AuthStatusConsumer* consumer) { |
| 411 // Screen locker needs new Authenticator instance each time. | 416 // Screen locker needs new Authenticator instance each time. |
| 412 if (ScreenLocker::default_screen_locker()) { | 417 if (ScreenLocker::default_screen_locker()) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 CrosSettings* cros_settings = CrosSettings::Get(); | 494 CrosSettings* cros_settings = CrosSettings::Get(); |
| 490 bool allow_new_user = false; | 495 bool allow_new_user = false; |
| 491 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 496 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 492 if (allow_new_user) | 497 if (allow_new_user) |
| 493 return true; | 498 return true; |
| 494 return cros_settings->FindEmailInList( | 499 return cros_settings->FindEmailInList( |
| 495 kAccountsPrefUsers, username, wildcard_match); | 500 kAccountsPrefUsers, username, wildcard_match); |
| 496 } | 501 } |
| 497 | 502 |
| 498 } // namespace chromeos | 503 } // namespace chromeos |
| OLD | NEW |