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

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: Fix nits 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) : ExtendedUserFlow(manager_id),
Nikita (slow) 2013/04/12 13:12:15 nit: Please move this to next line and change alig
28 string16 name,
29 const std::string& password) : ExtendedUserFlow(manager_id),
30 name_(name),
31 password_(password),
32 token_validated_(false), 28 token_validated_(false),
33 logged_in_(false) {} 29 logged_in_(false) {}
34 30
35 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {} 31 LocallyManagedUserCreationFlow::~LocallyManagedUserCreationFlow() {}
36 32
37 bool LocallyManagedUserCreationFlow::ShouldLaunchBrowser() { 33 bool LocallyManagedUserCreationFlow::ShouldLaunchBrowser() {
38 return false; 34 return false;
39 } 35 }
40 36
41 bool LocallyManagedUserCreationFlow::ShouldSkipPostLoginScreens() { 37 bool LocallyManagedUserCreationFlow::ShouldSkipPostLoginScreens() {
42 return true; 38 return true;
43 } 39 }
44 40
45 void LocallyManagedUserCreationFlow::HandleOAuthTokenStatusChange( 41 void LocallyManagedUserCreationFlow::HandleOAuthTokenStatusChange(
46 User::OAuthTokenStatus status) { 42 User::OAuthTokenStatus status) {
47 if (status == User::OAUTH_TOKEN_STATUS_UNKNOWN) 43 if (status == User::OAUTH_TOKEN_STATUS_UNKNOWN)
48 return; 44 return;
49 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) { 45 if (status == User::OAUTH2_TOKEN_STATUS_INVALID) {
50 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 46 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
51 return; 47 return;
52 } 48 }
53 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID); 49 DCHECK(status == User::OAUTH2_TOKEN_STATUS_VALID);
54 // We expect that LaunchExtraSteps is called by this time (local 50 // We expect that LaunchExtraSteps is called by this time (local
55 // authentication happens before oauth token validation). 51 // authentication happens before oauth token validation).
56 token_validated_ = true; 52 token_validated_ = true;
57 53
58 if (token_validated_ && logged_in_) 54 if (token_validated_ && logged_in_)
59 GetScreen(host())->OnManagerSignIn(); 55 GetScreen(host())->OnManagerFullyAuthenticated();
60 } 56 }
61 57
62 58
63 bool LocallyManagedUserCreationFlow::HandleLoginFailure( 59 bool LocallyManagedUserCreationFlow::HandleLoginFailure(
64 const LoginFailure& failure) { 60 const LoginFailure& failure) {
65 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME) 61 if (failure.reason() == LoginFailure::COULD_NOT_MOUNT_CRYPTOHOME)
66 GetScreen(host())->OnManagerLoginFailure(); 62 GetScreen(host())->OnManagerLoginFailure();
67 else 63 else
68 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 64 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
69 return true; 65 return true;
70 } 66 }
71 67
72 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() { 68 bool LocallyManagedUserCreationFlow::HandlePasswordChangeDetected() {
73 GetScreen(host())->ShowManagerInconsistentStateErrorScreen(); 69 GetScreen(host())->ShowManagerInconsistentStateErrorScreen();
74 return true; 70 return true;
75 } 71 }
76 72
77 void LocallyManagedUserCreationFlow::LaunchExtraSteps( 73 void LocallyManagedUserCreationFlow::LaunchExtraSteps(
78 Profile* profile) { 74 Profile* profile) {
79
80 logged_in_ = true; 75 logged_in_ = true;
81 if (token_validated_ && logged_in_) 76 if (token_validated_ && logged_in_)
82 GetScreen(host())->OnManagerSignIn(); 77 GetScreen(host())->OnManagerFullyAuthenticated();
78 else
79 GetScreen(host())->OnManagerCryptohomeAuthenticated();
83 } 80 }
84 81
85 } // namespace chromeos 82 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698