| 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_MANAGED_MANAGED_USER_CREATION_CONTROLLER_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_CREATION_CONTROLLER_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/login/managed/managed_user_authenticator.h" | 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticator
.h" |
| 17 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" | 17 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" |
| 18 | 18 |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 // ManagedUserCreationController is used to locally managed user | 23 class SupervisedUserCreationController { |
| 24 // creation. | |
| 25 class ManagedUserCreationController { | |
| 26 public: | 24 public: |
| 27 // This constant is used to indicate that user does not have one of default | 25 // This constant is used to indicate that user does not have one of default |
| 28 // avatars: either he has no chromeos avatar at all, or has an external | 26 // avatars: either he has no chromeos avatar at all, or has an external |
| 29 // image as an avatar. | 27 // image as an avatar. |
| 30 static const int kDummyAvatarIndex; | 28 static const int kDummyAvatarIndex; |
| 31 | 29 |
| 32 enum ErrorCode { | 30 enum ErrorCode { |
| 33 NO_ERROR, | 31 NO_ERROR, |
| 34 CRYPTOHOME_NO_MOUNT, | 32 CRYPTOHOME_NO_MOUNT, |
| 35 CRYPTOHOME_FAILED_MOUNT, | 33 CRYPTOHOME_FAILED_MOUNT, |
| 36 CRYPTOHOME_FAILED_TPM, | 34 CRYPTOHOME_FAILED_TPM, |
| 37 CLOUD_SERVER_ERROR, | 35 CLOUD_SERVER_ERROR, |
| 38 TOKEN_WRITE_FAILED, | 36 TOKEN_WRITE_FAILED, |
| 39 }; | 37 }; |
| 40 | 38 |
| 41 class StatusConsumer { | 39 class StatusConsumer { |
| 42 public: | 40 public: |
| 43 virtual ~StatusConsumer(); | 41 virtual ~StatusConsumer(); |
| 44 | 42 |
| 45 virtual void OnCreationError(ErrorCode code) = 0; | 43 virtual void OnCreationError(ErrorCode code) = 0; |
| 46 virtual void OnLongCreationWarning() = 0; | 44 virtual void OnLongCreationWarning() = 0; |
| 47 virtual void OnCreationTimeout() = 0; | 45 virtual void OnCreationTimeout() = 0; |
| 48 virtual void OnCreationSuccess() = 0; | 46 virtual void OnCreationSuccess() = 0; |
| 49 }; | 47 }; |
| 50 | 48 |
| 51 // All UI initialization is deferred till Init() call. | 49 // All UI initialization is deferred till Init() call. |
| 52 // |Consumer| is not owned by controller, and it is expected that it wouldn't | 50 // |Consumer| is not owned by controller, and it is expected that it wouldn't |
| 53 // be deleted before ManagedUserCreationController. | 51 // be deleted before SupervisedUserCreationController. |
| 54 explicit ManagedUserCreationController(StatusConsumer* consumer); | 52 explicit SupervisedUserCreationController(StatusConsumer* consumer); |
| 55 virtual ~ManagedUserCreationController(); | 53 virtual ~SupervisedUserCreationController(); |
| 56 | 54 |
| 57 // Returns the current locally managed user controller if it has been created. | 55 // Returns the current supervised user controller if it has been created. |
| 58 static ManagedUserCreationController* current_controller() { | 56 static SupervisedUserCreationController* current_controller() { |
| 59 return current_controller_; | 57 return current_controller_; |
| 60 } | 58 } |
| 61 | 59 |
| 62 // Set up controller for creating new supervised user with |display_name|, | 60 // Set up controller for creating new supervised user with |display_name|, |
| 63 // |password| and avatar indexed by |avatar_index|. StartCreation() have to | 61 // |password| and avatar indexed by |avatar_index|. StartCreation() have to |
| 64 // be called to actually start creating user. | 62 // be called to actually start creating user. |
| 65 virtual void StartCreation(const base::string16& display_name, | 63 virtual void StartCreation(const base::string16& display_name, |
| 66 const std::string& password, | 64 const std::string& password, |
| 67 int avatar_index) = 0; | 65 int avatar_index) = 0; |
| 68 | 66 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 const std::string& sync_id, | 83 const std::string& sync_id, |
| 86 const std::string& master_key, | 84 const std::string& master_key, |
| 87 const base::DictionaryValue* password_data, | 85 const base::DictionaryValue* password_data, |
| 88 const std::string& encryption_key, | 86 const std::string& encryption_key, |
| 89 const std::string& signature_key) = 0; | 87 const std::string& signature_key) = 0; |
| 90 | 88 |
| 91 virtual void SetManagerProfile(Profile* manager_profile) = 0; | 89 virtual void SetManagerProfile(Profile* manager_profile) = 0; |
| 92 virtual Profile* GetManagerProfile() = 0; | 90 virtual Profile* GetManagerProfile() = 0; |
| 93 virtual void CancelCreation() = 0; | 91 virtual void CancelCreation() = 0; |
| 94 virtual void FinishCreation() = 0; | 92 virtual void FinishCreation() = 0; |
| 95 virtual std::string GetManagedUserId() = 0; | 93 virtual std::string GetSupervisedUserId() = 0; |
| 96 | 94 |
| 97 protected: | 95 protected: |
| 98 // Pointer to the current instance of the controller to be used by | 96 // Pointer to the current instance of the controller to be used by |
| 99 // automation tests. | 97 // automation tests. |
| 100 static ManagedUserCreationController* current_controller_; | 98 static SupervisedUserCreationController* current_controller_; |
| 101 | 99 |
| 102 StatusConsumer* consumer_; | 100 StatusConsumer* consumer_; |
| 103 | 101 |
| 104 private: | 102 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(ManagedUserCreationController); | 103 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationController); |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 } // namespace chromeos | 106 } // namespace chromeos |
| 109 | 107 |
| 110 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_CREATION_CONTROLLE
R_H_ | 108 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON
TROLLER_H_ |
| OLD | NEW |