| 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 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 16 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
| 17 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.
h" | 17 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.
h" |
| 18 #include "chrome/browser/chromeos/login/screens/base_screen.h" | 18 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
| 19 #include "chrome/browser/chromeos/policy/active_directory_join_delegate.h" |
| 19 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 20 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 21 #include "components/policy/core/common/cloud/enterprise_metrics.h" | 22 #include "components/policy/core/common/cloud/enterprise_metrics.h" |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class ElapsedTimer; | 25 class ElapsedTimer; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace pairing_chromeos { | 28 namespace pairing_chromeos { |
| 28 class ControllerPairingController; | 29 class ControllerPairingController; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace chromeos { | 32 namespace chromeos { |
| 32 | 33 |
| 33 class BaseScreenDelegate; | 34 class BaseScreenDelegate; |
| 34 class ScreenManager; | 35 class ScreenManager; |
| 35 | 36 |
| 36 // The screen implementation that links the enterprise enrollment UI into the | 37 // The screen implementation that links the enterprise enrollment UI into the |
| 37 // OOBE wizard. | 38 // OOBE wizard. |
| 38 class EnrollmentScreen | 39 class EnrollmentScreen |
| 39 : public BaseScreen, | 40 : public BaseScreen, |
| 40 public EnterpriseEnrollmentHelper::EnrollmentStatusConsumer, | 41 public EnterpriseEnrollmentHelper::EnrollmentStatusConsumer, |
| 41 public EnrollmentScreenActor::Controller { | 42 public EnrollmentScreenActor::Controller, |
| 43 public ActiveDirectoryJoinDelegate { |
| 42 public: | 44 public: |
| 43 EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, | 45 EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, |
| 44 EnrollmentScreenActor* actor); | 46 EnrollmentScreenActor* actor); |
| 45 ~EnrollmentScreen() override; | 47 ~EnrollmentScreen() override; |
| 46 | 48 |
| 47 static EnrollmentScreen* Get(ScreenManager* manager); | 49 static EnrollmentScreen* Get(ScreenManager* manager); |
| 48 | 50 |
| 49 // Setup how this screen will handle enrollment. | 51 // Setup how this screen will handle enrollment. |
| 50 // |shark_controller| is an interface that is used to communicate with a | 52 // |shark_controller| is an interface that is used to communicate with a |
| 51 // remora device or a slave device for remote enrollment. | 53 // remora device or a slave device for remote enrollment. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 const std::string& location) override; | 70 const std::string& location) override; |
| 69 | 71 |
| 70 // EnterpriseEnrollmentHelper::EnrollmentStatusConsumer implementation: | 72 // EnterpriseEnrollmentHelper::EnrollmentStatusConsumer implementation: |
| 71 void OnAuthError(const GoogleServiceAuthError& error) override; | 73 void OnAuthError(const GoogleServiceAuthError& error) override; |
| 72 void OnEnrollmentError(policy::EnrollmentStatus status) override; | 74 void OnEnrollmentError(policy::EnrollmentStatus status) override; |
| 73 void OnOtherError(EnterpriseEnrollmentHelper::OtherError error) override; | 75 void OnOtherError(EnterpriseEnrollmentHelper::OtherError error) override; |
| 74 void OnDeviceEnrolled(const std::string& additional_token) override; | 76 void OnDeviceEnrolled(const std::string& additional_token) override; |
| 75 void OnDeviceAttributeUploadCompleted(bool success) override; | 77 void OnDeviceAttributeUploadCompleted(bool success) override; |
| 76 void OnDeviceAttributeUpdatePermission(bool granted) override; | 78 void OnDeviceAttributeUpdatePermission(bool granted) override; |
| 77 | 79 |
| 80 // ActiveDirectoryJoinDelegate implementation: |
| 81 void JoinDomain(OnDomainJoinedCallback on_joined_callback) override; |
| 82 |
| 78 // Used for testing. | 83 // Used for testing. |
| 79 EnrollmentScreenActor* GetActor() { | 84 EnrollmentScreenActor* GetActor() { |
| 80 return actor_; | 85 return actor_; |
| 81 } | 86 } |
| 82 | 87 |
| 83 private: | 88 private: |
| 84 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); | 89 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| 85 FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel); | 90 FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel); |
| 86 FRIEND_TEST_ALL_PREFIXES(ForcedAttestationAuthEnrollmentScreenTest, | 91 FRIEND_TEST_ALL_PREFIXES(ForcedAttestationAuthEnrollmentScreenTest, |
| 87 TestCancel); | 92 TestCancel); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 151 |
| 147 pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr; | 152 pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr; |
| 148 | 153 |
| 149 EnrollmentScreenActor* actor_; | 154 EnrollmentScreenActor* actor_; |
| 150 policy::EnrollmentConfig config_; | 155 policy::EnrollmentConfig config_; |
| 151 policy::EnrollmentConfig enrollment_config_; | 156 policy::EnrollmentConfig enrollment_config_; |
| 152 Auth current_auth_ = AUTH_OAUTH; | 157 Auth current_auth_ = AUTH_OAUTH; |
| 153 Auth last_auth_ = AUTH_OAUTH; | 158 Auth last_auth_ = AUTH_OAUTH; |
| 154 bool enrollment_failed_once_ = false; | 159 bool enrollment_failed_once_ = false; |
| 155 std::string enrolling_user_domain_; | 160 std::string enrolling_user_domain_; |
| 156 std::string auth_code_; | |
| 157 std::unique_ptr<base::ElapsedTimer> elapsed_timer_; | 161 std::unique_ptr<base::ElapsedTimer> elapsed_timer_; |
| 158 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; | 162 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; |
| 163 OnDomainJoinedCallback on_joined_callback_; |
| 159 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; | 164 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
| 160 | 165 |
| 161 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); | 166 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
| 162 }; | 167 }; |
| 163 | 168 |
| 164 } // namespace chromeos | 169 } // namespace chromeos |
| 165 | 170 |
| 166 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 171 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| OLD | NEW |