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_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_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/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen_
actor.h" | 14 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen_
actor.h" |
15 #include "chrome/browser/chromeos/login/wizard_screen.h" | 15 #include "chrome/browser/chromeos/login/wizard_screen.h" |
16 #include "chrome/browser/policy/cloud_policy_constants.h" | 16 #include "chrome/browser/policy/cloud_policy_constants.h" |
17 #include "chrome/browser/policy/cloud_policy_subsystem.h" | |
18 | 17 |
19 namespace chromeos { | 18 namespace chromeos { |
20 | 19 |
21 class ScreenObserver; | 20 class ScreenObserver; |
22 | 21 |
23 // The screen implementation that links the enterprise enrollment UI into the | 22 // The screen implementation that links the enterprise enrollment UI into the |
24 // OOBE wizard. | 23 // OOBE wizard. |
25 class EnterpriseEnrollmentScreen | 24 class EnterpriseEnrollmentScreen |
26 : public WizardScreen, | 25 : public WizardScreen, |
27 public EnterpriseEnrollmentScreenActor::Controller, | 26 public EnterpriseEnrollmentScreenActor::Controller { |
28 public policy::CloudPolicySubsystem::Observer { | |
29 public: | 27 public: |
30 // Used in PyAuto testing. | 28 // Used in PyAuto testing. |
31 class TestingObserver { | 29 class TestingObserver { |
32 public: | 30 public: |
33 virtual ~TestingObserver() {} | 31 virtual ~TestingObserver() {} |
34 | 32 |
35 // Notifies observers of a change in enrollment state. | 33 // Notifies observers of a change in enrollment state. |
36 virtual void OnEnrollmentComplete(bool succeeded) = 0; | 34 virtual void OnEnrollmentComplete(bool succeeded) = 0; |
37 }; | 35 }; |
38 | 36 |
(...skipping 11 matching lines...) Expand all Loading... |
50 virtual std::string GetName() const OVERRIDE; | 48 virtual std::string GetName() const OVERRIDE; |
51 | 49 |
52 // EnterpriseEnrollmentScreenActor::Controller implementation: | 50 // EnterpriseEnrollmentScreenActor::Controller implementation: |
53 virtual void OnLoginDone(const std::string& user) OVERRIDE; | 51 virtual void OnLoginDone(const std::string& user) OVERRIDE; |
54 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; | 52 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; |
55 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; | 53 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; |
56 virtual void OnRetry() OVERRIDE; | 54 virtual void OnRetry() OVERRIDE; |
57 virtual void OnCancel() OVERRIDE; | 55 virtual void OnCancel() OVERRIDE; |
58 virtual void OnConfirmationClosed() OVERRIDE; | 56 virtual void OnConfirmationClosed() OVERRIDE; |
59 | 57 |
60 // CloudPolicySubsystem::Observer implementation: | |
61 virtual void OnPolicyStateChanged( | |
62 policy::CloudPolicySubsystem::PolicySubsystemState state, | |
63 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; | |
64 | |
65 // Used for testing. | 58 // Used for testing. |
66 EnterpriseEnrollmentScreenActor* GetActor() { | 59 EnterpriseEnrollmentScreenActor* GetActor() { |
67 return actor_; | 60 return actor_; |
68 } | 61 } |
69 | 62 |
70 // Used for testing. | 63 // Used for testing. |
71 void AddTestingObserver(TestingObserver* observer); | 64 void AddTestingObserver(TestingObserver* observer); |
72 void RemoveTestingObserver(TestingObserver* observer); | 65 void RemoveTestingObserver(TestingObserver* observer); |
73 | 66 |
74 private: | 67 private: |
(...skipping 16 matching lines...) Expand all Loading... |
91 void ShowSigninScreen(); | 84 void ShowSigninScreen(); |
92 | 85 |
93 // Notifies testing observers about the result of the enrollment. | 86 // Notifies testing observers about the result of the enrollment. |
94 void NotifyTestingObservers(bool succeeded); | 87 void NotifyTestingObservers(bool succeeded); |
95 | 88 |
96 EnterpriseEnrollmentScreenActor* actor_; | 89 EnterpriseEnrollmentScreenActor* actor_; |
97 bool is_auto_enrollment_; | 90 bool is_auto_enrollment_; |
98 bool enrollment_failed_once_; | 91 bool enrollment_failed_once_; |
99 std::string user_; | 92 std::string user_; |
100 int lockbox_init_duration_; | 93 int lockbox_init_duration_; |
101 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; | |
102 base::WeakPtrFactory<EnterpriseEnrollmentScreen> weak_ptr_factory_; | 94 base::WeakPtrFactory<EnterpriseEnrollmentScreen> weak_ptr_factory_; |
103 | 95 |
104 // Observers. | 96 // Observers. |
105 ObserverList<TestingObserver, true> observers_; | 97 ObserverList<TestingObserver, true> observers_; |
106 | 98 |
107 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); | 99 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); |
108 }; | 100 }; |
109 | 101 |
110 } // namespace chromeos | 102 } // namespace chromeos |
111 | 103 |
112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_SCREEN
_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_SCREEN
_H_ |
OLD | NEW |