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 "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen_actor.h" | 16 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen_actor.h" |
17 #include "chrome/browser/chromeos/login/wizard_screen.h" | 17 #include "chrome/browser/chromeos/login/wizard_screen.h" |
| 18 #include "chrome/browser/policy/browser_policy_connector.h" |
18 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 19 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
19 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 20 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 | 23 |
23 class ScreenObserver; | 24 class ScreenObserver; |
24 | 25 |
25 // The screen implementation that links the enterprise enrollment UI into the | 26 // The screen implementation that links the enterprise enrollment UI into the |
26 // OOBE wizard. | 27 // OOBE wizard. |
27 class EnterpriseEnrollmentScreen | 28 class EnterpriseEnrollmentScreen |
28 : public WizardScreen, | 29 : public WizardScreen, |
29 public EnterpriseEnrollmentScreenActor::Controller, | 30 public EnterpriseEnrollmentScreenActor::Controller, |
30 public GaiaAuthConsumer, | 31 public GaiaAuthConsumer, |
31 public policy::CloudPolicySubsystem::Observer { | 32 public policy::CloudPolicySubsystem::Observer { |
32 public: | 33 public: |
33 EnterpriseEnrollmentScreen(ScreenObserver* observer, | 34 EnterpriseEnrollmentScreen(ScreenObserver* observer, |
34 EnterpriseEnrollmentScreenActor* actor); | 35 EnterpriseEnrollmentScreenActor* actor); |
35 virtual ~EnterpriseEnrollmentScreen(); | 36 virtual ~EnterpriseEnrollmentScreen(); |
36 | 37 |
37 // WizardScreen implementation: | 38 // WizardScreen implementation: |
38 virtual void PrepareToShow() OVERRIDE; | 39 virtual void PrepareToShow() OVERRIDE; |
39 virtual void Show() OVERRIDE; | 40 virtual void Show() OVERRIDE; |
40 virtual void Hide() OVERRIDE; | 41 virtual void Hide() OVERRIDE; |
41 | 42 |
42 // EnterpriseEnrollmentScreenActor::Controller implementation: | 43 // EnterpriseEnrollmentScreenActor::Controller implementation: |
43 virtual void OnAuthSubmitted(const std::string& user, | 44 virtual void OnAuthSubmitted(const std::string& user, |
44 const std::string& password, | 45 const std::string& password, |
45 const std::string& captcha, | 46 const std::string& captcha, |
46 const std::string& access_code) OVERRIDE; | 47 const std::string& access_code) OVERRIDE; |
| 48 virtual void OnOAuthTokenAvailable(const std::string& user, |
| 49 const std::string& token) OVERRIDE; |
47 virtual void OnAuthCancelled() OVERRIDE; | 50 virtual void OnAuthCancelled() OVERRIDE; |
48 virtual void OnConfirmationClosed() OVERRIDE; | 51 virtual void OnConfirmationClosed() OVERRIDE; |
49 virtual bool GetInitialUser(std::string* user) OVERRIDE; | 52 virtual bool GetInitialUser(std::string* user) OVERRIDE; |
50 | 53 |
51 // GaiaAuthConsumer implementation: | 54 // GaiaAuthConsumer implementation: |
52 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 55 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
53 virtual void OnClientLoginFailure( | 56 virtual void OnClientLoginFailure( |
54 const GoogleServiceAuthError& error) OVERRIDE; | 57 const GoogleServiceAuthError& error) OVERRIDE; |
55 | 58 |
56 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 59 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
(...skipping 11 matching lines...) Expand all Loading... |
68 EnterpriseEnrollmentScreenActor* GetActor() { | 71 EnterpriseEnrollmentScreenActor* GetActor() { |
69 return actor_; | 72 return actor_; |
70 } | 73 } |
71 | 74 |
72 private: | 75 private: |
73 void HandleAuthError(const GoogleServiceAuthError& error); | 76 void HandleAuthError(const GoogleServiceAuthError& error); |
74 | 77 |
75 // Starts the Lockbox storage process. | 78 // Starts the Lockbox storage process. |
76 void WriteInstallAttributesData(); | 79 void WriteInstallAttributesData(); |
77 | 80 |
| 81 // Kicks off the policy infrastructure to register with the service. |
| 82 void RegisterForDevicePolicy( |
| 83 const std::string& token, |
| 84 policy::BrowserPolicyConnector::TokenType token_type); |
| 85 |
78 EnterpriseEnrollmentScreenActor* actor_; | 86 EnterpriseEnrollmentScreenActor* actor_; |
79 bool is_showing_; | 87 bool is_showing_; |
80 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; | 88 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; |
81 std::string user_; | 89 std::string user_; |
82 std::string captcha_token_; | 90 std::string captcha_token_; |
83 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; | 91 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; |
84 ScopedRunnableMethodFactory<EnterpriseEnrollmentScreen> | 92 ScopedRunnableMethodFactory<EnterpriseEnrollmentScreen> |
85 runnable_method_factory_; | 93 runnable_method_factory_; |
86 | 94 |
87 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); | 95 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); |
88 }; | 96 }; |
89 | 97 |
90 } // namespace chromeos | 98 } // namespace chromeos |
91 | 99 |
92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
OLD | NEW |