| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MANAGED_LOCALLY_MANAGED_USER_CREATION_CONT
ROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_CONT
ROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_CONT
ROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_CONT
ROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual ~LocallyManagedUserCreationController(); | 66 virtual ~LocallyManagedUserCreationController(); |
| 67 | 67 |
| 68 // Returns the current locally managed user controller if it has been created. | 68 // Returns the current locally managed user controller if it has been created. |
| 69 static LocallyManagedUserCreationController* current_controller() { | 69 static LocallyManagedUserCreationController* current_controller() { |
| 70 return current_controller_; | 70 return current_controller_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Set up controller for creating new supervised user with |display_name|, | 73 // Set up controller for creating new supervised user with |display_name|, |
| 74 // |password| and avatar indexed by |avatar_index|. StartCreation() have to | 74 // |password| and avatar indexed by |avatar_index|. StartCreation() have to |
| 75 // be called to actually start creating user. | 75 // be called to actually start creating user. |
| 76 void SetUpCreation(const string16& display_name, | 76 void SetUpCreation(const base::string16& display_name, |
| 77 const std::string& password, | 77 const std::string& password, |
| 78 int avatar_index); | 78 int avatar_index); |
| 79 | 79 |
| 80 // Configures and initiates importing existing supervised user to this device. | 80 // Configures and initiates importing existing supervised user to this device. |
| 81 // Existing user is identified by |sync_id|, has |display_name|, |password|, | 81 // Existing user is identified by |sync_id|, has |display_name|, |password|, |
| 82 // |avatar_index|. The master key for cryptohome is a |master_key|. | 82 // |avatar_index|. The master key for cryptohome is a |master_key|. |
| 83 void StartImport(const string16& display_name, | 83 void StartImport(const base::string16& display_name, |
| 84 const std::string& password, | 84 const std::string& password, |
| 85 int avatar_index, | 85 int avatar_index, |
| 86 const std::string& sync_id, | 86 const std::string& sync_id, |
| 87 const std::string& master_key); | 87 const std::string& master_key); |
| 88 void SetManagerProfile(Profile* manager_profile); | 88 void SetManagerProfile(Profile* manager_profile); |
| 89 void StartCreation(); | 89 void StartCreation(); |
| 90 void CancelCreation(); | 90 void CancelCreation(); |
| 91 void FinishCreation(); | 91 void FinishCreation(); |
| 92 std::string GetManagedUserId(); | 92 std::string GetManagedUserId(); |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 // Indicates if we create new user, or import an existing one. | 95 // Indicates if we create new user, or import an existing one. |
| 96 enum CreationType { | 96 enum CreationType { |
| 97 NEW_USER, | 97 NEW_USER, |
| 98 USER_IMPORT, | 98 USER_IMPORT, |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Contains information necessary for new user creation. | 101 // Contains information necessary for new user creation. |
| 102 struct UserCreationContext { | 102 struct UserCreationContext { |
| 103 UserCreationContext(); | 103 UserCreationContext(); |
| 104 ~UserCreationContext(); | 104 ~UserCreationContext(); |
| 105 | 105 |
| 106 string16 display_name; | 106 base::string16 display_name; |
| 107 int avatar_index; | 107 int avatar_index; |
| 108 std::string manager_id; | 108 std::string manager_id; |
| 109 std::string local_user_id; // Used to identify cryptohome. | 109 std::string local_user_id; // Used to identify cryptohome. |
| 110 std::string sync_user_id; // Used to identify user in manager's sync data. | 110 std::string sync_user_id; // Used to identify user in manager's sync data. |
| 111 std::string password; | 111 std::string password; |
| 112 std::string mount_hash; | 112 std::string mount_hash; |
| 113 std::string master_key; | 113 std::string master_key; |
| 114 bool token_acquired; | 114 bool token_acquired; |
| 115 std::string token; | 115 std::string token; |
| 116 bool token_succesfully_written; | 116 bool token_succesfully_written; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 // Factory of callbacks. | 152 // Factory of callbacks. |
| 153 base::WeakPtrFactory<LocallyManagedUserCreationController> weak_factory_; | 153 base::WeakPtrFactory<LocallyManagedUserCreationController> weak_factory_; |
| 154 | 154 |
| 155 DISALLOW_COPY_AND_ASSIGN(LocallyManagedUserCreationController); | 155 DISALLOW_COPY_AND_ASSIGN(LocallyManagedUserCreationController); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace chromeos | 158 } // namespace chromeos |
| 159 | 159 |
| 160 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_C
ONTROLLER_H_ | 160 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_C
ONTROLLER_H_ |
| OLD | NEW |