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

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

Issue 14028005: Update locally managed user creation flow according to mocks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with TOT Created 7 years, 8 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/chromeos/login/base_login_display_host.h" 9 #include "chrome/browser/chromeos/login/base_login_display_host.h"
10 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h" 10 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h"
11 #include "chrome/browser/chromeos/login/wizard_controller.h" 11 #include "chrome/browser/chromeos/login/wizard_controller.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 namespace { 15 namespace {
16 16
17 LocallyManagedUserCreationScreen* GetScreen(LoginDisplayHost* host) { 17 LocallyManagedUserCreationScreen* GetScreen(LoginDisplayHost* host) {
18 DCHECK(host); 18 DCHECK(host);
19 DCHECK(host->GetWizardController()); 19 DCHECK(host->GetWizardController());
20 DCHECK(host->GetWizardController()->GetLocallyManagedUserCreationScreen()); 20 DCHECK(host->GetWizardController()->GetLocallyManagedUserCreationScreen());
21 return host->GetWizardController()->GetLocallyManagedUserCreationScreen(); 21 return host->GetWizardController()->GetLocallyManagedUserCreationScreen();
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 LocallyManagedUserCreationFlow::LocallyManagedUserCreationFlow( 26 LocallyManagedUserCreationFlow::LocallyManagedUserCreationFlow(
27 const std::string& manager_id, 27 const std::string& manager_id)
28 string16 name, 28 : ExtendedUserFlow(manager_id),
29 const std::string& password) : ExtendedUserFlow(manager_id), 29 token_validated_(false),
30 name_(name), 30 logged_in_(false) {}
31 password_(password),
32 token_validated_(false),
33 logged_in_(false) {}
34 31
35 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {} 32 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {}
36 33
37 bool LocallyManagedUserCreationFlow::ShouldLaunchBrowser() { 34 bool LocallyManagedUserCreationFlow::ShouldLaunchBrowser() {
38 return false; 35 return false;
39 } 36 }
40 37
41 bool LocallyManagedUserCreationFlow::ShouldSkipPostLoginScreens() { 38 bool LocallyManagedUserCreationFlow::ShouldSkipPostLoginScreens() {
42 return true; 39 return true;
43 } 40 }
44 41
45 void LocallyManagedUserCreationFlow::HandleOAuthTokenStatusChange( 42 void LocallyManagedUserCreationFlow::HandleOAuthTokenStatusChange(
46 User::OAuthTokenStatus status) { 43 User::OAuthTokenStatus status) {
47 if (status == User::OAUTH_TOKEN_STATUS_UNKNOWN) 44 if (status == User::OAUTH_TOKEN_STATUS_UNKNOWN)
48 return; 45 return;
49 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) { 46 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) {
50 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 47 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
51 return; 48 return;
52 } 49 }
53 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID); 50 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID);
54 // We expect that LaunchExtraSteps is called by this time (local 51 // We expect that LaunchExtraSteps is called by this time (local
55 // authentication happens before oauth token validation). 52 // authentication happens before oauth token validation).
56 token_validated_ = true; 53 token_validated_ = true;
57 54
58 if (token_validated_ && logged_in_) 55 if (token_validated_ && logged_in_)
59 GetScreen(host())->OnManagerSignIn(); 56 GetScreen(host())->OnManagerFullyAuthenticated();
60 } 57 }
61 58
62 59
63 bool LocallyManagedUserCreationFlow::HandleLoginFailure( 60 bool LocallyManagedUserCreationFlow::HandleLoginFailure(
64 const LoginFailure& failure) { 61 const LoginFailure& failure) {
65 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME) 62 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME)
66 GetScreen(host())->OnManagerLoginFailure(); 63 GetScreen(host())->OnManagerLoginFailure();
67 else 64 else
68 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 65 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
69 return true; 66 return true;
70 } 67 }
71 68
72 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() { 69 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() {
73 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 70 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
74 return true; 71 return true;
75 } 72 }
76 73
77 void LocallyManagedUserCreationFlow::LaunchExtraSteps( 74 void LocallyManagedUserCreationFlow::LaunchExtraSteps(
78 Profile* profile) { 75 Profile* profile) {
79
80 logged_in_ = true; 76 logged_in_ = true;
81 if (token_validated_ && logged_in_) 77 if (token_validated_ && logged_in_)
82 GetScreen(host())->OnManagerSignIn(); 78 GetScreen(host())->OnManagerFullyAuthenticated();
79 else
80 GetScreen(host())->OnManagerCryptohomeAuthenticated();
83 } 81 }
84 82
85 } // namespace chromeos 83 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698