| OLD | NEW |
| 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 "components/user_manager/user_names.h" |
| 7 | 7 |
| 8 namespace chromeos { | 8 namespace chromeos { |
| 9 | 9 |
| 10 UserContext::UserContext() : account_id_(EmptyAccountId()) {} | 10 UserContext::UserContext() : account_id_(EmptyAccountId()) {} |
| 11 | 11 |
| 12 UserContext::UserContext(const UserContext& other) | 12 UserContext::UserContext(const UserContext& other) |
| 13 : account_id_(other.account_id_), | 13 : account_id_(other.account_id_), |
| 14 key_(other.key_), | 14 key_(other.key_), |
| 15 auth_code_(other.auth_code_), | 15 auth_code_(other.auth_code_), |
| 16 refresh_token_(other.refresh_token_), | 16 refresh_token_(other.refresh_token_), |
| 17 access_token_(other.access_token_), | 17 access_token_(other.access_token_), |
| 18 user_id_hash_(other.user_id_hash_), | 18 user_id_hash_(other.user_id_hash_), |
| 19 is_using_oauth_(other.is_using_oauth_), | 19 is_using_oauth_(other.is_using_oauth_), |
| 20 is_using_pin_(other.is_using_pin_), | 20 is_using_pin_(other.is_using_pin_), |
| 21 auth_flow_(other.auth_flow_), | 21 auth_flow_(other.auth_flow_), |
| 22 user_type_(other.user_type_), | 22 user_type_(other.user_type_), |
| 23 public_session_locale_(other.public_session_locale_), | 23 public_session_locale_(other.public_session_locale_), |
| 24 public_session_input_method_(other.public_session_input_method_), | 24 public_session_input_method_(other.public_session_input_method_), |
| 25 device_id_(other.device_id_), | 25 device_id_(other.device_id_), |
| 26 gaps_cookie_(other.gaps_cookie_) {} | 26 gaps_cookie_(other.gaps_cookie_) {} |
| 27 | 27 |
| 28 UserContext::UserContext(const AccountId& account_id) | 28 UserContext::UserContext(const AccountId& account_id) |
| 29 : account_id_(account_id) { | 29 : account_id_(account_id) { |
| 30 account_id_.SetUserEmail( | 30 account_id_.SetUserEmail( |
| 31 login::CanonicalizeUserID(account_id.GetUserEmail())); | 31 user_manager::CanonicalizeUserID(account_id.GetUserEmail())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 UserContext::UserContext(user_manager::UserType user_type, | 34 UserContext::UserContext(user_manager::UserType user_type, |
| 35 const AccountId& account_id) | 35 const AccountId& account_id) |
| 36 : account_id_(account_id), user_type_(user_type) { | 36 : account_id_(account_id), user_type_(user_type) { |
| 37 if (user_type_ == user_manager::USER_TYPE_REGULAR) | 37 if (user_type_ == user_manager::USER_TYPE_REGULAR) |
| 38 account_id_.SetUserEmail( | 38 account_id_.SetUserEmail( |
| 39 login::CanonicalizeUserID(account_id_.GetUserEmail())); | 39 user_manager::CanonicalizeUserID(account_id_.GetUserEmail())); |
| 40 } | 40 } |
| 41 | 41 |
| 42 UserContext::~UserContext() { | 42 UserContext::~UserContext() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool UserContext::operator==(const UserContext& context) const { | 45 bool UserContext::operator==(const UserContext& context) const { |
| 46 return context.account_id_ == account_id_ && context.key_ == key_ && | 46 return context.account_id_ == account_id_ && context.key_ == key_ && |
| 47 context.auth_code_ == auth_code_ && | 47 context.auth_code_ == auth_code_ && |
| 48 context.refresh_token_ == refresh_token_ && | 48 context.refresh_token_ == refresh_token_ && |
| 49 context.access_token_ == access_token_ && | 49 context.access_token_ == access_token_ && |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 gaps_cookie_ = gaps_cookie; | 183 gaps_cookie_ = gaps_cookie; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void UserContext::ClearSecrets() { | 186 void UserContext::ClearSecrets() { |
| 187 key_.ClearSecret(); | 187 key_.ClearSecret(); |
| 188 auth_code_.clear(); | 188 auth_code_.clear(); |
| 189 refresh_token_.clear(); | 189 refresh_token_.clear(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace chromeos | 192 } // namespace chromeos |
| OLD | NEW |