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

Side by Side Diff: chrome/browser/chromeos/login/auth/auth_attempt_state.cc

Issue 290483003: Tame the proliferation of UserContext constructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/auth/auth_attempt_state.h" 5 #include "chrome/browser/chromeos/login/auth/auth_attempt_state.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "google_apis/gaia/gaia_auth_consumer.h" 10 #include "google_apis/gaia/gaia_auth_consumer.h"
11 #include "google_apis/gaia/gaia_auth_fetcher.h" 11 #include "google_apis/gaia/gaia_auth_fetcher.h"
12 12
13 using content::BrowserThread; 13 using content::BrowserThread;
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 AuthAttemptState::AuthAttemptState(const UserContext& user_context, 17 AuthAttemptState::AuthAttemptState(const UserContext& user_context,
18 const std::string& login_token, 18 User::UserType user_type,
19 const std::string& login_captcha, 19 bool unlock,
20 const User::UserType user_type, 20 bool online_complete,
21 const bool user_is_new) 21 bool user_is_new)
22 : user_context(user_context), 22 : user_context(user_context),
23 login_token(login_token),
24 login_captcha(login_captcha),
25 user_type(user_type), 23 user_type(user_type),
26 unlock(false), 24 unlock(unlock),
27 online_complete_(false), 25 online_complete_(online_complete),
28 online_outcome_(LoginFailure::NONE), 26 online_outcome_(online_complete ? LoginFailure::UNLOCK_FAILED :
27 LoginFailure::NONE),
29 hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed), 28 hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
30 is_first_time_user_(user_is_new), 29 is_first_time_user_(user_is_new),
31 cryptohome_complete_(false), 30 cryptohome_complete_(false),
32 cryptohome_outcome_(false), 31 cryptohome_outcome_(false),
33 cryptohome_code_(cryptohome::MOUNT_ERROR_NONE), 32 cryptohome_code_(cryptohome::MOUNT_ERROR_NONE),
34 username_hash_obtained_(true), 33 username_hash_obtained_(true),
35 username_hash_valid_(true) { 34 username_hash_valid_(true) {
36 } 35 }
37 36
38 AuthAttemptState::AuthAttemptState(const std::string& username,
39 const std::string& password)
40 : user_context(username, password, ""),
41 user_type(User::USER_TYPE_REGULAR),
42 unlock(true),
43 online_complete_(true),
44 online_outcome_(LoginFailure::UNLOCK_FAILED),
45 hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
46 is_first_time_user_(false),
47 cryptohome_complete_(false),
48 cryptohome_outcome_(false),
49 cryptohome_code_(cryptohome::MOUNT_ERROR_NONE),
50 username_hash_obtained_(true) {
51 }
52
53 AuthAttemptState::AuthAttemptState(const UserContext& user_context,
54 const bool user_is_new)
55 : user_context(user_context),
56 user_type(User::USER_TYPE_REGULAR),
57 unlock(true),
58 online_complete_(false),
59 online_outcome_(LoginFailure::NONE),
60 hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
61 is_first_time_user_(user_is_new),
62 cryptohome_complete_(false),
63 cryptohome_outcome_(false),
64 cryptohome_code_(cryptohome::MOUNT_ERROR_NONE),
65 username_hash_obtained_(true) {
66 }
67
68 AuthAttemptState::~AuthAttemptState() {} 37 AuthAttemptState::~AuthAttemptState() {}
69 38
70 void AuthAttemptState::RecordOnlineLoginStatus( 39 void AuthAttemptState::RecordOnlineLoginStatus(
71 const LoginFailure& outcome) { 40 const LoginFailure& outcome) {
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
73 online_complete_ = true; 42 online_complete_ = true;
74 online_outcome_ = outcome; 43 online_outcome_ = outcome;
75 // We're either going to not try again, or try again with HOSTED 44 // We're either going to not try again, or try again with HOSTED
76 // accounts not allowed, so just set this here. 45 // accounts not allowed, so just set this here.
77 DisableHosted(); 46 DisableHosted();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
156 return username_hash_obtained_; 125 return username_hash_obtained_;
157 } 126 }
158 127
159 bool AuthAttemptState::username_hash_valid() { 128 bool AuthAttemptState::username_hash_valid() {
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
161 return username_hash_obtained_; 130 return username_hash_obtained_;
162 } 131 }
163 132
164 } // namespace chromeos 133 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth/auth_attempt_state.h ('k') | chrome/browser/chromeos/login/auth/extended_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698