| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SUPERVISED_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Creates supervised user with given |display_name| and |local_user_id| | 30 // Creates supervised user with given |display_name| and |local_user_id| |
| 31 // and persists that to user list. Also links this user identified by | 31 // and persists that to user list. Also links this user identified by |
| 32 // |sync_user_id| to manager with a |manager_id|. | 32 // |sync_user_id| to manager with a |manager_id|. |
| 33 // Returns created user, or existing user if there already | 33 // Returns created user, or existing user if there already |
| 34 // was locally managed user with such display name. | 34 // was locally managed user with such display name. |
| 35 // TODO(antrim): Refactor into a single struct to have only 1 getter. | 35 // TODO(antrim): Refactor into a single struct to have only 1 getter. |
| 36 virtual const User* CreateUserRecord( | 36 virtual const User* CreateUserRecord( |
| 37 const std::string& manager_id, | 37 const std::string& manager_id, |
| 38 const std::string& local_user_id, | 38 const std::string& local_user_id, |
| 39 const std::string& sync_user_id, | 39 const std::string& sync_user_id, |
| 40 const string16& display_name) = 0; | 40 const base::string16& display_name) = 0; |
| 41 | 41 |
| 42 // Generates unique user ID for supervised user. | 42 // Generates unique user ID for supervised user. |
| 43 virtual std::string GenerateUserId() = 0; | 43 virtual std::string GenerateUserId() = 0; |
| 44 | 44 |
| 45 // Returns the supervised user with the given |display_name| if found in | 45 // Returns the supervised user with the given |display_name| if found in |
| 46 // the persistent list. Returns |NULL| otherwise. | 46 // the persistent list. Returns |NULL| otherwise. |
| 47 virtual const User* FindByDisplayName(const string16& display_name) const = 0; | 47 virtual const User* FindByDisplayName( |
| 48 const base::string16& display_name) const = 0; |
| 48 | 49 |
| 49 // Returns the supervised user with the given |sync_id| if found in | 50 // Returns the supervised user with the given |sync_id| if found in |
| 50 // the persistent list. Returns |NULL| otherwise. | 51 // the persistent list. Returns |NULL| otherwise. |
| 51 virtual const User* FindBySyncId(const std::string& sync_id) const = 0; | 52 virtual const User* FindBySyncId(const std::string& sync_id) const = 0; |
| 52 | 53 |
| 53 // Returns sync_user_id for supervised user with |user_id| or empty string if | 54 // Returns sync_user_id for supervised user with |user_id| or empty string if |
| 54 // such user is not found or it doesn't have user_id defined. | 55 // such user is not found or it doesn't have user_id defined. |
| 55 virtual std::string GetUserSyncId(const std::string& user_id) const = 0; | 56 virtual std::string GetUserSyncId(const std::string& user_id) const = 0; |
| 56 | 57 |
| 57 // Returns the display name for manager of user |user_id| if it is known | 58 // Returns the display name for manager of user |user_id| if it is known |
| 58 // (was previously set by a |SaveUserDisplayName| call). | 59 // (was previously set by a |SaveUserDisplayName| call). |
| 59 // Otherwise, returns a manager id. | 60 // Otherwise, returns a manager id. |
| 60 virtual string16 GetManagerDisplayName(const std::string& user_id) const = 0; | 61 virtual base::string16 GetManagerDisplayName( |
| 62 const std::string& user_id) const = 0; |
| 61 | 63 |
| 62 // Returns the user id for manager of user |user_id| if it is known (user is | 64 // Returns the user id for manager of user |user_id| if it is known (user is |
| 63 // actually a managed user). | 65 // actually a managed user). |
| 64 // Otherwise, returns an empty string. | 66 // Otherwise, returns an empty string. |
| 65 virtual std::string GetManagerUserId(const std::string& user_id) const = 0; | 67 virtual std::string GetManagerUserId(const std::string& user_id) const = 0; |
| 66 | 68 |
| 67 // Returns the display email for manager of user |user_id| if it is known | 69 // Returns the display email for manager of user |user_id| if it is known |
| 68 // (user is actually a managed user). | 70 // (user is actually a managed user). |
| 69 // Otherwise, returns an empty string. | 71 // Otherwise, returns an empty string. |
| 70 virtual std::string GetManagerDisplayEmail(const std::string& user_id) | 72 virtual std::string GetManagerDisplayEmail(const std::string& user_id) |
| 71 const = 0; | 73 const = 0; |
| 72 | 74 |
| 73 // Create a record about starting supervised user creation transaction. | 75 // Create a record about starting supervised user creation transaction. |
| 74 virtual void StartCreationTransaction(const string16& display_name) = 0; | 76 virtual void StartCreationTransaction(const base::string16& display_name) = 0; |
| 75 | 77 |
| 76 // Add user id to supervised user creation transaction record. | 78 // Add user id to supervised user creation transaction record. |
| 77 virtual void SetCreationTransactionUserId(const std::string& user_id) = 0; | 79 virtual void SetCreationTransactionUserId(const std::string& user_id) = 0; |
| 78 | 80 |
| 79 // Remove locally managed user creation transaction record. | 81 // Remove locally managed user creation transaction record. |
| 80 virtual void CommitCreationTransaction() = 0; | 82 virtual void CommitCreationTransaction() = 0; |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManager); | 85 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManager); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace chromeos | 88 } // namespace chromeos |
| 87 | 89 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_H_ |
| OLD | NEW |