OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_USER_IMAGE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
11 | 11 |
| 12 class PrefServiceSimple; |
| 13 |
| 14 namespace base { |
12 class FilePath; | 15 class FilePath; |
13 class PrefServiceSimple; | 16 } |
14 | 17 |
15 namespace gfx { | 18 namespace gfx { |
16 class ImageSkia; | 19 class ImageSkia; |
17 } | 20 } |
18 | 21 |
19 namespace chromeos { | 22 namespace chromeos { |
20 | 23 |
21 class UserImage; | 24 class UserImage; |
22 | 25 |
23 // Base class that provides a mechanism for updating user images. | 26 // Base class that provides a mechanism for updating user images. |
(...skipping 18 matching lines...) Expand all Loading... |
42 int image_index) = 0; | 45 int image_index) = 0; |
43 | 46 |
44 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and | 47 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and |
45 // updates Local State. | 48 // updates Local State. |
46 virtual void SaveUserImage(const std::string& username, | 49 virtual void SaveUserImage(const std::string& username, |
47 const UserImage& user_image) = 0; | 50 const UserImage& user_image) = 0; |
48 | 51 |
49 // Tries to load user image from disk; if successful, sets it for the user, | 52 // Tries to load user image from disk; if successful, sets it for the user, |
50 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 53 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
51 virtual void SaveUserImageFromFile(const std::string& username, | 54 virtual void SaveUserImageFromFile(const std::string& username, |
52 const FilePath& path) = 0; | 55 const base::FilePath& path) = 0; |
53 | 56 |
54 // Sets profile image as user image for |username|, sends | 57 // Sets profile image as user image for |username|, sends |
55 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If the user | 58 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If the user |
56 // is not logged-in or the last |DownloadProfileImage| call has failed, a | 59 // is not logged-in or the last |DownloadProfileImage| call has failed, a |
57 // default grey avatar will be used until the user logs in and profile image | 60 // default grey avatar will be used until the user logs in and profile image |
58 // is downloaded successfully. | 61 // is downloaded successfully. |
59 virtual void SaveUserImageFromProfileImage(const std::string& username) = 0; | 62 virtual void SaveUserImageFromProfileImage(const std::string& username) = 0; |
60 | 63 |
61 // Deletes user image and the corresponding image file. | 64 // Deletes user image and the corresponding image file. |
62 virtual void DeleteUserImage(const std::string& username) = 0; | 65 virtual void DeleteUserImage(const std::string& username) = 0; |
63 | 66 |
64 // Starts downloading the profile image for the logged-in user. | 67 // Starts downloading the profile image for the logged-in user. |
65 // If user's image index is |kProfileImageIndex|, newly downloaded image | 68 // If user's image index is |kProfileImageIndex|, newly downloaded image |
66 // is immediately set as user's current picture. | 69 // is immediately set as user's current picture. |
67 // |reason| is an arbitrary string (used to report UMA histograms with | 70 // |reason| is an arbitrary string (used to report UMA histograms with |
68 // download times). | 71 // download times). |
69 virtual void DownloadProfileImage(const std::string& reason) = 0; | 72 virtual void DownloadProfileImage(const std::string& reason) = 0; |
70 | 73 |
71 // Returns the result of the last successful profile image download, if any. | 74 // Returns the result of the last successful profile image download, if any. |
72 // Otherwise, returns an empty bitmap. | 75 // Otherwise, returns an empty bitmap. |
73 virtual const gfx::ImageSkia& DownloadedProfileImage() const = 0; | 76 virtual const gfx::ImageSkia& DownloadedProfileImage() const = 0; |
74 }; | 77 }; |
75 | 78 |
76 } // namespace chromeos | 79 } // namespace chromeos |
77 | 80 |
78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_MANAGER_H_ | 81 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_MANAGER_H_ |
OLD | NEW |