| OLD | NEW |
| 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 #include <vector> | 10 #include <vector> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 virtual bool current_user_is_owner() const; | 162 virtual bool current_user_is_owner() const; |
| 163 virtual void set_current_user_is_owner(bool current_user_is_owner); | 163 virtual void set_current_user_is_owner(bool current_user_is_owner); |
| 164 | 164 |
| 165 // Accessor for current_user_is_new_. | 165 // Accessor for current_user_is_new_. |
| 166 bool current_user_is_new() const { | 166 bool current_user_is_new() const { |
| 167 return current_user_is_new_; | 167 return current_user_is_new_; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool user_is_logged_in() const { return user_is_logged_in_; } | 170 bool user_is_logged_in() const { return user_is_logged_in_; } |
| 171 | 171 |
| 172 void set_offline_login(bool value) { offline_login_ = value; } |
| 173 bool offline_login() { return offline_login_; } |
| 174 |
| 172 // Returns true if we're logged in as a Guest. | 175 // Returns true if we're logged in as a Guest. |
| 173 bool IsLoggedInAsGuest() const; | 176 bool IsLoggedInAsGuest() const; |
| 174 | 177 |
| 175 // Interface that observers of UserManager must implement in order | 178 // Interface that observers of UserManager must implement in order |
| 176 // to receive notification when local state preferences is changed | 179 // to receive notification when local state preferences is changed |
| 177 class Observer { | 180 class Observer { |
| 178 public: | 181 public: |
| 179 // Called when the local state preferences is changed | 182 // Called when the local state preferences is changed |
| 180 virtual void LocalStateChanged(UserManager* user_manager) = 0; | 183 virtual void LocalStateChanged(UserManager* user_manager) = 0; |
| 181 | 184 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 206 // Loads user image from its file. | 209 // Loads user image from its file. |
| 207 scoped_refptr<UserImageLoader> image_loader_; | 210 scoped_refptr<UserImageLoader> image_loader_; |
| 208 | 211 |
| 209 // Cache for user images. Stores image for each username. | 212 // Cache for user images. Stores image for each username. |
| 210 typedef base::hash_map<std::string, SkBitmap> UserImages; | 213 typedef base::hash_map<std::string, SkBitmap> UserImages; |
| 211 mutable UserImages user_images_; | 214 mutable UserImages user_images_; |
| 212 | 215 |
| 213 // The logged-in user. | 216 // The logged-in user. |
| 214 User logged_in_user_; | 217 User logged_in_user_; |
| 215 | 218 |
| 219 // Current user is logged in offline. Valid only for WebUI login flow. |
| 220 bool offline_login_; |
| 221 |
| 216 // Cached flag of whether currently logged-in user is owner or not. | 222 // Cached flag of whether currently logged-in user is owner or not. |
| 217 // May be accessed on different threads, requires locking. | 223 // May be accessed on different threads, requires locking. |
| 218 bool current_user_is_owner_; | 224 bool current_user_is_owner_; |
| 219 mutable base::Lock current_user_is_owner_lock_; | 225 mutable base::Lock current_user_is_owner_lock_; |
| 220 | 226 |
| 221 // Cached flag of whether the currently logged-in user existed before this | 227 // Cached flag of whether the currently logged-in user existed before this |
| 222 // login. | 228 // login. |
| 223 bool current_user_is_new_; | 229 bool current_user_is_new_; |
| 224 | 230 |
| 225 // Cached flag of whether any user is logged in at the moment. | 231 // Cached flag of whether any user is logged in at the moment. |
| 226 bool user_is_logged_in_; | 232 bool user_is_logged_in_; |
| 227 | 233 |
| 228 NotificationRegistrar registrar_; | 234 NotificationRegistrar registrar_; |
| 229 | 235 |
| 230 friend struct base::DefaultLazyInstanceTraits<UserManager>; | 236 friend struct base::DefaultLazyInstanceTraits<UserManager>; |
| 231 | 237 |
| 232 ObserverList<Observer> observer_list_; | 238 ObserverList<Observer> observer_list_; |
| 233 | 239 |
| 234 DISALLOW_COPY_AND_ASSIGN(UserManager); | 240 DISALLOW_COPY_AND_ASSIGN(UserManager); |
| 235 }; | 241 }; |
| 236 | 242 |
| 237 typedef std::vector<UserManager::User> UserVector; | 243 typedef std::vector<UserManager::User> UserVector; |
| 238 | 244 |
| 239 } // namespace chromeos | 245 } // namespace chromeos |
| 240 | 246 |
| 241 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 247 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |