OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "chrome/browser/chromeos/login/enterprise_enrollment_view.h" | 13 #include "chrome/browser/chromeos/login/enterprise_enrollment_view.h" |
14 #include "chrome/browser/chromeos/login/view_screen.h" | 14 #include "chrome/browser/chromeos/login/view_screen.h" |
| 15 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
15 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 16 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 // Controller interface for driving the enterprise enrollment UI. | 20 // Controller interface for driving the enterprise enrollment UI. |
20 class EnterpriseEnrollmentController { | 21 class EnterpriseEnrollmentController { |
21 public: | 22 public: |
22 // Runs authentication with the given parameters. | 23 // Runs authentication with the given parameters. |
23 virtual void Authenticate(const std::string& user, | 24 virtual void Authenticate(const std::string& user, |
24 const std::string& password, | 25 const std::string& password, |
25 const std::string& captcha, | 26 const std::string& captcha, |
26 const std::string& access_code) = 0; | 27 const std::string& access_code) = 0; |
27 | 28 |
28 // Cancels the enrollment operation. | 29 // Cancels the enrollment operation. |
29 virtual void CancelEnrollment() = 0; | 30 virtual void CancelEnrollment() = 0; |
30 | 31 |
31 // Closes the confirmation window. | 32 // Closes the confirmation window. |
32 virtual void CloseConfirmation() = 0; | 33 virtual void CloseConfirmation() = 0; |
33 }; | 34 }; |
34 | 35 |
35 // The screen implementation that links the enterprise enrollment UI into the | 36 // The screen implementation that links the enterprise enrollment UI into the |
36 // OOBE wizard. | 37 // OOBE wizard. |
37 class EnterpriseEnrollmentScreen | 38 class EnterpriseEnrollmentScreen |
38 : public ViewScreen<EnterpriseEnrollmentView>, | 39 : public ViewScreen<EnterpriseEnrollmentView>, |
39 public EnterpriseEnrollmentController, | 40 public EnterpriseEnrollmentController, |
40 public GaiaAuthConsumer { | 41 public GaiaAuthConsumer, |
| 42 public policy::CloudPolicySubsystem::Observer { |
41 public: | 43 public: |
42 explicit EnterpriseEnrollmentScreen(WizardScreenDelegate* delegate); | 44 explicit EnterpriseEnrollmentScreen(WizardScreenDelegate* delegate); |
43 virtual ~EnterpriseEnrollmentScreen(); | 45 virtual ~EnterpriseEnrollmentScreen(); |
44 | 46 |
45 // EnterpriseEnrollmentController implementation: | 47 // EnterpriseEnrollmentController implementation: |
46 virtual void Authenticate(const std::string& user, | 48 virtual void Authenticate(const std::string& user, |
47 const std::string& password, | 49 const std::string& password, |
48 const std::string& captcha, | 50 const std::string& captcha, |
49 const std::string& access_code) OVERRIDE; | 51 const std::string& access_code) OVERRIDE; |
50 virtual void CancelEnrollment() OVERRIDE; | 52 virtual void CancelEnrollment() OVERRIDE; |
51 virtual void CloseConfirmation() OVERRIDE; | 53 virtual void CloseConfirmation() OVERRIDE; |
52 | 54 |
53 // GaiaAuthConsumer implementation: | 55 // GaiaAuthConsumer implementation: |
54 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 56 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
55 virtual void OnClientLoginFailure( | 57 virtual void OnClientLoginFailure( |
56 const GoogleServiceAuthError& error) OVERRIDE; | 58 const GoogleServiceAuthError& error) OVERRIDE; |
57 | 59 |
58 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 60 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
59 const std::string& auth_token) OVERRIDE; | 61 const std::string& auth_token) OVERRIDE; |
60 virtual void OnIssueAuthTokenFailure( | 62 virtual void OnIssueAuthTokenFailure( |
61 const std::string& service, | 63 const std::string& service, |
62 const GoogleServiceAuthError& error) OVERRIDE; | 64 const GoogleServiceAuthError& error) OVERRIDE; |
63 | 65 |
| 66 // CloudPolicySubsystem::Observer implementation: |
| 67 virtual void OnPolicyStateChanged( |
| 68 policy::CloudPolicySubsystem::PolicySubsystemState state, |
| 69 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; |
64 | 70 |
65 protected: | 71 protected: |
66 // Overriden from ViewScreen: | 72 // Overriden from ViewScreen: |
67 virtual EnterpriseEnrollmentView* AllocateView() OVERRIDE; | 73 virtual EnterpriseEnrollmentView* AllocateView() OVERRIDE; |
68 | 74 |
69 private: | 75 private: |
70 void HandleAuthError(const GoogleServiceAuthError& error); | 76 void HandleAuthError(const GoogleServiceAuthError& error); |
71 | 77 |
72 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; | 78 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; |
| 79 std::string user_; |
73 std::string captcha_token_; | 80 std::string captcha_token_; |
| 81 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; |
74 | 82 |
75 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); | 83 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); |
76 }; | 84 }; |
77 | 85 |
78 } // namespace chromeos | 86 } // namespace chromeos |
79 | 87 |
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
OLD | NEW |