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

Side by Side Diff: chromeos/login/auth/user_context.cc

Issue 1102863002: Revert of Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/login/auth/user_context.h" 5 #include "chromeos/login/auth/user_context.h"
6 #include "chromeos/login/user_names.h" 6 #include "chromeos/login/user_names.h"
7 7
8 namespace chromeos { 8 namespace chromeos {
9 9
10 UserContext::UserContext() 10 UserContext::UserContext()
11 : is_using_oauth_(true), 11 : is_using_oauth_(true),
12 auth_flow_(AUTH_FLOW_OFFLINE), 12 auth_flow_(AUTH_FLOW_OFFLINE),
13 user_type_(user_manager::USER_TYPE_REGULAR) { 13 user_type_(user_manager::USER_TYPE_REGULAR) {
14 } 14 }
15 15
16 UserContext::UserContext(const UserContext& other) 16 UserContext::UserContext(const UserContext& other)
17 : user_id_(other.user_id_), 17 : user_id_(other.user_id_),
18 gaia_id_(other.gaia_id_), 18 gaia_id_(other.gaia_id_),
19 key_(other.key_), 19 key_(other.key_),
20 auth_code_(other.auth_code_), 20 auth_code_(other.auth_code_),
21 refresh_token_(other.refresh_token_), 21 refresh_token_(other.refresh_token_),
22 access_token_(other.access_token_),
23 user_id_hash_(other.user_id_hash_), 22 user_id_hash_(other.user_id_hash_),
24 is_using_oauth_(other.is_using_oauth_), 23 is_using_oauth_(other.is_using_oauth_),
25 auth_flow_(other.auth_flow_), 24 auth_flow_(other.auth_flow_),
26 user_type_(other.user_type_), 25 user_type_(other.user_type_),
27 public_session_locale_(other.public_session_locale_), 26 public_session_locale_(other.public_session_locale_),
28 public_session_input_method_(other.public_session_input_method_) { 27 public_session_input_method_(other.public_session_input_method_) {
29 } 28 }
30 29
31 UserContext::UserContext(const std::string& user_id) 30 UserContext::UserContext(const std::string& user_id)
32 : user_id_(login::CanonicalizeUserID(user_id)), 31 : user_id_(login::CanonicalizeUserID(user_id)),
(...skipping 10 matching lines...) Expand all
43 if (user_type_ == user_manager::USER_TYPE_REGULAR) 42 if (user_type_ == user_manager::USER_TYPE_REGULAR)
44 user_id_ = login::CanonicalizeUserID(user_id); 43 user_id_ = login::CanonicalizeUserID(user_id);
45 else 44 else
46 user_id_ = user_id; 45 user_id_ = user_id;
47 } 46 }
48 47
49 UserContext::~UserContext() { 48 UserContext::~UserContext() {
50 } 49 }
51 50
52 bool UserContext::operator==(const UserContext& context) const { 51 bool UserContext::operator==(const UserContext& context) const {
53 return context.user_id_ == user_id_ && context.gaia_id_ == gaia_id_ && 52 return context.user_id_ == user_id_ &&
54 context.key_ == key_ && context.auth_code_ == auth_code_ && 53 context.gaia_id_ == gaia_id_ &&
55 context.refresh_token_ == refresh_token_ && 54 context.key_ == key_ &&
56 context.access_token_ == access_token_ && 55 context.auth_code_ == auth_code_ &&
57 context.user_id_hash_ == user_id_hash_ && 56 context.user_id_hash_ == user_id_hash_ &&
58 context.is_using_oauth_ == is_using_oauth_ && 57 context.is_using_oauth_ == is_using_oauth_ &&
59 context.auth_flow_ == auth_flow_ && context.user_type_ == user_type_ && 58 context.auth_flow_ == auth_flow_ &&
59 context.user_type_ == user_type_ &&
60 context.public_session_locale_ == public_session_locale_ && 60 context.public_session_locale_ == public_session_locale_ &&
61 context.public_session_input_method_ == public_session_input_method_; 61 context.public_session_input_method_ == public_session_input_method_;
62 } 62 }
63 63
64 bool UserContext::operator!=(const UserContext& context) const { 64 bool UserContext::operator!=(const UserContext& context) const {
65 return !(*this == context); 65 return !(*this == context);
66 } 66 }
67 67
68 const std::string& UserContext::GetUserID() const { 68 const std::string& UserContext::GetUserID() const {
69 return user_id_; 69 return user_id_;
(...skipping 12 matching lines...) Expand all
82 } 82 }
83 83
84 const std::string& UserContext::GetAuthCode() const { 84 const std::string& UserContext::GetAuthCode() const {
85 return auth_code_; 85 return auth_code_;
86 } 86 }
87 87
88 const std::string& UserContext::GetRefreshToken() const { 88 const std::string& UserContext::GetRefreshToken() const {
89 return refresh_token_; 89 return refresh_token_;
90 } 90 }
91 91
92 const std::string& UserContext::GetAccessToken() const {
93 return access_token_;
94 }
95
96 const std::string& UserContext::GetUserIDHash() const { 92 const std::string& UserContext::GetUserIDHash() const {
97 return user_id_hash_; 93 return user_id_hash_;
98 } 94 }
99 95
100 bool UserContext::IsUsingOAuth() const { 96 bool UserContext::IsUsingOAuth() const {
101 return is_using_oauth_; 97 return is_using_oauth_;
102 } 98 }
103 99
104 UserContext::AuthFlow UserContext::GetAuthFlow() const { 100 UserContext::AuthFlow UserContext::GetAuthFlow() const {
105 return auth_flow_; 101 return auth_flow_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 135 }
140 136
141 void UserContext::SetAuthCode(const std::string& auth_code) { 137 void UserContext::SetAuthCode(const std::string& auth_code) {
142 auth_code_ = auth_code; 138 auth_code_ = auth_code;
143 } 139 }
144 140
145 void UserContext::SetRefreshToken(const std::string& refresh_token) { 141 void UserContext::SetRefreshToken(const std::string& refresh_token) {
146 refresh_token_ = refresh_token; 142 refresh_token_ = refresh_token;
147 } 143 }
148 144
149 void UserContext::SetAccessToken(const std::string& access_token) {
150 access_token_ = access_token;
151 }
152
153 void UserContext::SetUserIDHash(const std::string& user_id_hash) { 145 void UserContext::SetUserIDHash(const std::string& user_id_hash) {
154 user_id_hash_ = user_id_hash; 146 user_id_hash_ = user_id_hash;
155 } 147 }
156 148
157 void UserContext::SetIsUsingOAuth(bool is_using_oauth) { 149 void UserContext::SetIsUsingOAuth(bool is_using_oauth) {
158 is_using_oauth_ = is_using_oauth; 150 is_using_oauth_ = is_using_oauth;
159 } 151 }
160 152
161 void UserContext::SetAuthFlow(AuthFlow auth_flow) { 153 void UserContext::SetAuthFlow(AuthFlow auth_flow) {
162 auth_flow_ = auth_flow; 154 auth_flow_ = auth_flow;
(...skipping 15 matching lines...) Expand all
178 device_id_ = device_id; 170 device_id_ = device_id;
179 } 171 }
180 172
181 void UserContext::ClearSecrets() { 173 void UserContext::ClearSecrets() {
182 key_.ClearSecret(); 174 key_.ClearSecret();
183 auth_code_.clear(); 175 auth_code_.clear();
184 refresh_token_.clear(); 176 refresh_token_.clear();
185 } 177 }
186 178
187 } // namespace chromeos 179 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698