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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Called when active user has changed. | 44 // Called when active user has changed. |
45 virtual void ActiveUserChanged(const User* active_user); | 45 virtual void ActiveUserChanged(const User* active_user); |
46 | 46 |
47 // Called when another user got added to the existing session. | 47 // Called when another user got added to the existing session. |
48 virtual void UserAddedToSession(const User* added_user); | 48 virtual void UserAddedToSession(const User* added_user); |
49 | 49 |
50 // Called right before notifying on user change so that those who rely | 50 // Called right before notifying on user change so that those who rely |
51 // on user_id hash would be accessing up-to-date value. | 51 // on user_id hash would be accessing up-to-date value. |
52 virtual void ActiveUserHashChanged(const std::string& hash); | 52 virtual void ActiveUserHashChanged(const std::string& hash); |
53 | 53 |
| 54 // Called when supervised status has changed. |
| 55 virtual void UserChangedSupervisedStatus(User* user); |
| 56 |
54 protected: | 57 protected: |
55 virtual ~UserSessionStateObserver(); | 58 virtual ~UserSessionStateObserver(); |
56 }; | 59 }; |
57 | 60 |
58 // Data retrieved from user account. | 61 // Data retrieved from user account. |
59 class UserAccountData { | 62 class UserAccountData { |
60 public: | 63 public: |
61 UserAccountData(const base::string16& display_name, | 64 UserAccountData(const base::string16& display_name, |
62 const base::string16& given_name, | 65 const base::string16& given_name, |
63 const std::string& locale); | 66 const std::string& locale); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const std::string& user_id) const = 0; | 286 const std::string& user_id) const = 0; |
284 | 287 |
285 virtual void AddObserver(Observer* obs) = 0; | 288 virtual void AddObserver(Observer* obs) = 0; |
286 virtual void RemoveObserver(Observer* obs) = 0; | 289 virtual void RemoveObserver(Observer* obs) = 0; |
287 | 290 |
288 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; | 291 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; |
289 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; | 292 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; |
290 | 293 |
291 virtual void NotifyLocalStateChanged() = 0; | 294 virtual void NotifyLocalStateChanged() = 0; |
292 | 295 |
| 296 // Makes the supervised status change and notifies observers. |
| 297 virtual void ChangeUserSupervisedStatus(User* user, bool is_supervised) = 0; |
| 298 |
| 299 |
293 // Returns true if supervised users allowed. | 300 // Returns true if supervised users allowed. |
294 virtual bool AreSupervisedUsersAllowed() const = 0; | 301 virtual bool AreSupervisedUsersAllowed() const = 0; |
295 | 302 |
296 // Force update login state. | |
297 virtual void ForceUpdateState() {} | |
298 | |
299 protected: | 303 protected: |
300 // Sets UserManager instance. | 304 // Sets UserManager instance. |
301 static void SetInstance(UserManager* user_manager); | 305 static void SetInstance(UserManager* user_manager); |
302 | 306 |
303 // Pointer to the existing UserManager instance (if any). | 307 // Pointer to the existing UserManager instance (if any). |
304 // Usually is set by calling Initialize(), reset by calling Destroy(). | 308 // Usually is set by calling Initialize(), reset by calling Destroy(). |
305 // Not owned since specific implementation of UserManager should decide on its | 309 // Not owned since specific implementation of UserManager should decide on its |
306 // own appropriate owner. For src/chrome implementation such place is | 310 // own appropriate owner. For src/chrome implementation such place is |
307 // g_browser_process->platform_part(). | 311 // g_browser_process->platform_part(). |
308 static UserManager* instance; | 312 static UserManager* instance; |
309 | 313 |
310 private: | 314 private: |
311 friend class chromeos::ScopedUserManagerEnabler; | 315 friend class chromeos::ScopedUserManagerEnabler; |
312 | 316 |
313 // Same as Get() but doesn't won't crash is current instance is NULL. | 317 // Same as Get() but doesn't won't crash is current instance is NULL. |
314 static UserManager* GetForTesting(); | 318 static UserManager* GetForTesting(); |
315 | 319 |
316 // Sets UserManager instance to the given |user_manager|. | 320 // Sets UserManager instance to the given |user_manager|. |
317 // Returns the previous value of the instance. | 321 // Returns the previous value of the instance. |
318 static UserManager* SetForTesting(UserManager* user_manager); | 322 static UserManager* SetForTesting(UserManager* user_manager); |
319 }; | 323 }; |
320 | 324 |
321 } // namespace user_manager | 325 } // namespace user_manager |
322 | 326 |
323 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 327 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
OLD | NEW |