Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: chrome/browser/chromeos/login/users/avatar/user_image_manager.h

Issue 376193002: Move UserImage to user_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/chromeos/login/users/user.h" 10 #include "chrome/browser/chromeos/login/users/user.h"
11 11
12 class PrefRegistrySimple; 12 class PrefRegistrySimple;
13 13
14 namespace base { 14 namespace base {
15 class FilePath; 15 class FilePath;
16 } 16 }
17 17
18 namespace gfx { 18 namespace gfx {
19 class ImageSkia; 19 class ImageSkia;
20 } 20 }
21 21
22 namespace user_manager {
23 class UserImage;
24 }
25
22 namespace chromeos { 26 namespace chromeos {
23 27
24 class UserImage;
25 class UserImageSyncObserver; 28 class UserImageSyncObserver;
26 29
27 // Base class that provides a mechanism for updating user images. 30 // Base class that provides a mechanism for updating user images.
28 // There is an instance of this class for each user in the system. 31 // There is an instance of this class for each user in the system.
29 class UserImageManager { 32 class UserImageManager {
30 public: 33 public:
31 // Registers user image manager preferences. 34 // Registers user image manager preferences.
32 static void RegisterPrefs(PrefRegistrySimple* registry); 35 static void RegisterPrefs(PrefRegistrySimple* registry);
33 36
34 explicit UserImageManager(const std::string& user_id); 37 explicit UserImageManager(const std::string& user_id);
35 virtual ~UserImageManager(); 38 virtual ~UserImageManager();
36 39
37 // Loads user image data from Local State. 40 // Loads user image data from Local State.
38 virtual void LoadUserImage() = 0; 41 virtual void LoadUserImage() = 0;
39 42
40 // Indicates that a user has just logged in. 43 // Indicates that a user has just logged in.
41 virtual void UserLoggedIn(bool user_is_new, bool user_is_local) = 0; 44 virtual void UserLoggedIn(bool user_is_new, bool user_is_local) = 0;
42 45
43 // Sets user image to the default image with index |image_index|, sends 46 // Sets user image to the default image with index |image_index|, sends
44 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. 47 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State.
45 virtual void SaveUserDefaultImageIndex(int image_index) = 0; 48 virtual void SaveUserDefaultImageIndex(int image_index) = 0;
46 49
47 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and 50 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and
48 // updates Local State. 51 // updates Local State.
49 virtual void SaveUserImage(const UserImage& user_image) = 0; 52 virtual void SaveUserImage(const user_manager::UserImage& user_image) = 0;
50 53
51 // Tries to load user image from disk; if successful, sets it for the user, 54 // Tries to load user image from disk; if successful, sets it for the user,
52 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. 55 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State.
53 virtual void SaveUserImageFromFile(const base::FilePath& path) = 0; 56 virtual void SaveUserImageFromFile(const base::FilePath& path) = 0;
54 57
55 // Sets profile image as user image for the user, sends 58 // Sets profile image as user image for the user, sends
56 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If 59 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If
57 // the user is not logged-in or the last |DownloadProfileImage| call 60 // the user is not logged-in or the last |DownloadProfileImage| call
58 // has failed, a default grey avatar will be used until the user logs 61 // has failed, a default grey avatar will be used until the user logs
59 // in and profile image is downloaded successfully. 62 // in and profile image is downloaded successfully.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::string& user_id() const { return user_id_; } 101 const std::string& user_id() const { return user_id_; }
99 102
100 // ID of user which images are managed by current instance of 103 // ID of user which images are managed by current instance of
101 // UserImageManager. 104 // UserImageManager.
102 const std::string user_id_; 105 const std::string user_id_;
103 }; 106 };
104 107
105 } // namespace chromeos 108 } // namespace chromeos
106 109
107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_ 110 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698