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 // Setup how this screen will handle enrollment. |
37 const std::string& management_domain, | 45 // |auth_token| is an optional OAuth token to attempt to enroll with. |
38 const std::string& enrollment_user, | 46 // |shark_controller| is an interface that is used to communicate with a |
39 const std::string& auth_token); | 47 // remora device for remote enrollment. |
| 48 // |remora_controller| is an interface that is used to communicate with a |
| 49 // shark device for remote enrollment. |
| 50 void SetParameters( |
| 51 EnrollmentScreenActor::EnrollmentMode enrollment_mode, |
| 52 const std::string& management_domain, |
| 53 const std::string& enrollment_user, |
| 54 const std::string& auth_token, |
| 55 pairing_chromeos::ControllerPairingController* shark_controller, |
| 56 pairing_chromeos::HostPairingController* remora_controller); |
40 | 57 |
41 // WizardScreen implementation: | 58 // WizardScreen implementation: |
42 virtual void PrepareToShow() OVERRIDE; | 59 virtual void PrepareToShow() OVERRIDE; |
43 virtual void Show() OVERRIDE; | 60 virtual void Show() OVERRIDE; |
44 virtual void Hide() OVERRIDE; | 61 virtual void Hide() OVERRIDE; |
45 virtual std::string GetName() const OVERRIDE; | 62 virtual std::string GetName() const OVERRIDE; |
46 | 63 |
| 64 // pairing_chromeos::HostPairingController::Observer: |
| 65 virtual void PairingStageChanged(Stage new_stage) OVERRIDE; |
| 66 virtual void ConfigureHost(bool accepted_eula, |
| 67 const std::string& lang, |
| 68 const std::string& timezone, |
| 69 bool send_reports, |
| 70 const std::string& keyboard_layout) OVERRIDE; |
| 71 virtual void EnrollHost(const std::string& auth_token) OVERRIDE; |
| 72 |
47 // EnrollmentScreenActor::Controller implementation: | 73 // EnrollmentScreenActor::Controller implementation: |
48 virtual void OnLoginDone(const std::string& user) OVERRIDE; | 74 virtual void OnLoginDone(const std::string& user) OVERRIDE; |
49 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; | 75 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; |
50 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; | 76 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; |
51 virtual void OnRetry() OVERRIDE; | 77 virtual void OnRetry() OVERRIDE; |
52 virtual void OnCancel() OVERRIDE; | 78 virtual void OnCancel() OVERRIDE; |
53 virtual void OnConfirmationClosed() OVERRIDE; | 79 virtual void OnConfirmationClosed() OVERRIDE; |
54 | 80 |
55 // Used for testing. | 81 // Used for testing. |
56 EnrollmentScreenActor* GetActor() { | 82 EnrollmentScreenActor* GetActor() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void UMAFailure(policy::MetricEnrollment sample); | 114 void UMAFailure(policy::MetricEnrollment sample); |
89 | 115 |
90 // Shows the signin screen. Used as a callback to run after auth reset. | 116 // Shows the signin screen. Used as a callback to run after auth reset. |
91 void ShowSigninScreen(); | 117 void ShowSigninScreen(); |
92 | 118 |
93 // Convenience helper to check for auto enrollment mode. | 119 // Convenience helper to check for auto enrollment mode. |
94 bool is_auto_enrollment() const { | 120 bool is_auto_enrollment() const { |
95 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; | 121 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; |
96 } | 122 } |
97 | 123 |
| 124 pairing_chromeos::ControllerPairingController* shark_controller_; |
| 125 pairing_chromeos::HostPairingController* remora_controller_; |
98 EnrollmentScreenActor* actor_; | 126 EnrollmentScreenActor* actor_; |
99 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; | 127 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; |
100 bool enrollment_failed_once_; | 128 bool enrollment_failed_once_; |
101 bool remora_token_sent_; | 129 bool remora_token_sent_; |
102 std::string user_; | 130 std::string user_; |
103 std::string auth_token_; | 131 std::string auth_token_; |
104 int lockbox_init_duration_; | 132 int lockbox_init_duration_; |
105 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; | 133 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
106 | 134 |
107 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); | 135 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
108 }; | 136 }; |
109 | 137 |
110 } // namespace chromeos | 138 } // namespace chromeos |
111 | 139 |
112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 140 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
OLD | NEW |