| 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 "components/user_manager/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 is_forcing_dircrypto_(other.is_forcing_dircrypto_), |
| 21 auth_flow_(other.auth_flow_), | 22 auth_flow_(other.auth_flow_), |
| 22 user_type_(other.user_type_), | 23 user_type_(other.user_type_), |
| 23 public_session_locale_(other.public_session_locale_), | 24 public_session_locale_(other.public_session_locale_), |
| 24 public_session_input_method_(other.public_session_input_method_), | 25 public_session_input_method_(other.public_session_input_method_), |
| 25 device_id_(other.device_id_), | 26 device_id_(other.device_id_), |
| 26 gaps_cookie_(other.gaps_cookie_) {} | 27 gaps_cookie_(other.gaps_cookie_) {} |
| 27 | 28 |
| 28 UserContext::UserContext(const AccountId& account_id) | 29 UserContext::UserContext(const AccountId& account_id) |
| 29 : account_id_(account_id) { | 30 : account_id_(account_id) { |
| 30 account_id_.SetUserEmail( | 31 account_id_.SetUserEmail( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 92 } |
| 92 | 93 |
| 93 bool UserContext::IsUsingOAuth() const { | 94 bool UserContext::IsUsingOAuth() const { |
| 94 return is_using_oauth_; | 95 return is_using_oauth_; |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool UserContext::IsUsingPin() const { | 98 bool UserContext::IsUsingPin() const { |
| 98 return is_using_pin_; | 99 return is_using_pin_; |
| 99 } | 100 } |
| 100 | 101 |
| 102 bool UserContext::IsForcingDircrypto() const { |
| 103 return is_forcing_dircrypto_; |
| 104 } |
| 105 |
| 101 UserContext::AuthFlow UserContext::GetAuthFlow() const { | 106 UserContext::AuthFlow UserContext::GetAuthFlow() const { |
| 102 return auth_flow_; | 107 return auth_flow_; |
| 103 } | 108 } |
| 104 | 109 |
| 105 user_manager::UserType UserContext::GetUserType() const { | 110 user_manager::UserType UserContext::GetUserType() const { |
| 106 return user_type_; | 111 return user_type_; |
| 107 } | 112 } |
| 108 | 113 |
| 109 const std::string& UserContext::GetPublicSessionLocale() const { | 114 const std::string& UserContext::GetPublicSessionLocale() const { |
| 110 return public_session_locale_; | 115 return public_session_locale_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 157 } |
| 153 | 158 |
| 154 void UserContext::SetIsUsingOAuth(bool is_using_oauth) { | 159 void UserContext::SetIsUsingOAuth(bool is_using_oauth) { |
| 155 is_using_oauth_ = is_using_oauth; | 160 is_using_oauth_ = is_using_oauth; |
| 156 } | 161 } |
| 157 | 162 |
| 158 void UserContext::SetIsUsingPin(bool is_using_pin) { | 163 void UserContext::SetIsUsingPin(bool is_using_pin) { |
| 159 is_using_pin_ = is_using_pin; | 164 is_using_pin_ = is_using_pin; |
| 160 } | 165 } |
| 161 | 166 |
| 167 void UserContext::SetIsForcingDircrypto(bool is_forcing_dircrypto) { |
| 168 is_forcing_dircrypto_ = is_forcing_dircrypto; |
| 169 } |
| 170 |
| 162 void UserContext::SetAuthFlow(AuthFlow auth_flow) { | 171 void UserContext::SetAuthFlow(AuthFlow auth_flow) { |
| 163 auth_flow_ = auth_flow; | 172 auth_flow_ = auth_flow; |
| 164 } | 173 } |
| 165 | 174 |
| 166 void UserContext::SetUserType(user_manager::UserType user_type) { | 175 void UserContext::SetUserType(user_manager::UserType user_type) { |
| 167 user_type_ = user_type; | 176 user_type_ = user_type; |
| 168 } | 177 } |
| 169 | 178 |
| 170 void UserContext::SetPublicSessionLocale(const std::string& locale) { | 179 void UserContext::SetPublicSessionLocale(const std::string& locale) { |
| 171 public_session_locale_ = locale; | 180 public_session_locale_ = locale; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 183 gaps_cookie_ = gaps_cookie; | 192 gaps_cookie_ = gaps_cookie; |
| 184 } | 193 } |
| 185 | 194 |
| 186 void UserContext::ClearSecrets() { | 195 void UserContext::ClearSecrets() { |
| 187 key_.ClearSecret(); | 196 key_.ClearSecret(); |
| 188 auth_code_.clear(); | 197 auth_code_.clear(); |
| 189 refresh_token_.clear(); | 198 refresh_token_.clear(); |
| 190 } | 199 } |
| 191 | 200 |
| 192 } // namespace chromeos | 201 } // namespace chromeos |
| OLD | NEW |