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

Side by Side Diff: chrome/browser/chromeos/login/user_manager.h

Issue 8541002: [cros] Initial user image loading and repeated profile image loading fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Returns true if given display name is unique. 78 // Returns true if given display name is unique.
79 bool IsDisplayNameUnique(const std::string& display_name) const; 79 bool IsDisplayNameUnique(const std::string& display_name) const;
80 80
81 // Saves user's oauth token status in local state preferences. 81 // Saves user's oauth token status in local state preferences.
82 void SaveUserOAuthStatus(const std::string& username, 82 void SaveUserOAuthStatus(const std::string& username,
83 User::OAuthTokenStatus oauth_token_status); 83 User::OAuthTokenStatus oauth_token_status);
84 84
85 // Gets user's oauth token status in local state preferences. 85 // Gets user's oauth token status in local state preferences.
86 User::OAuthTokenStatus GetUserOAuthStatus(const std::string& username) const; 86 User::OAuthTokenStatus GetUserOAuthStatus(const std::string& username) const;
87 87
88 // Sets user image to the default image with index |image_index|, updates 88 // Sets user image to the default image with index |image_index|, sends
89 // local state preferences and sends LOGIN_USER_IMAGE_CHANGED notification. 89 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State.
90 void SaveUserDefaultImageIndex(const std::string& username, int image_index); 90 void SaveUserDefaultImageIndex(const std::string& username, int image_index);
91 91
92 // Saves image to file, updates local state preferences and sends 92 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and
93 // LOGIN_USER_IMAGE_CHANGED notification. 93 // updates Local State.
94 void SaveUserImage(const std::string& username, const SkBitmap& image); 94 void SaveUserImage(const std::string& username, const SkBitmap& image);
95 95
96 // Tries to load user image from disk and sets it for the user; updates local 96 // Tries to load user image from disk; if successful, sets it for the user,
97 // state preferences and sends LOGIN_USER_IMAGE_CHANGED notification. 97 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State.
98 void SaveUserImageFromFile(const std::string& username, const FilePath& path); 98 void SaveUserImageFromFile(const std::string& username, const FilePath& path);
99 99
100 // Sets profile image as user image for |username|, updates local state 100 // Sets profile image as user image for |username|, sends
101 // preferences and sends LOGIN_USER_IMAGE_CHANGED notification. 101 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If the user
102 // If the user is not logged-in or the last |DownloadProfileImage| call 102 // is not logged-in or the last |DownloadProfileImage| call has failed, a
103 // has failed, a default grey avatar will be used until the user logs in 103 // default grey avatar will be used until the user logs in and profile image
104 // and profile image is downloaded successfuly. 104 // is downloaded successfuly.
105 void SaveUserImageFromProfileImage(const std::string& username); 105 void SaveUserImageFromProfileImage(const std::string& username);
106 106
107 // Starts downloading the profile image for the logged-in user. 107 // Starts downloading the profile image for the logged-in user.
108 // If user's image index is |kProfileImageIndex|, newly downloaded image 108 // If user's image index is |kProfileImageIndex|, newly downloaded image
109 // is immediately set as user's current picture. 109 // is immediately set as user's current picture.
110 void DownloadProfileImage(); 110 void DownloadProfileImage();
111 111
112 // content::NotificationObserver implementation. 112 // content::NotificationObserver implementation.
113 virtual void Observe(int type, 113 virtual void Observe(int type,
114 const content::NotificationSource& source, 114 const content::NotificationSource& source,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void EnsureUsersLoaded(); 166 void EnsureUsersLoaded();
167 167
168 // Makes stub user the current logged-in user (for test paths). 168 // Makes stub user the current logged-in user (for test paths).
169 void StubUserLoggedIn(); 169 void StubUserLoggedIn();
170 170
171 // Notifies on new user session. 171 // Notifies on new user session.
172 void NotifyOnLogin(); 172 void NotifyOnLogin();
173 173
174 // Sets one of the default images for the specified user and saves this 174 // Sets one of the default images for the specified user and saves this
175 // setting in local state. 175 // setting in local state.
176 // Does not send LOGIN_USER_IMAGE_CHANGED notification.
176 void SetInitialUserImage(const std::string& username); 177 void SetInitialUserImage(const std::string& username);
177 178
178 // Sets image for user |username|. 179 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED
180 // notification unless this is a new user and image is set for the first time.
179 void SetUserImage(const std::string& username, 181 void SetUserImage(const std::string& username,
180 int image_index, 182 int image_index,
181 const SkBitmap& image); 183 const SkBitmap& image);
182 184
183 // Saves image to file, updates local state preferences to given image index 185 // Saves image to file, updates local state preferences to given image index
184 // and sends LOGIN_USER_IMAGE_CHANGED notification. 186 // and sends LOGIN_USER_IMAGE_CHANGED notification.
185 void SaveUserImageInternal(const std::string& username, 187 void SaveUserImageInternal(const std::string& username,
186 int image_index, 188 int image_index,
187 const SkBitmap& image); 189 const SkBitmap& image);
188 190
189 // Saves image to file with specified path. Runs on FILE thread. 191 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED
190 // Posts task for saving image info to local state on UI thread. 192 // notification. Runs on FILE thread. Posts task for saving image info to
193 // Local State on UI thread.
191 void SaveImageToFile(const std::string& username, 194 void SaveImageToFile(const std::string& username,
192 const SkBitmap& image, 195 const SkBitmap& image,
193 const FilePath& image_path, 196 const FilePath& image_path,
194 int image_index); 197 int image_index);
195 198
196 // Stores path to the image and its index in local state. Runs on UI thread. 199 // Stores path to the image and its index in local state. Runs on UI thread.
197 // If |is_async| is true, it has been posted from the FILE thread after 200 // If |is_async| is true, it has been posted from the FILE thread after
198 // saving the image. 201 // saving the image.
199 void SaveImageToLocalState(const std::string& username, 202 void SaveImageToLocalState(const std::string& username,
200 const std::string& image_path, 203 const std::string& image_path,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 280
278 // Data URL for |downloaded_profile_image_|. 281 // Data URL for |downloaded_profile_image_|.
279 std::string downloaded_profile_image_data_url_; 282 std::string downloaded_profile_image_data_url_;
280 283
281 DISALLOW_COPY_AND_ASSIGN(UserManager); 284 DISALLOW_COPY_AND_ASSIGN(UserManager);
282 }; 285 };
283 286
284 } // namespace chromeos 287 } // namespace chromeos
285 288
286 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ 289 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/profile_image_downloader.cc ('k') | chrome/browser/chromeos/login/user_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698