| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 14 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
| 15 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" |
| 16 #include "components/pairing/host_pairing_controller.h" |
| 16 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 17 #include "components/policy/core/common/cloud/enterprise_metrics.h" | 18 #include "components/policy/core/common/cloud/enterprise_metrics.h" |
| 18 | 19 |
| 20 namespace pairing_chromeos { |
| 21 class ControllerPairingController; |
| 22 } |
| 23 |
| 19 namespace chromeos { | 24 namespace chromeos { |
| 20 | 25 |
| 21 class ScreenManager; | 26 class ScreenManager; |
| 22 class ScreenObserver; | 27 class ScreenObserver; |
| 23 | 28 |
| 24 // The screen implementation that links the enterprise enrollment UI into the | 29 // The screen implementation that links the enterprise enrollment UI into the |
| 25 // OOBE wizard. | 30 // OOBE wizard. |
| 26 class EnrollmentScreen | 31 class EnrollmentScreen |
| 27 : public WizardScreen, | 32 : public WizardScreen, |
| 33 public pairing_chromeos::HostPairingController::Observer, |
| 28 public EnrollmentScreenActor::Controller { | 34 public EnrollmentScreenActor::Controller { |
| 29 public: | 35 public: |
| 36 typedef pairing_chromeos::HostPairingController::Stage Stage; |
| 37 |
| 30 EnrollmentScreen(ScreenObserver* observer, | 38 EnrollmentScreen(ScreenObserver* observer, |
| 31 EnrollmentScreenActor* actor); | 39 EnrollmentScreenActor* actor); |
| 32 virtual ~EnrollmentScreen(); | 40 virtual ~EnrollmentScreen(); |
| 33 | 41 |
| 34 static EnrollmentScreen* Get(ScreenManager* manager); | 42 static EnrollmentScreen* Get(ScreenManager* manager); |
| 35 | 43 |
| 36 void SetParameters(EnrollmentScreenActor::EnrollmentMode enrollment_mode, | 44 void SetParameters( |
| 37 const std::string& management_domain, | 45 EnrollmentScreenActor::EnrollmentMode enrollment_mode, |
| 38 const std::string& enrollment_user, | 46 const std::string& management_domain, |
| 39 const std::string& auth_token); | 47 const std::string& enrollment_user, |
| 48 const std::string& auth_token, |
| 49 pairing_chromeos::ControllerPairingController* shark_controller, |
| 50 pairing_chromeos::HostPairingController* remora_controller); |
| 40 | 51 |
| 41 // WizardScreen implementation: | 52 // WizardScreen implementation: |
| 42 virtual void PrepareToShow() OVERRIDE; | 53 virtual void PrepareToShow() OVERRIDE; |
| 43 virtual void Show() OVERRIDE; | 54 virtual void Show() OVERRIDE; |
| 44 virtual void Hide() OVERRIDE; | 55 virtual void Hide() OVERRIDE; |
| 45 virtual std::string GetName() const OVERRIDE; | 56 virtual std::string GetName() const OVERRIDE; |
| 46 | 57 |
| 58 // pairing_chromeos::HostPairingController::Observer: |
| 59 virtual void PairingStageChanged(Stage new_stage) OVERRIDE; |
| 60 virtual void ConfigureHost(bool accepted_eula, |
| 61 const std::string& lang, |
| 62 const std::string& timezone, |
| 63 bool send_reports, |
| 64 const std::string& keyboard_layout) OVERRIDE; |
| 65 virtual void EnrollHost(const std::string& auth_token) OVERRIDE; |
| 66 |
| 47 // EnrollmentScreenActor::Controller implementation: | 67 // EnrollmentScreenActor::Controller implementation: |
| 48 virtual void OnLoginDone(const std::string& user) OVERRIDE; | 68 virtual void OnLoginDone(const std::string& user) OVERRIDE; |
| 49 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; | 69 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; |
| 50 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; | 70 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; |
| 51 virtual void OnRetry() OVERRIDE; | 71 virtual void OnRetry() OVERRIDE; |
| 52 virtual void OnCancel() OVERRIDE; | 72 virtual void OnCancel() OVERRIDE; |
| 53 virtual void OnConfirmationClosed() OVERRIDE; | 73 virtual void OnConfirmationClosed() OVERRIDE; |
| 54 | 74 |
| 55 // Used for testing. | 75 // Used for testing. |
| 56 EnrollmentScreenActor* GetActor() { | 76 EnrollmentScreenActor* GetActor() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void UMAFailure(policy::MetricEnrollment sample); | 108 void UMAFailure(policy::MetricEnrollment sample); |
| 89 | 109 |
| 90 // Shows the signin screen. Used as a callback to run after auth reset. | 110 // Shows the signin screen. Used as a callback to run after auth reset. |
| 91 void ShowSigninScreen(); | 111 void ShowSigninScreen(); |
| 92 | 112 |
| 93 // Convenience helper to check for auto enrollment mode. | 113 // Convenience helper to check for auto enrollment mode. |
| 94 bool is_auto_enrollment() const { | 114 bool is_auto_enrollment() const { |
| 95 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; | 115 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; |
| 96 } | 116 } |
| 97 | 117 |
| 118 pairing_chromeos::ControllerPairingController* shark_controller_; |
| 119 pairing_chromeos::HostPairingController* remora_controller_; |
| 98 EnrollmentScreenActor* actor_; | 120 EnrollmentScreenActor* actor_; |
| 99 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; | 121 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; |
| 100 bool enrollment_failed_once_; | 122 bool enrollment_failed_once_; |
| 101 bool remora_token_sent_; | 123 bool remora_token_sent_; |
| 102 std::string user_; | 124 std::string user_; |
| 103 std::string auth_token_; | 125 std::string auth_token_; |
| 104 int lockbox_init_duration_; | 126 int lockbox_init_duration_; |
| 105 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; | 127 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
| 106 | 128 |
| 107 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); | 129 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
| 108 }; | 130 }; |
| 109 | 131 |
| 110 } // namespace chromeos | 132 } // namespace chromeos |
| 111 | 133 |
| 112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 134 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| OLD | NEW |