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

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

Issue 1229883003: ChromeOS: should send old user GAPS cookie to GAIA on user reauthentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 5 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') | components/user_manager/user_manager.h » ('j') | 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_), 22 access_token_(other.access_token_),
23 user_id_hash_(other.user_id_hash_), 23 user_id_hash_(other.user_id_hash_),
24 is_using_oauth_(other.is_using_oauth_), 24 is_using_oauth_(other.is_using_oauth_),
25 auth_flow_(other.auth_flow_), 25 auth_flow_(other.auth_flow_),
26 user_type_(other.user_type_), 26 user_type_(other.user_type_),
27 public_session_locale_(other.public_session_locale_), 27 public_session_locale_(other.public_session_locale_),
28 public_session_input_method_(other.public_session_input_method_), 28 public_session_input_method_(other.public_session_input_method_),
29 device_id_(other.device_id_) { 29 device_id_(other.device_id_),
30 gaps_cookie_(other.gaps_cookie_) {
30 } 31 }
31 32
32 UserContext::UserContext(const std::string& user_id) 33 UserContext::UserContext(const std::string& user_id)
33 : user_id_(login::CanonicalizeUserID(user_id)), 34 : user_id_(login::CanonicalizeUserID(user_id)),
34 is_using_oauth_(true), 35 is_using_oauth_(true),
35 auth_flow_(AUTH_FLOW_OFFLINE), 36 auth_flow_(AUTH_FLOW_OFFLINE),
36 user_type_(user_manager::USER_TYPE_REGULAR) { 37 user_type_(user_manager::USER_TYPE_REGULAR) {
37 } 38 }
38 39
39 UserContext::UserContext(user_manager::UserType user_type, 40 UserContext::UserContext(user_manager::UserType user_type,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 116 }
116 117
117 const std::string& UserContext::GetPublicSessionInputMethod() const { 118 const std::string& UserContext::GetPublicSessionInputMethod() const {
118 return public_session_input_method_; 119 return public_session_input_method_;
119 } 120 }
120 121
121 const std::string& UserContext::GetDeviceId() const { 122 const std::string& UserContext::GetDeviceId() const {
122 return device_id_; 123 return device_id_;
123 } 124 }
124 125
126 const std::string& UserContext::GetGAPSCookie() const {
127 return gaps_cookie_;
128 }
129
125 bool UserContext::HasCredentials() const { 130 bool UserContext::HasCredentials() const {
126 return (!user_id_.empty() && !key_.GetSecret().empty()) || 131 return (!user_id_.empty() && !key_.GetSecret().empty()) ||
127 !auth_code_.empty(); 132 !auth_code_.empty();
128 } 133 }
129 134
130 void UserContext::SetUserID(const std::string& user_id) { 135 void UserContext::SetUserID(const std::string& user_id) {
131 user_id_ = login::CanonicalizeUserID(user_id); 136 user_id_ = login::CanonicalizeUserID(user_id);
132 } 137 }
133 138
134 void UserContext::SetGaiaID(const std::string& gaia_id) { 139 void UserContext::SetGaiaID(const std::string& gaia_id) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 177 }
173 178
174 void UserContext::SetPublicSessionInputMethod(const std::string& input_method) { 179 void UserContext::SetPublicSessionInputMethod(const std::string& input_method) {
175 public_session_input_method_ = input_method; 180 public_session_input_method_ = input_method;
176 } 181 }
177 182
178 void UserContext::SetDeviceId(const std::string& device_id) { 183 void UserContext::SetDeviceId(const std::string& device_id) {
179 device_id_ = device_id; 184 device_id_ = device_id;
180 } 185 }
181 186
187 void UserContext::SetGAPSCookie(const std::string& gaps_cookie) {
188 gaps_cookie_ = gaps_cookie;
189 }
190
182 void UserContext::ClearSecrets() { 191 void UserContext::ClearSecrets() {
183 key_.ClearSecret(); 192 key_.ClearSecret();
184 auth_code_.clear(); 193 auth_code_.clear();
185 refresh_token_.clear(); 194 refresh_token_.clear();
186 } 195 }
187 196
188 } // namespace chromeos 197 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | components/user_manager/user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698