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