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 #ifndef COMPONENTS_USER_MANAGER_USER_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_H_ |
6 #define COMPONENTS_USER_MANAGER_USER_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "components/signin/core/account_id/account_id.h" | 15 #include "components/signin/core/account_id/account_id.h" |
16 #include "components/user_manager/user_image/user_image.h" | 16 #include "components/user_manager/user_image/user_image.h" |
17 #include "components/user_manager/user_info.h" | 17 #include "components/user_manager/user_info.h" |
18 #include "components/user_manager/user_manager_export.h" | 18 #include "components/user_manager/user_manager_export.h" |
19 #include "components/user_manager/user_type.h" | 19 #include "components/user_manager/user_type.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
21 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 static User* CreateGuestUser(const AccountId& guest_account_id); | 198 static User* CreateGuestUser(const AccountId& guest_account_id); |
199 static User* CreateKioskAppUser(const AccountId& kiosk_app_account_id); | 199 static User* CreateKioskAppUser(const AccountId& kiosk_app_account_id); |
200 static User* CreateSupervisedUser(const AccountId& account_id); | 200 static User* CreateSupervisedUser(const AccountId& account_id); |
201 static User* CreatePublicAccountUser(const AccountId& account_id); | 201 static User* CreatePublicAccountUser(const AccountId& account_id); |
202 | 202 |
203 const std::string* GetAccountLocale() const { return account_locale_.get(); } | 203 const std::string* GetAccountLocale() const { return account_locale_.get(); } |
204 | 204 |
205 // Setters are private so only UserManager can call them. | 205 // Setters are private so only UserManager can call them. |
206 void SetAccountLocale(const std::string& resolved_account_locale); | 206 void SetAccountLocale(const std::string& resolved_account_locale); |
207 | 207 |
208 void SetImage(scoped_ptr<UserImage> user_image, int image_index); | 208 void SetImage(std::unique_ptr<UserImage> user_image, int image_index); |
209 | 209 |
210 void SetImageURL(const GURL& image_url); | 210 void SetImageURL(const GURL& image_url); |
211 | 211 |
212 // Sets a stub image until the next |SetImage| call. |image_index| may be | 212 // Sets a stub image until the next |SetImage| call. |image_index| may be |
213 // one of |USER_IMAGE_EXTERNAL| or |USER_IMAGE_PROFILE|. | 213 // one of |USER_IMAGE_EXTERNAL| or |USER_IMAGE_PROFILE|. |
214 // If |is_loading| is |true|, that means user image is being loaded from file. | 214 // If |is_loading| is |true|, that means user image is being loaded from file. |
215 void SetStubImage(scoped_ptr<UserImage> stub_user_image, | 215 void SetStubImage(std::unique_ptr<UserImage> stub_user_image, |
216 int image_index, | 216 int image_index, |
217 bool is_loading); | 217 bool is_loading); |
218 | 218 |
219 void set_display_name(const base::string16& display_name) { | 219 void set_display_name(const base::string16& display_name) { |
220 display_name_ = display_name; | 220 display_name_ = display_name; |
221 } | 221 } |
222 | 222 |
223 void set_given_name(const base::string16& given_name) { | 223 void set_given_name(const base::string16& given_name) { |
224 given_name_ = given_name; | 224 given_name_ = given_name; |
225 } | 225 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 virtual void SetAffiliation(bool is_affiliated); | 258 virtual void SetAffiliation(bool is_affiliated); |
259 | 259 |
260 private: | 260 private: |
261 AccountId account_id_; | 261 AccountId account_id_; |
262 base::string16 display_name_; | 262 base::string16 display_name_; |
263 base::string16 given_name_; | 263 base::string16 given_name_; |
264 // The displayed user email, defaults to |email_|. | 264 // The displayed user email, defaults to |email_|. |
265 std::string display_email_; | 265 std::string display_email_; |
266 bool using_saml_ = false; | 266 bool using_saml_ = false; |
267 scoped_ptr<UserImage> user_image_; | 267 std::unique_ptr<UserImage> user_image_; |
268 OAuthTokenStatus oauth_token_status_ = OAUTH_TOKEN_STATUS_UNKNOWN; | 268 OAuthTokenStatus oauth_token_status_ = OAUTH_TOKEN_STATUS_UNKNOWN; |
269 bool force_online_signin_ = false; | 269 bool force_online_signin_ = false; |
270 | 270 |
271 // This is set to chromeos locale if account data has been downloaded. | 271 // This is set to chromeos locale if account data has been downloaded. |
272 // (Or failed to download, but at least one download attempt finished). | 272 // (Or failed to download, but at least one download attempt finished). |
273 // An empty string indicates error in data load, or in | 273 // An empty string indicates error in data load, or in |
274 // translation of Account locale to chromeos locale. | 274 // translation of Account locale to chromeos locale. |
275 scoped_ptr<std::string> account_locale_; | 275 std::unique_ptr<std::string> account_locale_; |
276 | 276 |
277 // Used to identify homedir mount point. | 277 // Used to identify homedir mount point. |
278 std::string username_hash_; | 278 std::string username_hash_; |
279 | 279 |
280 // Either index of a default image for the user, |USER_IMAGE_EXTERNAL| or | 280 // Either index of a default image for the user, |USER_IMAGE_EXTERNAL| or |
281 // |USER_IMAGE_PROFILE|. | 281 // |USER_IMAGE_PROFILE|. |
282 int image_index_ = USER_IMAGE_INVALID; | 282 int image_index_ = USER_IMAGE_INVALID; |
283 | 283 |
284 // True if current user image is a stub set by a |SetStubImage| call. | 284 // True if current user image is a stub set by a |SetStubImage| call. |
285 bool image_is_stub_ = false; | 285 bool image_is_stub_ = false; |
(...skipping 18 matching lines...) Expand all Loading... |
304 | 304 |
305 DISALLOW_COPY_AND_ASSIGN(User); | 305 DISALLOW_COPY_AND_ASSIGN(User); |
306 }; | 306 }; |
307 | 307 |
308 // List of known users. | 308 // List of known users. |
309 using UserList = std::vector<User*>; | 309 using UserList = std::vector<User*>; |
310 | 310 |
311 } // namespace user_manager | 311 } // namespace user_manager |
312 | 312 |
313 #endif // COMPONENTS_USER_MANAGER_USER_H_ | 313 #endif // COMPONENTS_USER_MANAGER_USER_H_ |
OLD | NEW |