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_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/user_manager/user.h" | 10 #include "components/user_manager/user.h" |
| 11 #include "components/user_manager/user_id.h" |
11 #include "components/user_manager/user_manager_export.h" | 12 #include "components/user_manager/user_manager_export.h" |
12 #include "components/user_manager/user_type.h" | 13 #include "components/user_manager/user_type.h" |
13 | 14 |
| 15 namespace base { |
| 16 class DictionaryValue; |
| 17 } |
| 18 |
14 namespace chromeos { | 19 namespace chromeos { |
15 class ScopedUserManagerEnabler; | 20 class ScopedUserManagerEnabler; |
16 } | 21 } |
17 | 22 |
18 namespace user_manager { | 23 namespace user_manager { |
19 | 24 |
20 class RemoveUserDelegate; | 25 class RemoveUserDelegate; |
21 | 26 |
22 // Interface for UserManagerBase - that provides base implementation for | 27 // Interface for UserManagerBase - that provides base implementation for |
23 // Chrome OS user management. Typical features: | 28 // Chrome OS user management. Typical features: |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 304 |
300 virtual void NotifyLocalStateChanged() = 0; | 305 virtual void NotifyLocalStateChanged() = 0; |
301 | 306 |
302 // Changes the child status and notifies observers. | 307 // Changes the child status and notifies observers. |
303 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; | 308 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; |
304 | 309 |
305 | 310 |
306 // Returns true if supervised users allowed. | 311 // Returns true if supervised users allowed. |
307 virtual bool AreSupervisedUsersAllowed() const = 0; | 312 virtual bool AreSupervisedUsersAllowed() const = 0; |
308 | 313 |
| 314 // Methods for storage/retrieval of per-user properties in Local State. |
| 315 |
| 316 // Performs a lookup of properties associated with |user_id|. If found, |
| 317 // returns |true| and fills |out_value|. |out_value| can be NULL, if |
| 318 // only existence check is required. |
| 319 virtual bool FindKnownUserPrefs(const UserID& user_id, |
| 320 const base::DictionaryValue** out_value) = 0; |
| 321 |
| 322 // Updates (or creates) properties associated with |user_id| based |
| 323 // on |values|. |clear| defines if existing properties are cleared (|true|) |
| 324 // or if it is just a incremental update (|false|). |
| 325 virtual void UpdateKnownUserPrefs(const UserID& user_id, |
| 326 const base::DictionaryValue& values, |
| 327 bool clear) = 0; |
| 328 |
309 protected: | 329 protected: |
310 // Sets UserManager instance. | 330 // Sets UserManager instance. |
311 static void SetInstance(UserManager* user_manager); | 331 static void SetInstance(UserManager* user_manager); |
312 | 332 |
313 // Pointer to the existing UserManager instance (if any). | 333 // Pointer to the existing UserManager instance (if any). |
314 // Usually is set by calling Initialize(), reset by calling Destroy(). | 334 // Usually is set by calling Initialize(), reset by calling Destroy(). |
315 // Not owned since specific implementation of UserManager should decide on its | 335 // Not owned since specific implementation of UserManager should decide on its |
316 // own appropriate owner. For src/chrome implementation such place is | 336 // own appropriate owner. For src/chrome implementation such place is |
317 // g_browser_process->platform_part(). | 337 // g_browser_process->platform_part(). |
318 static UserManager* instance; | 338 static UserManager* instance; |
319 | 339 |
320 private: | 340 private: |
321 friend class chromeos::ScopedUserManagerEnabler; | 341 friend class chromeos::ScopedUserManagerEnabler; |
322 | 342 |
323 // Same as Get() but doesn't won't crash is current instance is NULL. | 343 // Same as Get() but doesn't won't crash is current instance is NULL. |
324 static UserManager* GetForTesting(); | 344 static UserManager* GetForTesting(); |
325 | 345 |
326 // Sets UserManager instance to the given |user_manager|. | 346 // Sets UserManager instance to the given |user_manager|. |
327 // Returns the previous value of the instance. | 347 // Returns the previous value of the instance. |
328 static UserManager* SetForTesting(UserManager* user_manager); | 348 static UserManager* SetForTesting(UserManager* user_manager); |
329 }; | 349 }; |
330 | 350 |
331 } // namespace user_manager | 351 } // namespace user_manager |
332 | 352 |
333 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 353 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
OLD | NEW |