| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class EnrollmentScreen | 24 class EnrollmentScreen |
| 25 : public WizardScreen, | 25 : public WizardScreen, |
| 26 public EnrollmentScreenActor::Controller { | 26 public EnrollmentScreenActor::Controller { |
| 27 public: | 27 public: |
| 28 EnrollmentScreen(ScreenObserver* observer, | 28 EnrollmentScreen(ScreenObserver* observer, |
| 29 EnrollmentScreenActor* actor); | 29 EnrollmentScreenActor* actor); |
| 30 virtual ~EnrollmentScreen(); | 30 virtual ~EnrollmentScreen(); |
| 31 | 31 |
| 32 void SetParameters(EnrollmentScreenActor::EnrollmentMode enrollment_mode, | 32 void SetParameters(EnrollmentScreenActor::EnrollmentMode enrollment_mode, |
| 33 const std::string& management_domain, | 33 const std::string& management_domain, |
| 34 const std::string& enrollment_user); | 34 const std::string& enrollment_user, |
| 35 const std::string& auth_token); |
| 35 | 36 |
| 36 // WizardScreen implementation: | 37 // WizardScreen implementation: |
| 37 virtual void PrepareToShow() OVERRIDE; | 38 virtual void PrepareToShow() OVERRIDE; |
| 38 virtual void Show() OVERRIDE; | 39 virtual void Show() OVERRIDE; |
| 39 virtual void Hide() OVERRIDE; | 40 virtual void Hide() OVERRIDE; |
| 40 virtual std::string GetName() const OVERRIDE; | 41 virtual std::string GetName() const OVERRIDE; |
| 41 | 42 |
| 42 // EnrollmentScreenActor::Controller implementation: | 43 // EnrollmentScreenActor::Controller implementation: |
| 43 virtual void OnLoginDone(const std::string& user) OVERRIDE; | 44 virtual void OnLoginDone(const std::string& user) OVERRIDE; |
| 44 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; | 45 virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE; |
| 45 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; | 46 virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE; |
| 46 virtual void OnRetry() OVERRIDE; | 47 virtual void OnRetry() OVERRIDE; |
| 47 virtual void OnCancel() OVERRIDE; | 48 virtual void OnCancel() OVERRIDE; |
| 48 virtual void OnConfirmationClosed() OVERRIDE; | 49 virtual void OnConfirmationClosed() OVERRIDE; |
| 49 | 50 |
| 50 // Used for testing. | 51 // Used for testing. |
| 51 EnrollmentScreenActor* GetActor() { | 52 EnrollmentScreenActor* GetActor() { |
| 52 return actor_; | 53 return actor_; |
| 53 } | 54 } |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); | 57 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| 57 | 58 |
| 58 // Starts the Lockbox storage process. | 59 // Starts the Lockbox storage process. |
| 59 void WriteInstallAttributesData(); | 60 void WriteInstallAttributesData(); |
| 60 | 61 |
| 61 // Kicks off the policy infrastructure to register with the service. | 62 // Kicks off the policy infrastructure to register with the service. |
| 62 void RegisterForDevicePolicy(const std::string& token); | 63 void RegisterForDevicePolicy(const std::string& token); |
| 63 | 64 |
| 65 // Sends an enrollment access token to a remote device. |
| 66 void SendEnrollmentAuthToken(const std::string& token); |
| 67 |
| 64 // Handles enrollment completion. Logs a UMA sample and requests the actor to | 68 // Handles enrollment completion. Logs a UMA sample and requests the actor to |
| 65 // show the specified enrollment status. | 69 // show the specified enrollment status. |
| 66 void ReportEnrollmentStatus(policy::EnrollmentStatus status); | 70 void ReportEnrollmentStatus(policy::EnrollmentStatus status); |
| 67 | 71 |
| 68 // Shows successful enrollment status after all enrollment related file | 72 // Shows successful enrollment status after all enrollment related file |
| 69 // operations are completed. | 73 // operations are completed. |
| 70 void ShowEnrollmentStatusOnSuccess(const policy::EnrollmentStatus& status); | 74 void ShowEnrollmentStatusOnSuccess(const policy::EnrollmentStatus& status); |
| 71 | 75 |
| 72 // Logs a UMA event in the kMetricEnrollment histogram. If auto-enrollment is | 76 // Logs a UMA event in the kMetricEnrollment histogram. If auto-enrollment is |
| 73 // on |sample| is ignored and a kMetricEnrollmentAutoFailed sample is logged | 77 // on |sample| is ignored and a kMetricEnrollmentAutoFailed sample is logged |
| 74 // instead. | 78 // instead. |
| 75 void UMAFailure(int sample); | 79 void UMAFailure(int sample); |
| 76 | 80 |
| 77 // Shows the signin screen. Used as a callback to run after auth reset. | 81 // Shows the signin screen. Used as a callback to run after auth reset. |
| 78 void ShowSigninScreen(); | 82 void ShowSigninScreen(); |
| 79 | 83 |
| 80 // Convenience helper to check for auto enrollment mode. | 84 // Convenience helper to check for auto enrollment mode. |
| 81 bool is_auto_enrollment() const { | 85 bool is_auto_enrollment() const { |
| 82 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; | 86 return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; |
| 83 } | 87 } |
| 84 | 88 |
| 85 EnrollmentScreenActor* actor_; | 89 EnrollmentScreenActor* actor_; |
| 86 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; | 90 EnrollmentScreenActor::EnrollmentMode enrollment_mode_; |
| 87 bool enrollment_failed_once_; | 91 bool enrollment_failed_once_; |
| 88 std::string user_; | 92 std::string user_; |
| 93 std::string auth_token_; |
| 89 int lockbox_init_duration_; | 94 int lockbox_init_duration_; |
| 90 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; | 95 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
| 91 | 96 |
| 92 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); | 97 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
| 93 }; | 98 }; |
| 94 | 99 |
| 95 } // namespace chromeos | 100 } // namespace chromeos |
| 96 | 101 |
| 97 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ | 102 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ |
| OLD | NEW |