Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge 299881 "Don't allow restarting to apply custom flags when super…
Browse files Browse the repository at this point in the history
…vised user creation flow is active"

BUG=422918
TBR=nkostylev

Review URL: https://codereview.chromium.org/654173005

Cr-Commit-Position: refs/heads/master@{#299881}
(cherry picked from commit dcf3361)

Review URL: https://codereview.chromium.org/655963004

Cr-Commit-Position: refs/branch-heads/2171@{#183}
Cr-Branched-From: 267aeeb-refs/heads/master@{#297060}
  • Loading branch information
Nikita Kostylev committed Oct 20, 2014
1 parent a8f51c3 commit ce537c7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chrome/browser/chromeos/login/login_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ bool CanPerformEarlyRestart() {
if (!base::SysInfo::IsRunningOnChromeOS())
return false;

if (!ChromeUserManager::Get()->GetCurrentUserFlow()->
SupportsEarlyRestartToApplyFlags()) {
return false;
}

const ExistingUserController* controller =
ExistingUserController::current_controller();
if (!controller)
Expand Down Expand Up @@ -403,7 +408,7 @@ bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
CommandLine::StringVector flags;
// argv[0] is the program name |CommandLine::NO_PROGRAM|.
flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end());
VLOG(1) << "Restarting to apply per-session flags...";
LOG(WARNING) << "Restarting to apply per-session flags...";
DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser(
user_manager::UserManager::Get()->GetActiveUser()->email(), flags);
AttemptRestart(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ bool SupervisedUserCreationFlow::ShouldSkipPostLoginScreens() {
return true;
}

bool SupervisedUserCreationFlow::SupportsEarlyRestartToApplyFlags() {
return false;
}

void SupervisedUserCreationFlow::HandleOAuthTokenStatusChange(
user_manager::User::OAuthTokenStatus status) {
if (status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SupervisedUserCreationFlow : public ExtendedUserFlow {
virtual bool ShouldShowSettings() OVERRIDE;
virtual bool ShouldLaunchBrowser() OVERRIDE;
virtual bool ShouldSkipPostLoginScreens() OVERRIDE;
virtual bool SupportsEarlyRestartToApplyFlags() OVERRIDE;
virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE;
virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE;
virtual bool HandlePasswordChangeDetected() OVERRIDE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ bool SupervisedUserLoginFlow::ShouldSkipPostLoginScreens() {
return true;
}

bool SupervisedUserLoginFlow::SupportsEarlyRestartToApplyFlags() {
return false;
}

bool SupervisedUserLoginFlow::HandleLoginFailure(const AuthFailure& failure) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class SupervisedUserLoginFlow
virtual bool CanLockScreen() OVERRIDE;
virtual bool ShouldLaunchBrowser() OVERRIDE;
virtual bool ShouldSkipPostLoginScreens() OVERRIDE;
virtual bool SupportsEarlyRestartToApplyFlags() OVERRIDE;
virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE;
virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE;
virtual bool HandlePasswordChangeDetected() OVERRIDE;
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/chromeos/login/user_flow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ bool DefaultUserFlow::ShouldSkipPostLoginScreens() {
return false;
}

bool DefaultUserFlow::SupportsEarlyRestartToApplyFlags() {
return true;
}

bool DefaultUserFlow::HandleLoginFailure(const AuthFailure& failure) {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/chromeos/login/user_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UserFlow {
virtual bool ShouldShowSettings() = 0;
virtual bool ShouldLaunchBrowser() = 0;
virtual bool ShouldSkipPostLoginScreens() = 0;
virtual bool SupportsEarlyRestartToApplyFlags() = 0;
virtual bool HandleLoginFailure(const AuthFailure& failure) = 0;
virtual void HandleLoginSuccess(const UserContext& context) = 0;
virtual bool HandlePasswordChangeDetected() = 0;
Expand Down Expand Up @@ -54,6 +55,7 @@ class DefaultUserFlow : public UserFlow {
virtual bool ShouldShowSettings() OVERRIDE;
virtual bool ShouldLaunchBrowser() OVERRIDE;
virtual bool ShouldSkipPostLoginScreens() OVERRIDE;
virtual bool SupportsEarlyRestartToApplyFlags() OVERRIDE;
virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE;
virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE;
virtual bool HandlePasswordChangeDetected() OVERRIDE;
Expand Down

0 comments on commit ce537c7

Please sign in to comment.