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

Side by Side Diff: chrome/browser/chromeos/login/managed/locally_managed_user_creation_flow.cc

Issue 256223003: Supervised users import: make sure users are up-to-date. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 6 years, 7 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 | Annotate | Revision Log
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/managed/locally_managed_user_creation_fl ow.h" 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_fl ow.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
(...skipping 12 matching lines...) Expand all
23 return host->GetWizardController()->GetLocallyManagedUserCreationScreen(); 23 return host->GetWizardController()->GetLocallyManagedUserCreationScreen();
24 } 24 }
25 25
26 } // namespace 26 } // namespace
27 27
28 LocallyManagedUserCreationFlow::LocallyManagedUserCreationFlow( 28 LocallyManagedUserCreationFlow::LocallyManagedUserCreationFlow(
29 const std::string& manager_id) 29 const std::string& manager_id)
30 : ExtendedUserFlow(manager_id), 30 : ExtendedUserFlow(manager_id),
31 token_validated_(false), 31 token_validated_(false),
32 logged_in_(false), 32 logged_in_(false),
33 session_started_(false),
33 manager_profile_(NULL) {} 34 manager_profile_(NULL) {}
34 35
35 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {} 36 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {}
36 37
37 bool LocallyManagedUserCreationFlow::CanLockScreen() { 38 bool LocallyManagedUserCreationFlow::CanLockScreen() {
38 return false; 39 return false;
39 } 40 }
40 41
41 bool LocallyManagedUserCreationFlow::ShouldShowSettings() { 42 bool LocallyManagedUserCreationFlow::ShouldShowSettings() {
42 return false; 43 return false;
(...skipping 13 matching lines...) Expand all
56 return; 57 return;
57 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) { 58 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) {
58 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 59 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
59 return; 60 return;
60 } 61 }
61 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID); 62 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID);
62 // We expect that LaunchExtraSteps is called by this time (local 63 // We expect that LaunchExtraSteps is called by this time (local
63 // authentication happens before oauth token validation). 64 // authentication happens before oauth token validation).
64 token_validated_ = true; 65 token_validated_ = true;
65 66
66 if (token_validated_ && logged_in_) 67 if (token_validated_ && logged_in_) {
67 GetScreen(host())->OnManagerFullyAuthenticated(manager_profile_); 68 if (!session_started_)
69 GetScreen(host())->OnManagerFullyAuthenticated(manager_profile_);
70 session_started_ = true;
71 }
68 } 72 }
69 73
70 74
71 bool LocallyManagedUserCreationFlow::HandleLoginFailure( 75 bool LocallyManagedUserCreationFlow::HandleLoginFailure(
72 const LoginFailure& failure) { 76 const LoginFailure& failure) {
73 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME) 77 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME)
74 GetScreen(host())->OnManagerLoginFailure(); 78 GetScreen(host())->OnManagerLoginFailure();
75 else 79 else
76 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 80 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
77 return true; 81 return true;
78 } 82 }
79 83
80 void LocallyManagedUserCreationFlow::HandleLoginSuccess( 84 void LocallyManagedUserCreationFlow::HandleLoginSuccess(
81 const UserContext& context) {} 85 const UserContext& context) {}
82 86
83 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() { 87 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() {
84 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 88 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
85 return true; 89 return true;
86 } 90 }
87 91
88 void LocallyManagedUserCreationFlow::LaunchExtraSteps( 92 void LocallyManagedUserCreationFlow::LaunchExtraSteps(
89 Profile* profile) { 93 Profile* profile) {
90 logged_in_ = true; 94 logged_in_ = true;
91 manager_profile_ = profile; 95 manager_profile_ = profile;
92 g_browser_process->platform_part()->profile_helper()->ProfileStartup( 96 g_browser_process->platform_part()->profile_helper()->ProfileStartup(
93 profile, 97 profile,
94 true); 98 true);
95 99
96 if (token_validated_ && logged_in_) 100 if (token_validated_ && logged_in_) {
97 GetScreen(host())->OnManagerFullyAuthenticated(manager_profile_); 101 if (!session_started_)
98 else 102 GetScreen(host())->OnManagerFullyAuthenticated(manager_profile_);
103 session_started_ = true;
104 } else {
99 GetScreen(host())->OnManagerCryptohomeAuthenticated(); 105 GetScreen(host())->OnManagerCryptohomeAuthenticated();
106 }
100 } 107 }
101 108
102 } // namespace chromeos 109 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698