OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool IsUserNonCryptohomeDataEphemeral( | 98 bool IsUserNonCryptohomeDataEphemeral( |
99 const std::string& user_id) const override; | 99 const std::string& user_id) const override; |
100 void AddObserver(UserManager::Observer* obs) override; | 100 void AddObserver(UserManager::Observer* obs) override; |
101 void RemoveObserver(UserManager::Observer* obs) override; | 101 void RemoveObserver(UserManager::Observer* obs) override; |
102 void AddSessionStateObserver( | 102 void AddSessionStateObserver( |
103 UserManager::UserSessionStateObserver* obs) override; | 103 UserManager::UserSessionStateObserver* obs) override; |
104 void RemoveSessionStateObserver( | 104 void RemoveSessionStateObserver( |
105 UserManager::UserSessionStateObserver* obs) override; | 105 UserManager::UserSessionStateObserver* obs) override; |
106 void NotifyLocalStateChanged() override; | 106 void NotifyLocalStateChanged() override; |
107 void ChangeUserChildStatus(User* user, bool is_child) override; | 107 void ChangeUserChildStatus(User* user, bool is_child) override; |
| 108 bool FindKnownUserPrefs(const UserID& user_id, |
| 109 const base::DictionaryValue** out_value) override; |
| 110 void UpdateKnownUserPrefs(const UserID& user_id, |
| 111 const base::DictionaryValue& values, |
| 112 bool clear) override; |
108 | 113 |
109 virtual void SetIsCurrentUserNew(bool is_new); | 114 virtual void SetIsCurrentUserNew(bool is_new); |
110 | 115 |
111 // TODO(xiyuan): Figure out a better way to expose this info. | 116 // TODO(xiyuan): Figure out a better way to expose this info. |
112 virtual bool HasPendingBootstrap(const std::string& user_id) const; | 117 virtual bool HasPendingBootstrap(const std::string& user_id) const; |
113 | 118 |
114 // Helper function that copies users from |users_list| to |users_vector| and | 119 // Helper function that copies users from |users_list| to |users_vector| and |
115 // |users_set|. Duplicates and users already present in |existing_users| are | 120 // |users_set|. Duplicates and users already present in |existing_users| are |
116 // skipped. | 121 // skipped. |
117 static void ParseUserList(const base::ListValue& users_list, | 122 static void ParseUserList(const base::ListValue& users_list, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Implementation for RemoveUser method. This is an asynchronous part of the | 200 // Implementation for RemoveUser method. This is an asynchronous part of the |
196 // method, that verifies that owner will not get deleted, and calls | 201 // method, that verifies that owner will not get deleted, and calls |
197 // |RemoveNonOwnerUserInternal|. | 202 // |RemoveNonOwnerUserInternal|. |
198 virtual void RemoveUserInternal(const std::string& user_email, | 203 virtual void RemoveUserInternal(const std::string& user_email, |
199 RemoveUserDelegate* delegate); | 204 RemoveUserDelegate* delegate); |
200 | 205 |
201 // Removes data stored or cached outside the user's cryptohome (wallpaper, | 206 // Removes data stored or cached outside the user's cryptohome (wallpaper, |
202 // avatar, OAuth token status, display name, display email). | 207 // avatar, OAuth token status, display name, display email). |
203 virtual void RemoveNonCryptohomeData(const std::string& user_id); | 208 virtual void RemoveNonCryptohomeData(const std::string& user_id); |
204 | 209 |
205 // Methods for storage/retrieval of per-user properties in Local State. | |
206 | |
207 // Performs a lookup of properties associated with |user_id|. If found, | |
208 // returns |true| and fills |out_value|. |out_value| can be NULL, if | |
209 // only existence check is required. | |
210 bool FindKnowUserPrefs(const UserID& user_id, | |
211 const base::DictionaryValue** out_value); | |
212 | |
213 // Updates (or creates) properties associated with |user_id| based | |
214 // on |values|. |clear| defines if existing properties are cleared (|true|) | |
215 // or if it is just a incremental update (|false|). | |
216 void UpdateKnowUserPrefs(const UserID& user_id, | |
217 const base::DictionaryValue& values, | |
218 bool clear); | |
219 | |
220 // Check for a particular user type. | 210 // Check for a particular user type. |
221 | 211 |
222 // Returns true if |user_id| represents demo app. | 212 // Returns true if |user_id| represents demo app. |
223 virtual bool IsDemoApp(const std::string& user_id) const = 0; | 213 virtual bool IsDemoApp(const std::string& user_id) const = 0; |
224 | 214 |
225 // Returns true if |user_id| represents kiosk app. | 215 // Returns true if |user_id| represents kiosk app. |
226 virtual bool IsKioskApp(const std::string& user_id) const = 0; | 216 virtual bool IsKioskApp(const std::string& user_id) const = 0; |
227 | 217 |
228 // Returns true if |user_id| represents public account that has been marked | 218 // Returns true if |user_id| represents public account that has been marked |
229 // for deletion. | 219 // for deletion. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 326 |
337 // Sets account locale for user with id |user_id|. | 327 // Sets account locale for user with id |user_id|. |
338 virtual void UpdateUserAccountLocale(const std::string& user_id, | 328 virtual void UpdateUserAccountLocale(const std::string& user_id, |
339 const std::string& locale); | 329 const std::string& locale); |
340 | 330 |
341 // Updates user account after locale was resolved. | 331 // Updates user account after locale was resolved. |
342 void DoUpdateAccountLocale(const std::string& user_id, | 332 void DoUpdateAccountLocale(const std::string& user_id, |
343 scoped_ptr<std::string> resolved_locale); | 333 scoped_ptr<std::string> resolved_locale); |
344 | 334 |
345 // Removes all user preferences associated with |user_id|. | 335 // Removes all user preferences associated with |user_id|. |
346 void RemoveKnowUserPrefs(const UserID& user_id); | 336 void RemoveKnownUserPrefs(const UserID& user_id); |
347 | 337 |
348 // Indicates stage of loading user from prefs. | 338 // Indicates stage of loading user from prefs. |
349 UserLoadStage user_loading_stage_; | 339 UserLoadStage user_loading_stage_; |
350 | 340 |
351 // True if SessionStarted() has been called. | 341 // True if SessionStarted() has been called. |
352 bool session_started_; | 342 bool session_started_; |
353 | 343 |
354 // Cached flag of whether currently logged-in user is owner or not. | 344 // Cached flag of whether currently logged-in user is owner or not. |
355 // May be accessed on different threads, requires locking. | 345 // May be accessed on different threads, requires locking. |
356 bool is_current_user_owner_; | 346 bool is_current_user_owner_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 392 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
403 | 393 |
404 base::WeakPtrFactory<UserManagerBase> weak_factory_; | 394 base::WeakPtrFactory<UserManagerBase> weak_factory_; |
405 | 395 |
406 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); | 396 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); |
407 }; | 397 }; |
408 | 398 |
409 } // namespace user_manager | 399 } // namespace user_manager |
410 | 400 |
411 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 401 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
OLD | NEW |