| 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" |
| 14 #include "base/task.h" |
| 15 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/login/enterprise_enrollment_view.h" | 16 #include "chrome/browser/chromeos/login/enterprise_enrollment_view.h" |
| 14 #include "chrome/browser/chromeos/login/view_screen.h" | 17 #include "chrome/browser/chromeos/login/view_screen.h" |
| 15 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 18 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 16 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 19 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
| 17 | 20 |
| 18 namespace chromeos { | 21 namespace chromeos { |
| 19 | 22 |
| 20 // Controller interface for driving the enterprise enrollment UI. | 23 // Controller interface for driving the enterprise enrollment UI. |
| 21 class EnterpriseEnrollmentController { | 24 class EnterpriseEnrollmentController { |
| 22 public: | 25 public: |
| 23 // Runs authentication with the given parameters. | 26 // Runs authentication with the given parameters. |
| 24 virtual void Authenticate(const std::string& user, | 27 virtual void Authenticate(const std::string& user, |
| 25 const std::string& password, | 28 const std::string& password, |
| 26 const std::string& captcha, | 29 const std::string& captcha, |
| 27 const std::string& access_code) = 0; | 30 const std::string& access_code) = 0; |
| 28 | 31 |
| 29 // Cancels the enrollment operation. | 32 // Cancels the enrollment operation. |
| 30 virtual void CancelEnrollment() = 0; | 33 virtual void CancelEnrollment() = 0; |
| 31 | 34 |
| 32 // Closes the confirmation window. | 35 // Closes the confirmation window. |
| 33 virtual void CloseConfirmation() = 0; | 36 virtual void CloseConfirmation() = 0; |
| 37 |
| 38 // Returns whether the GAIA login should be prepolutated with an user and if |
| 39 // yes which one. |
| 40 virtual bool GetInitialUser(std::string* user) = 0; |
| 34 }; | 41 }; |
| 35 | 42 |
| 36 // The screen implementation that links the enterprise enrollment UI into the | 43 // The screen implementation that links the enterprise enrollment UI into the |
| 37 // OOBE wizard. | 44 // OOBE wizard. |
| 38 class EnterpriseEnrollmentScreen | 45 class EnterpriseEnrollmentScreen |
| 39 : public ViewScreen<EnterpriseEnrollmentView>, | 46 : public ViewScreen<EnterpriseEnrollmentView>, |
| 40 public EnterpriseEnrollmentController, | 47 public EnterpriseEnrollmentController, |
| 41 public GaiaAuthConsumer, | 48 public GaiaAuthConsumer, |
| 42 public policy::CloudPolicySubsystem::Observer { | 49 public policy::CloudPolicySubsystem::Observer { |
| 43 public: | 50 public: |
| 44 explicit EnterpriseEnrollmentScreen(WizardScreenDelegate* delegate); | 51 explicit EnterpriseEnrollmentScreen(WizardScreenDelegate* delegate); |
| 45 virtual ~EnterpriseEnrollmentScreen(); | 52 virtual ~EnterpriseEnrollmentScreen(); |
| 46 | 53 |
| 47 // EnterpriseEnrollmentController implementation: | 54 // EnterpriseEnrollmentController implementation: |
| 48 virtual void Authenticate(const std::string& user, | 55 virtual void Authenticate(const std::string& user, |
| 49 const std::string& password, | 56 const std::string& password, |
| 50 const std::string& captcha, | 57 const std::string& captcha, |
| 51 const std::string& access_code) OVERRIDE; | 58 const std::string& access_code) OVERRIDE; |
| 52 virtual void CancelEnrollment() OVERRIDE; | 59 virtual void CancelEnrollment() OVERRIDE; |
| 53 virtual void CloseConfirmation() OVERRIDE; | 60 virtual void CloseConfirmation() OVERRIDE; |
| 61 virtual bool GetInitialUser(std::string* user) OVERRIDE; |
| 54 | 62 |
| 55 // GaiaAuthConsumer implementation: | 63 // GaiaAuthConsumer implementation: |
| 56 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 64 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
| 57 virtual void OnClientLoginFailure( | 65 virtual void OnClientLoginFailure( |
| 58 const GoogleServiceAuthError& error) OVERRIDE; | 66 const GoogleServiceAuthError& error) OVERRIDE; |
| 59 | 67 |
| 60 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 68 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 61 const std::string& auth_token) OVERRIDE; | 69 const std::string& auth_token) OVERRIDE; |
| 62 virtual void OnIssueAuthTokenFailure( | 70 virtual void OnIssueAuthTokenFailure( |
| 63 const std::string& service, | 71 const std::string& service, |
| 64 const GoogleServiceAuthError& error) OVERRIDE; | 72 const GoogleServiceAuthError& error) OVERRIDE; |
| 65 | 73 |
| 66 // CloudPolicySubsystem::Observer implementation: | 74 // CloudPolicySubsystem::Observer implementation: |
| 67 virtual void OnPolicyStateChanged( | 75 virtual void OnPolicyStateChanged( |
| 68 policy::CloudPolicySubsystem::PolicySubsystemState state, | 76 policy::CloudPolicySubsystem::PolicySubsystemState state, |
| 69 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; | 77 policy::CloudPolicySubsystem::ErrorDetails error_details) OVERRIDE; |
| 70 | 78 |
| 71 protected: | 79 protected: |
| 72 // Overriden from ViewScreen: | 80 // Overriden from ViewScreen: |
| 73 virtual EnterpriseEnrollmentView* AllocateView() OVERRIDE; | 81 virtual EnterpriseEnrollmentView* AllocateView() OVERRIDE; |
| 74 | 82 |
| 75 private: | 83 private: |
| 76 void HandleAuthError(const GoogleServiceAuthError& error); | 84 void HandleAuthError(const GoogleServiceAuthError& error); |
| 77 | 85 |
| 86 // Starts the Lockbox storage process. |
| 87 void WriteInstallAttributesData(const ClientLoginResult& result); |
| 88 |
| 78 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; | 89 scoped_ptr<GaiaAuthFetcher> auth_fetcher_; |
| 79 std::string user_; | 90 std::string user_; |
| 80 std::string captcha_token_; | 91 std::string captcha_token_; |
| 81 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; | 92 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> registrar_; |
| 93 ScopedRunnableMethodFactory<EnterpriseEnrollmentScreen> |
| 94 runnable_method_factory_; |
| 82 | 95 |
| 83 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); | 96 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreen); |
| 84 }; | 97 }; |
| 85 | 98 |
| 86 } // namespace chromeos | 99 } // namespace chromeos |
| 87 | 100 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_SCREEN_H_ |
| OLD | NEW |