Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 378893003: Fix and re-enable "early restart" feature on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 if (about_flags::AreSwitchesIdenticalToCurrentCommandLine( 114 if (about_flags::AreSwitchesIdenticalToCurrentCommandLine(
115 user_flags, *CommandLine::ForCurrentProcess())) { 115 user_flags, *CommandLine::ForCurrentProcess())) {
116 return false; 116 return false;
117 } 117 }
118 118
119 return true; 119 return true;
120 } 120 }
121 121
122 bool CanPerformEarlyRestart() { 122 bool CanPerformEarlyRestart() {
123 // TODO(alemate): crbug/391357 - temporary disabling early restart before 123 // Desktop build is used for development only. Early restart is not supported.
124 // crbug.com/391793 is fixed. 124 if (!base::SysInfo::IsRunningOnChromeOS())
Nikita (slow) 2014/07/09 04:04:08 FYI we can emulate that at least somehow since Gue
125 return false; 125 return false;
126 126
127 const ExistingUserController* controller = 127 const ExistingUserController* controller =
128 ExistingUserController::current_controller(); 128 ExistingUserController::current_controller();
129 if (!controller) 129 if (!controller)
130 return true; 130 return true;
131 131
132 // Early restart is possible only if OAuth token is up to date. 132 // Early restart is possible only if OAuth token is up to date.
133 133
134 if (controller->password_changed()) 134 if (controller->password_changed())
135 return false; 135 return false;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 this); 344 this);
345 } 345 }
346 346
347 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { 347 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) {
348 if (delegate_ == delegate) 348 if (delegate_ == delegate)
349 delegate_ = NULL; 349 delegate_ = NULL;
350 } 350 }
351 351
352 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile, 352 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
353 bool early_restart) { 353 bool early_restart) {
354 if (ProfileHelper::IsSigninProfile(profile))
355 return false;
356
354 if (early_restart && !CanPerformEarlyRestart()) 357 if (early_restart && !CanPerformEarlyRestart())
355 return false; 358 return false;
356 359
357 const CommandLine user_flags(CreatePerSessionCommandLine(profile)); 360 const CommandLine user_flags(CreatePerSessionCommandLine(profile));
358 if (!NeedRestartToApplyPerSessionFlags(user_flags)) 361 if (!NeedRestartToApplyPerSessionFlags(user_flags))
359 return false; 362 return false;
360 363
361 CommandLine::StringVector flags; 364 CommandLine::StringVector flags;
362 // argv[0] is the program name |CommandLine::NO_PROGRAM|. 365 // argv[0] is the program name |CommandLine::NO_PROGRAM|.
363 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); 366 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 CrosSettings* cros_settings = CrosSettings::Get(); 462 CrosSettings* cros_settings = CrosSettings::Get();
460 bool allow_new_user = false; 463 bool allow_new_user = false;
461 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 464 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
462 if (allow_new_user) 465 if (allow_new_user)
463 return true; 466 return true;
464 return cros_settings->FindEmailInList( 467 return cros_settings->FindEmailInList(
465 kAccountsPrefUsers, username, wildcard_match); 468 kAccountsPrefUsers, username, wildcard_match);
466 } 469 }
467 470
468 } // namespace chromeos 471 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698