| 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_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void OnDeviceAttributeUploadCompleted(bool success) override; | 76 void OnDeviceAttributeUploadCompleted(bool success) override; |
| 77 void OnDeviceAttributeUpdatePermission(bool granted) override; | 77 void OnDeviceAttributeUpdatePermission(bool granted) override; |
| 78 | 78 |
| 79 // Used for testing. | 79 // Used for testing. |
| 80 EnrollmentScreenActor* GetActor() { | 80 EnrollmentScreenActor* GetActor() { |
| 81 return actor_; | 81 return actor_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); | 85 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| 86 FRIEND_TEST_ALL_PREFIXES(MultiAuthEnrollmentScreenTest, TestCancel); |
| 87 FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel); |
| 86 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, | 88 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
| 87 TestProperPageGetsLoadedOnEnrollmentSuccess); | 89 TestProperPageGetsLoadedOnEnrollmentSuccess); |
| 88 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, | 90 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
| 89 TestAttributePromptPageGetsLoaded); | 91 TestAttributePromptPageGetsLoaded); |
| 90 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, | 92 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
| 91 TestAuthCodeGetsProperlyReceivedFromGaia); | 93 TestAuthCodeGetsProperlyReceivedFromGaia); |
| 92 | 94 |
| 93 // Creates an enrollment helper. | 95 // The authentication mechanisms that this class can use. |
| 96 enum Auth { |
| 97 AUTH_ATTESTATION, |
| 98 AUTH_OAUTH, |
| 99 }; |
| 100 |
| 101 // Sets the current config to use for enrollment. |
| 102 void SetConfig(); |
| 103 |
| 104 // Creates an enrollment helper if needed. |
| 94 void CreateEnrollmentHelper(); | 105 void CreateEnrollmentHelper(); |
| 95 | 106 |
| 96 // Clears auth in |enrollment_helper_|. Deletes |enrollment_helper_| and runs | 107 // Clears auth in |enrollment_helper_|. Deletes |enrollment_helper_| and runs |
| 97 // |callback| on completion. See the comment for | 108 // |callback| on completion. See the comment for |
| 98 // EnterpriseEnrollmentHelper::ClearAuth for details. | 109 // EnterpriseEnrollmentHelper::ClearAuth for details. |
| 99 void ClearAuth(const base::Closure& callback); | 110 void ClearAuth(const base::Closure& callback); |
| 100 | 111 |
| 101 // Used as a callback for EnterpriseEnrollmentHelper::ClearAuth. | 112 // Used as a callback for EnterpriseEnrollmentHelper::ClearAuth. |
| 102 virtual void OnAuthCleared(const base::Closure& callback); | 113 virtual void OnAuthCleared(const base::Closure& callback); |
| 103 | 114 |
| 104 // Sends an enrollment access token to a remote device. | 115 // Sends an enrollment access token to a remote device. |
| 105 void SendEnrollmentAuthToken(const std::string& token); | 116 void SendEnrollmentAuthToken(const std::string& token); |
| 106 | 117 |
| 107 // Shows successful enrollment status after all enrollment related file | 118 // Shows successful enrollment status after all enrollment related file |
| 108 // operations are completed. | 119 // operations are completed. |
| 109 void ShowEnrollmentStatusOnSuccess(); | 120 void ShowEnrollmentStatusOnSuccess(); |
| 110 | 121 |
| 111 // Logs an UMA event in one of the "Enrollment.*" histograms, depending on | 122 // Logs an UMA event in one of the "Enrollment.*" histograms, depending on |
| 112 // |enrollment_mode_|. | 123 // |enrollment_mode_|. |
| 113 void UMA(policy::MetricEnrollment sample); | 124 void UMA(policy::MetricEnrollment sample); |
| 114 | 125 |
| 126 // Do attestation based enrollment. |
| 127 void AuthenticateUsingAttestation(); |
| 128 |
| 129 // Shows the interactive screen. Resets auth then shows the signin screen. |
| 130 void ShowInteractiveScreen(); |
| 131 |
| 115 // Shows the signin screen. Used as a callback to run after auth reset. | 132 // Shows the signin screen. Used as a callback to run after auth reset. |
| 116 void ShowSigninScreen(); | 133 void ShowSigninScreen(); |
| 117 | 134 |
| 118 // Shows the device attribute prompt screen. | 135 // Shows the device attribute prompt screen. |
| 119 // Used as a callback to run after successful enrollment. | 136 // Used as a callback to run after successful enrollment. |
| 120 void ShowAttributePromptScreen(); | 137 void ShowAttributePromptScreen(); |
| 121 | 138 |
| 139 // Handle enrollment errors. |
| 122 void OnAnyEnrollmentError(); | 140 void OnAnyEnrollmentError(); |
| 123 | 141 |
| 142 // Advance to the next authentication mechanism if possible. |
| 143 bool AdvanceToNextAuth(); |
| 144 |
| 124 pairing_chromeos::ControllerPairingController* shark_controller_; | 145 pairing_chromeos::ControllerPairingController* shark_controller_; |
| 125 | 146 |
| 126 EnrollmentScreenActor* actor_; | 147 EnrollmentScreenActor* actor_; |
| 148 policy::EnrollmentConfig config_; |
| 127 policy::EnrollmentConfig enrollment_config_; | 149 policy::EnrollmentConfig enrollment_config_; |
| 150 Auth current_auth_; |
| 151 Auth last_auth_; |
| 128 bool enrollment_failed_once_; | 152 bool enrollment_failed_once_; |
| 129 std::string enrolling_user_domain_; | 153 std::string enrolling_user_domain_; |
| 130 std::unique_ptr<base::ElapsedTimer> elapsed_timer_; | 154 std::unique_ptr<base::ElapsedTimer> elapsed_timer_; |
| 131 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; | 155 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; |
| 132 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; | 156 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
| 133 | 157 |
| 134 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); | 158 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
| 135 }; | 159 }; |
| 136 | 160 |
| 137 } // namespace chromeos | 161 } // namespace chromeos |
| 138 | 162 |
| 139 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 163 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| OLD | NEW |