| 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 CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/user_manager/user.h" | 10 #include "components/user_manager/user.h" |
| 11 #include "components/user_manager/user_id.h" |
| 11 | 12 |
| 12 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class FilePath; | 16 class FilePath; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class ImageSkia; | 20 class ImageSkia; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace user_manager { | 23 namespace user_manager { |
| 23 class UserImage; | 24 class UserImage; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace chromeos { | 27 namespace chromeos { |
| 27 | 28 |
| 28 class UserImageSyncObserver; | 29 class UserImageSyncObserver; |
| 29 | 30 |
| 30 // Base class that provides a mechanism for updating user images. | 31 // Base class that provides a mechanism for updating user images. |
| 31 // There is an instance of this class for each user in the system. | 32 // There is an instance of this class for each user in the system. |
| 32 class UserImageManager { | 33 class UserImageManager { |
| 33 public: | 34 public: |
| 34 // Registers user image manager preferences. | 35 // Registers user image manager preferences. |
| 35 static void RegisterPrefs(PrefRegistrySimple* registry); | 36 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 36 | 37 |
| 37 explicit UserImageManager(const std::string& user_id); | 38 explicit UserImageManager(const user_manager::UserID& user_id); |
| 38 virtual ~UserImageManager(); | 39 virtual ~UserImageManager(); |
| 39 | 40 |
| 40 // Loads user image data from Local State. | 41 // Loads user image data from Local State. |
| 41 virtual void LoadUserImage() = 0; | 42 virtual void LoadUserImage() = 0; |
| 42 | 43 |
| 43 // Indicates that a user has just logged in. | 44 // Indicates that a user has just logged in. |
| 44 virtual void UserLoggedIn(bool user_is_new, bool user_is_local) = 0; | 45 virtual void UserLoggedIn(bool user_is_new, bool user_is_local) = 0; |
| 45 | 46 |
| 46 // Indicates that a user profile was created. | 47 // Indicates that a user profile was created. |
| 47 virtual void UserProfileCreated() = 0; | 48 virtual void UserProfileCreated() = 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 // Invoked when the external data referenced for the user has been | 96 // Invoked when the external data referenced for the user has been |
| 96 // fetched. Failed fetches are retried and the method is called only | 97 // fetched. Failed fetches are retried and the method is called only |
| 97 // when a fetch eventually succeeds. If a fetch fails permanently | 98 // when a fetch eventually succeeds. If a fetch fails permanently |
| 98 // (e.g. because the external data reference specifies an invalid URL), | 99 // (e.g. because the external data reference specifies an invalid URL), |
| 99 // the method is not called at all. | 100 // the method is not called at all. |
| 100 virtual void OnExternalDataFetched(const std::string& policy, | 101 virtual void OnExternalDataFetched(const std::string& policy, |
| 101 scoped_ptr<std::string> data) = 0; | 102 scoped_ptr<std::string> data) = 0; |
| 102 | 103 |
| 103 protected: | 104 protected: |
| 104 const std::string& user_id() const { return user_id_; } | 105 const user_manager::UserID& user_id() const { return user_id_; } |
| 105 | 106 |
| 106 // ID of user which images are managed by current instance of | 107 // ID of user which images are managed by current instance of |
| 107 // UserImageManager. | 108 // UserImageManager. |
| 108 const std::string user_id_; | 109 const user_manager::UserID user_id_; |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace chromeos | 112 } // namespace chromeos |
| 112 | 113 |
| 113 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ |
| OLD | NEW |