| 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual User& GetLoggedInUser() OVERRIDE; | 58 virtual User& GetLoggedInUser() OVERRIDE; |
| 59 virtual bool IsDisplayNameUnique( | 59 virtual bool IsDisplayNameUnique( |
| 60 const std::string& display_name) const OVERRIDE; | 60 const std::string& display_name) const OVERRIDE; |
| 61 virtual void SaveUserOAuthStatus( | 61 virtual void SaveUserOAuthStatus( |
| 62 const std::string& username, | 62 const std::string& username, |
| 63 User::OAuthTokenStatus oauth_token_status) OVERRIDE; | 63 User::OAuthTokenStatus oauth_token_status) OVERRIDE; |
| 64 virtual void SaveUserDisplayEmail(const std::string& username, | 64 virtual void SaveUserDisplayEmail(const std::string& username, |
| 65 const std::string& display_email) OVERRIDE; | 65 const std::string& display_email) OVERRIDE; |
| 66 virtual std::string GetUserDisplayEmail( | 66 virtual std::string GetUserDisplayEmail( |
| 67 const std::string& username) const OVERRIDE; | 67 const std::string& username) const OVERRIDE; |
| 68 virtual int GetUserWallpaperIndex() OVERRIDE; | 68 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE; |
| 69 virtual void SaveUserWallpaperIndex(int wallpaper_index) OVERRIDE; | 69 virtual void GetLoggedInUserWallpaperProperties(User::WallpaperType& type, |
| 70 int& index) OVERRIDE; |
| 71 virtual void SaveLoggedInUserWallpaperProperties(User::WallpaperType type, |
| 72 int index) OVERRIDE; |
| 70 virtual void SaveUserDefaultImageIndex(const std::string& username, | 73 virtual void SaveUserDefaultImageIndex(const std::string& username, |
| 71 int image_index) OVERRIDE; | 74 int image_index) OVERRIDE; |
| 72 virtual void SaveUserImage(const std::string& username, | 75 virtual void SaveUserImage(const std::string& username, |
| 73 const SkBitmap& image) OVERRIDE; | 76 const SkBitmap& image) OVERRIDE; |
| 74 virtual void SaveUserImageFromFile(const std::string& username, | 77 virtual void SaveUserImageFromFile(const std::string& username, |
| 75 const FilePath& path) OVERRIDE; | 78 const FilePath& path) OVERRIDE; |
| 76 virtual void SaveUserImageFromProfileImage( | 79 virtual void SaveUserImageFromProfileImage( |
| 77 const std::string& username) OVERRIDE; | 80 const std::string& username) OVERRIDE; |
| 78 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE; | 81 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE; |
| 79 virtual void LoadKeyStore() OVERRIDE; | 82 virtual void LoadKeyStore() OVERRIDE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 bool AreEphemeralUsersEnabled() const; | 125 bool AreEphemeralUsersEnabled() const; |
| 123 | 126 |
| 124 // Returns true if the user with the given email address is to be treated as | 127 // Returns true if the user with the given email address is to be treated as |
| 125 // ephemeral. | 128 // ephemeral. |
| 126 bool IsEphemeralUser(const std::string& email) const; | 129 bool IsEphemeralUser(const std::string& email) const; |
| 127 | 130 |
| 128 // Returns the user with the given email address if found in the persistent | 131 // Returns the user with the given email address if found in the persistent |
| 129 // list. Returns |NULL| otherwise. | 132 // list. Returns |NULL| otherwise. |
| 130 const User* FindUserInList(const std::string& email) const; | 133 const User* FindUserInList(const std::string& email) const; |
| 131 | 134 |
| 132 int FindUserWallpaperIndex(const std::string& email); | |
| 133 | |
| 134 // Makes stub user the current logged-in user (for test paths). | 135 // Makes stub user the current logged-in user (for test paths). |
| 135 void StubUserLoggedIn(); | 136 void StubUserLoggedIn(); |
| 136 | 137 |
| 137 // Notifies on new user session. | 138 // Notifies on new user session. |
| 138 void NotifyOnLogin(); | 139 void NotifyOnLogin(); |
| 139 | 140 |
| 140 // Reads user's oauth token status from local state preferences. | 141 // Reads user's oauth token status from local state preferences. |
| 141 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; | 142 User::OAuthTokenStatus LoadUserOAuthStatus(const std::string& username) const; |
| 142 | 143 |
| 143 void SetCurrentUserIsOwner(bool is_current_user_owner); | 144 void SetCurrentUserIsOwner(bool is_current_user_owner); |
| 144 | 145 |
| 145 // Sets one of the default images for the specified user and saves this | 146 // Sets one of the default images for the specified user and saves this |
| 146 // setting in local state. | 147 // setting in local state. |
| 147 // Does not send LOGIN_USER_IMAGE_CHANGED notification. | 148 // Does not send LOGIN_USER_IMAGE_CHANGED notification. |
| 148 void SetInitialUserImage(const std::string& username); | 149 void SetInitialUserImage(const std::string& username); |
| 149 | 150 |
| 150 // Sets one of the default wallpapers for the specified user and saves this | 151 // Sets one of the default wallpapers for the specified user and saves this |
| 151 // settings in local state. | 152 // settings in local state. |
| 152 void SetInitialUserWallpaper(const std::string& username); | 153 void SetInitialUserWallpaper(const std::string& username); |
| 153 | 154 |
| 155 // Migrate the old wallpaper index to a new wallpaper structure. |
| 156 // The new wallpaper structure is: |
| 157 // { WallpaperType: RANDOM|CUSTOMIZED|DEFAULT, |
| 158 // index: index of the default wallpapers } |
| 159 void MigrateWallpaperData(); |
| 160 |
| 154 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED | 161 // Sets image for user |username| and sends LOGIN_USER_IMAGE_CHANGED |
| 155 // notification unless this is a new user and image is set for the first time. | 162 // notification unless this is a new user and image is set for the first time. |
| 156 // If |image| is empty, sets a stub image for the user. | 163 // If |image| is empty, sets a stub image for the user. |
| 157 void SetUserImage(const std::string& username, | 164 void SetUserImage(const std::string& username, |
| 158 int image_index, | 165 int image_index, |
| 159 const SkBitmap& image); | 166 const SkBitmap& image); |
| 160 | 167 |
| 168 void GetUserWallpaperProperties(const std::string& username, |
| 169 User::WallpaperType& type, |
| 170 int& index); |
| 171 void SaveUserWallpaperProperties(const std::string& username, |
| 172 User::WallpaperType type, |
| 173 int index); |
| 174 |
| 161 // Saves image to file, updates local state preferences to given image index | 175 // Saves image to file, updates local state preferences to given image index |
| 162 // and sends LOGIN_USER_IMAGE_CHANGED notification. | 176 // and sends LOGIN_USER_IMAGE_CHANGED notification. |
| 163 void SaveUserImageInternal(const std::string& username, | 177 void SaveUserImageInternal(const std::string& username, |
| 164 int image_index, | 178 int image_index, |
| 165 const SkBitmap& image); | 179 const SkBitmap& image); |
| 166 | 180 |
| 167 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED | 181 // Saves image to file with specified path and sends LOGIN_USER_IMAGE_CHANGED |
| 168 // notification. Runs on FILE thread. Posts task for saving image info to | 182 // notification. Runs on FILE thread. Posts task for saving image info to |
| 169 // Local State on UI thread. | 183 // Local State on UI thread. |
| 170 void SaveImageToFile(const std::string& username, | 184 void SaveImageToFile(const std::string& username, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Cached flag of whether the currently logged-in user existed before this | 249 // Cached flag of whether the currently logged-in user existed before this |
| 236 // login. | 250 // login. |
| 237 bool is_current_user_new_; | 251 bool is_current_user_new_; |
| 238 | 252 |
| 239 // Cached flag of whether the currently logged-in user is ephemeral. Storage | 253 // Cached flag of whether the currently logged-in user is ephemeral. Storage |
| 240 // of persistent information is avoided for such users by not adding them to | 254 // of persistent information is avoided for such users by not adding them to |
| 241 // the user list in local state, not downloading their custom user images and | 255 // the user list in local state, not downloading their custom user images and |
| 242 // mounting their cryptohomes using tmpfs. | 256 // mounting their cryptohomes using tmpfs. |
| 243 bool is_current_user_ephemeral_; | 257 bool is_current_user_ephemeral_; |
| 244 | 258 |
| 245 // Cache current user selected index in memory. | 259 User::WallpaperType current_user_wallpaper_type_; |
| 260 |
| 246 int current_user_wallpaper_index_; | 261 int current_user_wallpaper_index_; |
| 247 | 262 |
| 248 // The key store for the current user has been loaded. This flag is needed to | 263 // The key store for the current user has been loaded. This flag is needed to |
| 249 // ensure that the key store will not be loaded twice in the policy recovery | 264 // ensure that the key store will not be loaded twice in the policy recovery |
| 250 // "safe-mode". | 265 // "safe-mode". |
| 251 bool key_store_loaded_; | 266 bool key_store_loaded_; |
| 252 // Cached flag indicating whether ephemeral users are enabled. Defaults to | 267 // Cached flag indicating whether ephemeral users are enabled. Defaults to |
| 253 // |false| if the value has not been read from trusted device policy yet. | 268 // |false| if the value has not been read from trusted device policy yet. |
| 254 bool ephemeral_users_enabled_; | 269 bool ephemeral_users_enabled_; |
| 255 | 270 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 285 | 300 |
| 286 // Data URL for |downloaded_profile_image_|. | 301 // Data URL for |downloaded_profile_image_|. |
| 287 std::string downloaded_profile_image_data_url_; | 302 std::string downloaded_profile_image_data_url_; |
| 288 | 303 |
| 289 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); | 304 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); |
| 290 }; | 305 }; |
| 291 | 306 |
| 292 } // namespace chromeos | 307 } // namespace chromeos |
| 293 | 308 |
| 294 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ | 309 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ |
| OLD | NEW |