| 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 CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Returns the current supervised user controller if it has been created. | 47 // Returns the current supervised user controller if it has been created. |
| 48 static SupervisedUserCreationControllerNew* current_controller() { | 48 static SupervisedUserCreationControllerNew* current_controller() { |
| 49 return current_controller_; | 49 return current_controller_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Set up controller for creating new supervised user with |display_name|, | 52 // Set up controller for creating new supervised user with |display_name|, |
| 53 // |password| and avatar indexed by |avatar_index|. StartCreation() have to | 53 // |password| and avatar indexed by |avatar_index|. StartCreation() have to |
| 54 // be called to actually start creating user. | 54 // be called to actually start creating user. |
| 55 virtual void StartCreation(const base::string16& display_name, | 55 virtual void StartCreation(const base::string16& display_name, |
| 56 const std::string& password, | 56 const std::string& password, |
| 57 int avatar_index) OVERRIDE; | 57 int avatar_index) override; |
| 58 | 58 |
| 59 // Starts import of the supervised users created prior to M35. They lack | 59 // Starts import of the supervised users created prior to M35. They lack |
| 60 // information about password. | 60 // information about password. |
| 61 // Configures and initiates importing existing supervised user to this device. | 61 // Configures and initiates importing existing supervised user to this device. |
| 62 // Existing user is identified by |sync_id|, has |display_name|, |password|, | 62 // Existing user is identified by |sync_id|, has |display_name|, |password|, |
| 63 // |avatar_index|. The master key for cryptohome is a |master_key|. | 63 // |avatar_index|. The master key for cryptohome is a |master_key|. |
| 64 virtual void StartImport(const base::string16& display_name, | 64 virtual void StartImport(const base::string16& display_name, |
| 65 const std::string& password, | 65 const std::string& password, |
| 66 int avatar_index, | 66 int avatar_index, |
| 67 const std::string& sync_id, | 67 const std::string& sync_id, |
| 68 const std::string& master_key) OVERRIDE; | 68 const std::string& master_key) override; |
| 69 | 69 |
| 70 // Configures and initiates importing existing supervised user to this device. | 70 // Configures and initiates importing existing supervised user to this device. |
| 71 // Existing user is identified by |sync_id|, has |display_name|, | 71 // Existing user is identified by |sync_id|, has |display_name|, |
| 72 // |avatar_index|. The master key for cryptohome is a |master_key|. The user | 72 // |avatar_index|. The master key for cryptohome is a |master_key|. The user |
| 73 // has password specified in |password_data| and | 73 // has password specified in |password_data| and |
| 74 // |encryption_key|/|signature_key| for cryptohome. | 74 // |encryption_key|/|signature_key| for cryptohome. |
| 75 virtual void StartImport(const base::string16& display_name, | 75 virtual void StartImport(const base::string16& display_name, |
| 76 int avatar_index, | 76 int avatar_index, |
| 77 const std::string& sync_id, | 77 const std::string& sync_id, |
| 78 const std::string& master_key, | 78 const std::string& master_key, |
| 79 const base::DictionaryValue* password_data, | 79 const base::DictionaryValue* password_data, |
| 80 const std::string& encryption_key, | 80 const std::string& encryption_key, |
| 81 const std::string& signature_key) OVERRIDE; | 81 const std::string& signature_key) override; |
| 82 | 82 |
| 83 virtual void SetManagerProfile(Profile* manager_profile) OVERRIDE; | 83 virtual void SetManagerProfile(Profile* manager_profile) override; |
| 84 virtual Profile* GetManagerProfile() OVERRIDE; | 84 virtual Profile* GetManagerProfile() override; |
| 85 | 85 |
| 86 virtual void CancelCreation() OVERRIDE; | 86 virtual void CancelCreation() override; |
| 87 virtual void FinishCreation() OVERRIDE; | 87 virtual void FinishCreation() override; |
| 88 virtual std::string GetSupervisedUserId() OVERRIDE; | 88 virtual std::string GetSupervisedUserId() override; |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 enum Stage { | 91 enum Stage { |
| 92 // Just initial stage. | 92 // Just initial stage. |
| 93 STAGE_INITIAL, | 93 STAGE_INITIAL, |
| 94 | 94 |
| 95 // Creation attempt is recoreded to allow cleanup in case of failure. | 95 // Creation attempt is recoreded to allow cleanup in case of failure. |
| 96 TRANSACTION_STARTED, | 96 TRANSACTION_STARTED, |
| 97 // Different keys are generated and public ones are stored in LocalState. | 97 // Different keys are generated and public ones are stored in LocalState. |
| 98 KEYS_GENERATED, | 98 KEYS_GENERATED, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 CreationType creation_type; | 140 CreationType creation_type; |
| 141 | 141 |
| 142 base::DictionaryValue password_data; | 142 base::DictionaryValue password_data; |
| 143 | 143 |
| 144 Profile* manager_profile; | 144 Profile* manager_profile; |
| 145 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility; | 145 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 // SupervisedUserAuthenticator::StatusConsumer overrides. | 148 // SupervisedUserAuthenticator::StatusConsumer overrides. |
| 149 virtual void OnAuthenticationFailure(ExtendedAuthenticator::AuthState error) | 149 virtual void OnAuthenticationFailure(ExtendedAuthenticator::AuthState error) |
| 150 OVERRIDE; | 150 override; |
| 151 | 151 |
| 152 // Authenticator success callbacks. | 152 // Authenticator success callbacks. |
| 153 void OnMountSuccess(const std::string& mount_hash); | 153 void OnMountSuccess(const std::string& mount_hash); |
| 154 void OnAddKeySuccess(); | 154 void OnAddKeySuccess(); |
| 155 void OnKeyTransformedIfNeeded(const UserContext& user_context); | 155 void OnKeyTransformedIfNeeded(const UserContext& user_context); |
| 156 | 156 |
| 157 void StartCreationImpl(); | 157 void StartCreationImpl(); |
| 158 | 158 |
| 159 // Guard timer callback. | 159 // Guard timer callback. |
| 160 void CreationTimedOut(); | 160 void CreationTimedOut(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 184 | 184 |
| 185 // Factory of callbacks. | 185 // Factory of callbacks. |
| 186 base::WeakPtrFactory<SupervisedUserCreationControllerNew> weak_factory_; | 186 base::WeakPtrFactory<SupervisedUserCreationControllerNew> weak_factory_; |
| 187 | 187 |
| 188 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationControllerNew); | 188 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationControllerNew); |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 } // namespace chromeos | 191 } // namespace chromeos |
| 192 | 192 |
| 193 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON
TROLLER_NEW_H_ | 193 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON
TROLLER_NEW_H_ |
| OLD | NEW |