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