| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Indicates that a user profile was created. | 46 // Indicates that a user profile was created. |
| 47 virtual void UserProfileCreated() = 0; | 47 virtual void UserProfileCreated() = 0; |
| 48 | 48 |
| 49 // Sets user image to the default image with index |image_index|, sends | 49 // Sets user image to the default image with index |image_index|, sends |
| 50 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 50 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
| 51 virtual void SaveUserDefaultImageIndex(int image_index) = 0; | 51 virtual void SaveUserDefaultImageIndex(int image_index) = 0; |
| 52 | 52 |
| 53 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and | 53 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and |
| 54 // updates Local State. | 54 // updates Local State. |
| 55 virtual void SaveUserImage( | 55 virtual void SaveUserImage( |
| 56 scoped_ptr<user_manager::UserImage> user_image) = 0; | 56 std::unique_ptr<user_manager::UserImage> user_image) = 0; |
| 57 | 57 |
| 58 // Tries to load user image from disk; if successful, sets it for the user, | 58 // Tries to load user image from disk; if successful, sets it for the user, |
| 59 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 59 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
| 60 virtual void SaveUserImageFromFile(const base::FilePath& path) = 0; | 60 virtual void SaveUserImageFromFile(const base::FilePath& path) = 0; |
| 61 | 61 |
| 62 // Sets profile image as user image for the user, sends | 62 // Sets profile image as user image for the user, sends |
| 63 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If | 63 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If |
| 64 // the user is not logged-in or the last |DownloadProfileImage| call | 64 // the user is not logged-in or the last |DownloadProfileImage| call |
| 65 // has failed, a default grey avatar will be used until the user logs | 65 // has failed, a default grey avatar will be used until the user logs |
| 66 // in and profile image is downloaded successfully. | 66 // in and profile image is downloaded successfully. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 // Invoked when the external data reference is cleared for the user. | 93 // Invoked when the external data reference is cleared for the user. |
| 94 virtual void OnExternalDataCleared(const std::string& policy) = 0; | 94 virtual void OnExternalDataCleared(const std::string& policy) = 0; |
| 95 | 95 |
| 96 // Invoked when the external data referenced for the user has been | 96 // Invoked when the external data referenced for the user has been |
| 97 // fetched. Failed fetches are retried and the method is called only | 97 // fetched. Failed fetches are retried and the method is called only |
| 98 // when a fetch eventually succeeds. If a fetch fails permanently | 98 // when a fetch eventually succeeds. If a fetch fails permanently |
| 99 // (e.g. because the external data reference specifies an invalid URL), | 99 // (e.g. because the external data reference specifies an invalid URL), |
| 100 // the method is not called at all. | 100 // the method is not called at all. |
| 101 virtual void OnExternalDataFetched(const std::string& policy, | 101 virtual void OnExternalDataFetched(const std::string& policy, |
| 102 scoped_ptr<std::string> data) = 0; | 102 std::unique_ptr<std::string> data) = 0; |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 const std::string& user_id() const { return user_id_; } | 105 const std::string& user_id() const { return user_id_; } |
| 106 | 106 |
| 107 // ID of user which images are managed by current instance of | 107 // ID of user which images are managed by current instance of |
| 108 // UserImageManager. | 108 // UserImageManager. |
| 109 const std::string user_id_; | 109 const std::string user_id_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace chromeos | 112 } // namespace chromeos |
| 113 | 113 |
| 114 #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 |