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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 // Called when active user has changed. | 45 // Called when active user has changed. |
46 virtual void ActiveUserChanged(const User* active_user); | 46 virtual void ActiveUserChanged(const User* active_user); |
47 | 47 |
48 // Called when another user got added to the existing session. | 48 // Called when another user got added to the existing session. |
49 virtual void UserAddedToSession(const User* added_user); | 49 virtual void UserAddedToSession(const User* added_user); |
50 | 50 |
51 // Called right before notifying on user change so that those who rely | 51 // Called right before notifying on user change so that those who rely |
52 // on user_id hash would be accessing up-to-date value. | 52 // on user_id hash would be accessing up-to-date value. |
53 virtual void ActiveUserHashChanged(const std::string& hash); | 53 virtual void ActiveUserHashChanged(const std::string& hash); |
54 | 54 |
55 // Called when supervised status has changed. | 55 // Called when child status has changed. |
56 virtual void UserChangedSupervisedStatus(User* user); | 56 virtual void UserChangedChildStatus(User* user); |
57 | 57 |
58 protected: | 58 protected: |
59 virtual ~UserSessionStateObserver(); | 59 virtual ~UserSessionStateObserver(); |
60 }; | 60 }; |
61 | 61 |
62 // Data retrieved from user account. | 62 // Data retrieved from user account. |
63 class UserAccountData { | 63 class UserAccountData { |
64 public: | 64 public: |
65 UserAccountData(const base::string16& display_name, | 65 UserAccountData(const base::string16& display_name, |
66 const base::string16& given_name, | 66 const base::string16& given_name, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 // Returns true if the current user's session can be locked (i.e. the user has | 260 // Returns true if the current user's session can be locked (i.e. the user has |
261 // a password with which to unlock the session). | 261 // a password with which to unlock the session). |
262 virtual bool CanCurrentUserLock() const = 0; | 262 virtual bool CanCurrentUserLock() const = 0; |
263 | 263 |
264 // Returns true if at least one user has signed in. | 264 // Returns true if at least one user has signed in. |
265 virtual bool IsUserLoggedIn() const = 0; | 265 virtual bool IsUserLoggedIn() const = 0; |
266 | 266 |
267 // Returns true if we're logged in as a user with gaia account. | 267 // Returns true if we're logged in as a user with gaia account. |
268 virtual bool IsLoggedInAsUserWithGaiaAccount() const = 0; | 268 virtual bool IsLoggedInAsUserWithGaiaAccount() const = 0; |
269 | 269 |
270 // Returns true if we're logged in as a regular supervised user. | 270 // Returns true if we're logged in as a child user. |
271 virtual bool IsLoggedInAsRegularSupervisedUser() const = 0; | 271 virtual bool IsLoggedInAsChildUser() const = 0; |
272 | 272 |
273 // Returns true if we're logged in as a demo user. | 273 // Returns true if we're logged in as a demo user. |
274 virtual bool IsLoggedInAsDemoUser() const = 0; | 274 virtual bool IsLoggedInAsDemoUser() const = 0; |
275 | 275 |
276 // Returns true if we're logged in as a public account. | 276 // Returns true if we're logged in as a public account. |
277 virtual bool IsLoggedInAsPublicAccount() const = 0; | 277 virtual bool IsLoggedInAsPublicAccount() const = 0; |
278 | 278 |
279 // Returns true if we're logged in as a Guest. | 279 // Returns true if we're logged in as a Guest. |
280 virtual bool IsLoggedInAsGuest() const = 0; | 280 virtual bool IsLoggedInAsGuest() const = 0; |
281 | 281 |
282 // Returns true if we're logged in as a supervised user. | 282 // Returns true if we're logged in as a legacy supervised user. |
283 virtual bool IsLoggedInAsSupervisedUser() const = 0; | 283 virtual bool IsLoggedInAsSupervisedUser() const = 0; |
284 | 284 |
285 // Returns true if we're logged in as a kiosk app. | 285 // Returns true if we're logged in as a kiosk app. |
286 virtual bool IsLoggedInAsKioskApp() const = 0; | 286 virtual bool IsLoggedInAsKioskApp() const = 0; |
287 | 287 |
288 // Returns true if we're logged in as the stub user used for testing on Linux. | 288 // Returns true if we're logged in as the stub user used for testing on Linux. |
289 virtual bool IsLoggedInAsStub() const = 0; | 289 virtual bool IsLoggedInAsStub() const = 0; |
290 | 290 |
291 // Returns true if we're logged in and browser has been started i.e. | 291 // Returns true if we're logged in and browser has been started i.e. |
292 // browser_creator.LaunchBrowser(...) was called after sign in | 292 // browser_creator.LaunchBrowser(...) was called after sign in |
293 // or restart after crash. | 293 // or restart after crash. |
294 virtual bool IsSessionStarted() const = 0; | 294 virtual bool IsSessionStarted() const = 0; |
295 | 295 |
296 // Returns true if data stored or cached for the user with the given user id | 296 // Returns true if data stored or cached for the user with the given user id |
297 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 297 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
298 // status, display name, display email) is to be treated as ephemeral. | 298 // status, display name, display email) is to be treated as ephemeral. |
299 virtual bool IsUserNonCryptohomeDataEphemeral( | 299 virtual bool IsUserNonCryptohomeDataEphemeral( |
300 const std::string& user_id) const = 0; | 300 const std::string& user_id) const = 0; |
301 | 301 |
302 virtual void AddObserver(Observer* obs) = 0; | 302 virtual void AddObserver(Observer* obs) = 0; |
303 virtual void RemoveObserver(Observer* obs) = 0; | 303 virtual void RemoveObserver(Observer* obs) = 0; |
304 | 304 |
305 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; | 305 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; |
306 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; | 306 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; |
307 | 307 |
308 virtual void NotifyLocalStateChanged() = 0; | 308 virtual void NotifyLocalStateChanged() = 0; |
309 | 309 |
310 // Makes the supervised status change and notifies observers. | 310 // Makes the child status change and notifies observers. |
Marc Treib
2014/12/08 13:27:54
nit: Changes the child status and notifies observe
merkulova
2014/12/08 14:56:12
Done.
| |
311 virtual void ChangeUserSupervisedStatus(User* user, bool is_supervised) = 0; | 311 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; |
312 | 312 |
313 | 313 |
314 // Returns true if supervised users allowed. | 314 // Returns true if supervised users allowed. |
315 virtual bool AreSupervisedUsersAllowed() const = 0; | 315 virtual bool AreSupervisedUsersAllowed() const = 0; |
316 | 316 |
317 protected: | 317 protected: |
318 // Sets UserManager instance. | 318 // Sets UserManager instance. |
319 static void SetInstance(UserManager* user_manager); | 319 static void SetInstance(UserManager* user_manager); |
320 | 320 |
321 // Pointer to the existing UserManager instance (if any). | 321 // Pointer to the existing UserManager instance (if any). |
(...skipping 10 matching lines...) Expand all Loading... | |
332 static UserManager* GetForTesting(); | 332 static UserManager* GetForTesting(); |
333 | 333 |
334 // Sets UserManager instance to the given |user_manager|. | 334 // Sets UserManager instance to the given |user_manager|. |
335 // Returns the previous value of the instance. | 335 // Returns the previous value of the instance. |
336 static UserManager* SetForTesting(UserManager* user_manager); | 336 static UserManager* SetForTesting(UserManager* user_manager); |
337 }; | 337 }; |
338 | 338 |
339 } // namespace user_manager | 339 } // namespace user_manager |
340 | 340 |
341 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 341 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
OLD | NEW |