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 "chromeos/login/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 auth_flow_(other.auth_flow_), | 21 auth_flow_(other.auth_flow_), |
21 user_type_(other.user_type_), | 22 user_type_(other.user_type_), |
22 public_session_locale_(other.public_session_locale_), | 23 public_session_locale_(other.public_session_locale_), |
23 public_session_input_method_(other.public_session_input_method_), | 24 public_session_input_method_(other.public_session_input_method_), |
24 device_id_(other.device_id_), | 25 device_id_(other.device_id_), |
25 gaps_cookie_(other.gaps_cookie_) {} | 26 gaps_cookie_(other.gaps_cookie_) {} |
26 | 27 |
27 UserContext::UserContext(const AccountId& account_id) | 28 UserContext::UserContext(const AccountId& account_id) |
28 : account_id_(account_id) { | 29 : account_id_(account_id) { |
29 account_id_.SetUserEmail( | 30 account_id_.SetUserEmail( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 87 } |
87 | 88 |
88 const std::string& UserContext::GetUserIDHash() const { | 89 const std::string& UserContext::GetUserIDHash() const { |
89 return user_id_hash_; | 90 return user_id_hash_; |
90 } | 91 } |
91 | 92 |
92 bool UserContext::IsUsingOAuth() const { | 93 bool UserContext::IsUsingOAuth() const { |
93 return is_using_oauth_; | 94 return is_using_oauth_; |
94 } | 95 } |
95 | 96 |
| 97 bool UserContext::IsUsingPin() const { |
| 98 return is_using_pin_; |
| 99 } |
| 100 |
96 UserContext::AuthFlow UserContext::GetAuthFlow() const { | 101 UserContext::AuthFlow UserContext::GetAuthFlow() const { |
97 return auth_flow_; | 102 return auth_flow_; |
98 } | 103 } |
99 | 104 |
100 user_manager::UserType UserContext::GetUserType() const { | 105 user_manager::UserType UserContext::GetUserType() const { |
101 return user_type_; | 106 return user_type_; |
102 } | 107 } |
103 | 108 |
104 const std::string& UserContext::GetPublicSessionLocale() const { | 109 const std::string& UserContext::GetPublicSessionLocale() const { |
105 return public_session_locale_; | 110 return public_session_locale_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 148 } |
144 | 149 |
145 void UserContext::SetUserIDHash(const std::string& user_id_hash) { | 150 void UserContext::SetUserIDHash(const std::string& user_id_hash) { |
146 user_id_hash_ = user_id_hash; | 151 user_id_hash_ = user_id_hash; |
147 } | 152 } |
148 | 153 |
149 void UserContext::SetIsUsingOAuth(bool is_using_oauth) { | 154 void UserContext::SetIsUsingOAuth(bool is_using_oauth) { |
150 is_using_oauth_ = is_using_oauth; | 155 is_using_oauth_ = is_using_oauth; |
151 } | 156 } |
152 | 157 |
| 158 void UserContext::SetIsUsingPin(bool is_using_pin) { |
| 159 is_using_pin_ = is_using_pin; |
| 160 } |
| 161 |
153 void UserContext::SetAuthFlow(AuthFlow auth_flow) { | 162 void UserContext::SetAuthFlow(AuthFlow auth_flow) { |
154 auth_flow_ = auth_flow; | 163 auth_flow_ = auth_flow; |
155 } | 164 } |
156 | 165 |
157 void UserContext::SetUserType(user_manager::UserType user_type) { | 166 void UserContext::SetUserType(user_manager::UserType user_type) { |
158 user_type_ = user_type; | 167 user_type_ = user_type; |
159 } | 168 } |
160 | 169 |
161 void UserContext::SetPublicSessionLocale(const std::string& locale) { | 170 void UserContext::SetPublicSessionLocale(const std::string& locale) { |
162 public_session_locale_ = locale; | 171 public_session_locale_ = locale; |
(...skipping 11 matching lines...) Expand all Loading... |
174 gaps_cookie_ = gaps_cookie; | 183 gaps_cookie_ = gaps_cookie; |
175 } | 184 } |
176 | 185 |
177 void UserContext::ClearSecrets() { | 186 void UserContext::ClearSecrets() { |
178 key_.ClearSecret(); | 187 key_.ClearSecret(); |
179 auth_code_.clear(); | 188 auth_code_.clear(); |
180 refresh_token_.clear(); | 189 refresh_token_.clear(); |
181 } | 190 } |
182 | 191 |
183 } // namespace chromeos | 192 } // namespace chromeos |
OLD | NEW |