| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/synchronization/lock.h" |
| 15 #include "chrome/browser/chromeos/login/user_image_loader.h" | 16 #include "chrome/browser/chromeos/login/user_image_loader.h" |
| 16 #include "content/common/notification_observer.h" | 17 #include "content/common/notification_observer.h" |
| 17 #include "content/common/notification_registrar.h" | 18 #include "content/common/notification_registrar.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 | 20 |
| 20 class FilePath; | 21 class FilePath; |
| 21 class PrefService; | 22 class PrefService; |
| 22 | 23 |
| 24 namespace base { |
| 25 template<typename> struct DefaultLazyInstanceTraits; |
| 26 } |
| 27 |
| 23 namespace chromeos { | 28 namespace chromeos { |
| 24 class RemoveUserDelegate; | 29 class RemoveUserDelegate; |
| 25 | 30 |
| 26 // This class provides a mechanism for discovering users who have logged | 31 // This class provides a mechanism for discovering users who have logged |
| 27 // into this chromium os device before and updating that list. | 32 // into this chromium os device before and updating that list. |
| 28 class UserManager : public UserImageLoader::Delegate, | 33 class UserManager : public UserImageLoader::Delegate, |
| 29 public NotificationObserver { | 34 public NotificationObserver { |
| 30 public: | 35 public: |
| 31 // A class representing information about a previously logged in user. | 36 // A class representing information about a previously logged in user. |
| 32 class User { | 37 class User { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 scoped_refptr<UserImageLoader> image_loader_; | 147 scoped_refptr<UserImageLoader> image_loader_; |
| 143 | 148 |
| 144 // Cache for user images. Stores image for each username. | 149 // Cache for user images. Stores image for each username. |
| 145 typedef base::hash_map<std::string, SkBitmap> UserImages; | 150 typedef base::hash_map<std::string, SkBitmap> UserImages; |
| 146 mutable UserImages user_images_; | 151 mutable UserImages user_images_; |
| 147 | 152 |
| 148 // The logged-in user. | 153 // The logged-in user. |
| 149 User logged_in_user_; | 154 User logged_in_user_; |
| 150 | 155 |
| 151 // Cached flag of whether currently logged-in user is owner or not. | 156 // Cached flag of whether currently logged-in user is owner or not. |
| 157 // May be accessed on different threads, requires locking. |
| 152 bool current_user_is_owner_; | 158 bool current_user_is_owner_; |
| 159 mutable base::Lock current_user_is_owner_lock_; |
| 153 | 160 |
| 154 // Cached flag of whether the currently logged-in user existed before this | 161 // Cached flag of whether the currently logged-in user existed before this |
| 155 // login. | 162 // login. |
| 156 bool current_user_is_new_; | 163 bool current_user_is_new_; |
| 157 | 164 |
| 158 // Cached flag of whether any user is logged in at the moment. | 165 // Cached flag of whether any user is logged in at the moment. |
| 159 bool user_is_logged_in_; | 166 bool user_is_logged_in_; |
| 160 | 167 |
| 161 NotificationRegistrar registrar_; | 168 NotificationRegistrar registrar_; |
| 162 | 169 |
| 170 friend struct base::DefaultLazyInstanceTraits<UserManager>; |
| 171 |
| 163 DISALLOW_COPY_AND_ASSIGN(UserManager); | 172 DISALLOW_COPY_AND_ASSIGN(UserManager); |
| 164 }; | 173 }; |
| 165 | 174 |
| 166 typedef std::vector<UserManager::User> UserVector; | 175 typedef std::vector<UserManager::User> UserVector; |
| 167 | 176 |
| 168 } // namespace chromeos | 177 } // namespace chromeos |
| 169 | 178 |
| 170 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 179 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
| OLD | NEW |