| 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_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 |
| 11 #include "ash/desktop_background/desktop_background_resources.h" | 11 #include "ash/desktop_background/desktop_background_resources.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "chrome/browser/chromeos/login/user.h" | 13 #include "chrome/browser/chromeos/login/user.h" |
| 14 #include "chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handle
r2.h" |
| 14 | 15 |
| 15 class SkBitmap; | 16 class SkBitmap; |
| 16 class FilePath; | 17 class FilePath; |
| 17 class PrefService; | 18 class PrefService; |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 class RemoveUserDelegate; | 22 class RemoveUserDelegate; |
| 22 | 23 |
| 23 // Base class for UserManagerImpl - provides a mechanism for discovering users | 24 // Base class for UserManagerImpl - provides a mechanism for discovering users |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 virtual User& GetLoggedInUser() = 0; | 134 virtual User& GetLoggedInUser() = 0; |
| 134 | 135 |
| 135 // Returns true if given display name is unique. | 136 // Returns true if given display name is unique. |
| 136 virtual bool IsDisplayNameUnique(const std::string& display_name) const = 0; | 137 virtual bool IsDisplayNameUnique(const std::string& display_name) const = 0; |
| 137 | 138 |
| 138 // Saves user's oauth token status in local state preferences. | 139 // Saves user's oauth token status in local state preferences. |
| 139 virtual void SaveUserOAuthStatus( | 140 virtual void SaveUserOAuthStatus( |
| 140 const std::string& username, | 141 const std::string& username, |
| 141 User::OAuthTokenStatus oauth_token_status) = 0; | 142 User::OAuthTokenStatus oauth_token_status) = 0; |
| 142 | 143 |
| 143 // Save user's displayed (non-canonical) email in local state preferences. | 144 // Saves user's displayed (non-canonical) email in local state preferences. |
| 144 // Ignored If there is no such user. | 145 // Ignored If there is no such user. |
| 145 virtual void SaveUserDisplayEmail(const std::string& username, | 146 virtual void SaveUserDisplayEmail(const std::string& username, |
| 146 const std::string& display_email) = 0; | 147 const std::string& display_email) = 0; |
| 147 | 148 |
| 148 // Returns the display email for user |username| if it is known (was | 149 // Returns the display email for user |username| if it is known (was |
| 149 // previously set by a |SaveUserDisplayEmail| call). | 150 // previously set by a |SaveUserDisplayEmail| call). |
| 150 // Otherwise, returns |username| itself. | 151 // Otherwise, returns |username| itself. |
| 151 virtual std::string GetUserDisplayEmail( | 152 virtual std::string GetUserDisplayEmail( |
| 152 const std::string& username) const = 0; | 153 const std::string& username) const = 0; |
| 153 | 154 |
| 154 // Returns the index of the default wallpapers saved in local state for login | 155 // Returns the index of the default wallpapers saved in local state for login |
| 155 // user if it is known (was previousely set by |SaveWallpaperToLocalState| | 156 // user if it is known (was previously set by |SaveWallpaperToLocalState| |
| 156 // call). Otherwise, returns the default wallpaper index. | 157 // call). Otherwise, returns the default wallpaper index. |
| 157 virtual int GetLoggedInUserWallpaperIndex() = 0; | 158 virtual int GetLoggedInUserWallpaperIndex() = 0; |
| 158 | 159 |
| 159 // Set |type| and |index| to the value saved in local state for logged in | 160 // Sets |type| and |index| to the value saved in local state for logged in |
| 160 // user. | 161 // user. |
| 161 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType* type, | 162 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType* type, |
| 162 int* index) = 0; | 163 int* index) = 0; |
| 163 | 164 |
| 164 // Save |type| and |index| chose by logged in user to Local State. | 165 // Saves |type| and |index| chose by logged in user to Local State. |
| 165 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type, | 166 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type, |
| 166 int index) = 0; | 167 int index) = 0; |
| 167 | 168 |
| 168 // Sets user image to the default image with index |image_index|, sends | 169 // Sets user image to the default image with index |image_index|, sends |
| 169 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 170 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
| 170 virtual void SaveUserDefaultImageIndex(const std::string& username, | 171 virtual void SaveUserDefaultImageIndex(const std::string& username, |
| 171 int image_index) = 0; | 172 int image_index) = 0; |
| 172 | 173 |
| 173 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and | 174 // Saves image to file, sends LOGIN_USER_IMAGE_CHANGED notification and |
| 174 // updates Local State. | 175 // updates Local State. |
| 175 virtual void SaveUserImage(const std::string& username, | 176 virtual void SaveUserImage(const std::string& username, |
| 176 const SkBitmap& image) = 0; | 177 const SkBitmap& image) = 0; |
| 177 | 178 |
| 179 // Updates custom wallpaper to selected layout and saves layout to Local |
| 180 // State. |
| 181 virtual void SetLoggedInUserCustomWallpaperLayout( |
| 182 ash::WallpaperLayout layout) = 0; |
| 183 |
| 178 // Tries to load user image from disk; if successful, sets it for the user, | 184 // Tries to load user image from disk; if successful, sets it for the user, |
| 179 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. | 185 // sends LOGIN_USER_IMAGE_CHANGED notification and updates Local State. |
| 180 virtual void SaveUserImageFromFile(const std::string& username, | 186 virtual void SaveUserImageFromFile(const std::string& username, |
| 181 const FilePath& path) = 0; | 187 const FilePath& path) = 0; |
| 182 | 188 |
| 189 // Tries to load user image from disk; if successful, sets it for the user, |
| 190 // and updates Local State. |
| 191 virtual void SaveUserWallpaperFromFile(const std::string& username, |
| 192 const FilePath& path, |
| 193 ash::WallpaperLayout layout, |
| 194 WallpaperDelegate* delegate) = 0; |
| 195 |
| 183 // Sets profile image as user image for |username|, sends | 196 // Sets profile image as user image for |username|, sends |
| 184 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If the user | 197 // LOGIN_USER_IMAGE_CHANGED notification and updates Local State. If the user |
| 185 // is not logged-in or the last |DownloadProfileImage| call has failed, a | 198 // is not logged-in or the last |DownloadProfileImage| call has failed, a |
| 186 // default grey avatar will be used until the user logs in and profile image | 199 // default grey avatar will be used until the user logs in and profile image |
| 187 // is downloaded successfuly. | 200 // is downloaded successfully. |
| 188 virtual void SaveUserImageFromProfileImage(const std::string& username) = 0; | 201 virtual void SaveUserImageFromProfileImage(const std::string& username) = 0; |
| 189 | 202 |
| 190 // Starts downloading the profile image for the logged-in user. | 203 // Starts downloading the profile image for the logged-in user. |
| 191 // If user's image index is |kProfileImageIndex|, newly downloaded image | 204 // If user's image index is |kProfileImageIndex|, newly downloaded image |
| 192 // is immediately set as user's current picture. | 205 // is immediately set as user's current picture. |
| 193 // |reason| is an arbitraty string (used to report UMA histograms with | 206 // |reason| is an arbitrary string (used to report UMA histograms with |
| 194 // download times). | 207 // download times). |
| 195 virtual void DownloadProfileImage(const std::string& reason) = 0; | 208 virtual void DownloadProfileImage(const std::string& reason) = 0; |
| 196 | 209 |
| 197 // Returns true if current user is an owner. | 210 // Returns true if current user is an owner. |
| 198 virtual bool IsCurrentUserOwner() const = 0; | 211 virtual bool IsCurrentUserOwner() const = 0; |
| 199 | 212 |
| 200 // Returns true if current user is not existing one (hasn't signed in before). | 213 // Returns true if current user is not existing one (hasn't signed in before). |
| 201 virtual bool IsCurrentUserNew() const = 0; | 214 virtual bool IsCurrentUserNew() const = 0; |
| 202 | 215 |
| 203 // Returns true if the current user is ephemeral. | 216 // Returns true if the current user is ephemeral. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 226 virtual void NotifyLocalStateChanged() = 0; | 239 virtual void NotifyLocalStateChanged() = 0; |
| 227 | 240 |
| 228 // Returns the result of the last successful profile image download, if any. | 241 // Returns the result of the last successful profile image download, if any. |
| 229 // Otherwise, returns an empty bitmap. | 242 // Otherwise, returns an empty bitmap. |
| 230 virtual const SkBitmap& DownloadedProfileImage() const = 0; | 243 virtual const SkBitmap& DownloadedProfileImage() const = 0; |
| 231 }; | 244 }; |
| 232 | 245 |
| 233 } // namespace chromeos | 246 } // namespace chromeos |
| 234 | 247 |
| 235 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 248 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |