| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ENTERPRISE_ENROLLMENT_HELPER_IM
PL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_IM
PL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_IM
PL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_IM
PL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const policy::EnrollmentConfig& enrollment_config, | 35 const policy::EnrollmentConfig& enrollment_config, |
| 36 const std::string& enrolling_user_domain); | 36 const std::string& enrolling_user_domain); |
| 37 ~EnterpriseEnrollmentHelperImpl() override; | 37 ~EnterpriseEnrollmentHelperImpl() override; |
| 38 | 38 |
| 39 // Overridden from EnterpriseEnrollmentHelper: | 39 // Overridden from EnterpriseEnrollmentHelper: |
| 40 void EnrollUsingProfile(Profile* profile, | 40 void EnrollUsingProfile(Profile* profile, |
| 41 bool fetch_additional_token) override; | 41 bool fetch_additional_token) override; |
| 42 void EnrollUsingAuthCode(const std::string& auth_code) override; | 42 void EnrollUsingAuthCode(const std::string& auth_code) override; |
| 43 void EnrollUsingToken(const std::string& token) override; | 43 void EnrollUsingToken(const std::string& token) override; |
| 44 void ClearAuth(const base::Closure& callback) override; | 44 void ClearAuth(const base::Closure& callback) override; |
| 45 void GetDeviceAttributeUpdatePermission() override; |
| 46 void UpdateDeviceAttributes(const std::string& asset_id, |
| 47 const std::string& location) override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 void DoEnrollUsingToken(const std::string& token); | 50 void DoEnrollUsingToken(const std::string& token); |
| 48 | 51 |
| 49 // Handles completion of the OAuth2 token fetch attempt. | 52 // Handles completion of the OAuth2 token fetch attempt. |
| 50 void OnTokenFetched(size_t fetcher_index, | 53 void OnTokenFetched(size_t fetcher_index, |
| 51 const std::string& token, | 54 const std::string& token, |
| 52 const GoogleServiceAuthError& error); | 55 const GoogleServiceAuthError& error); |
| 53 | 56 |
| 54 // Handles completion of the enrollment attempt. | 57 // Handles completion of the enrollment attempt. |
| 55 void OnEnrollmentFinished(policy::EnrollmentStatus status); | 58 void OnEnrollmentFinished(policy::EnrollmentStatus status); |
| 56 | 59 |
| 60 // Handles completion of the device attribute update permission request. |
| 61 void OnDeviceAttributeUpdatePermission(bool granted); |
| 62 |
| 63 // Handles completion of the device attribute update attempt. |
| 64 void OnDeviceAttributeUploadCompleted(bool success); |
| 65 |
| 57 void ReportAuthStatus(const GoogleServiceAuthError& error); | 66 void ReportAuthStatus(const GoogleServiceAuthError& error); |
| 58 void ReportEnrollmentStatus(policy::EnrollmentStatus status); | 67 void ReportEnrollmentStatus(policy::EnrollmentStatus status); |
| 59 | 68 |
| 60 // Logs an UMA event in the kMetricEnrollment or the kMetricEnrollmentRecovery | 69 // Logs an UMA event in the kMetricEnrollment or the kMetricEnrollmentRecovery |
| 61 // histogram, depending on |enrollment_mode_|. | 70 // histogram, depending on |enrollment_mode_|. |
| 62 void UMA(policy::MetricEnrollment sample); | 71 void UMA(policy::MetricEnrollment sample); |
| 63 | 72 |
| 64 // Overridden from BrowsingDataRemover::Observer: | 73 // Overridden from BrowsingDataRemover::Observer: |
| 65 void OnBrowsingDataRemoverDone() override; | 74 void OnBrowsingDataRemoverDone() override; |
| 66 | 75 |
| 76 // Gets oauth token, used during enterprise enrollment. |
| 77 const std::string& GetOAuthToken(); |
| 78 |
| 67 const policy::EnrollmentConfig enrollment_config_; | 79 const policy::EnrollmentConfig enrollment_config_; |
| 68 const std::string enrolling_user_domain_; | 80 const std::string enrolling_user_domain_; |
| 69 Profile* profile_; | 81 Profile* profile_; |
| 70 bool fetch_additional_token_; | 82 bool fetch_additional_token_; |
| 71 | 83 |
| 72 bool started_; | 84 bool started_; |
| 73 size_t oauth_fetchers_finished_; | 85 size_t oauth_fetchers_finished_; |
| 74 GoogleServiceAuthError last_auth_error_; | 86 GoogleServiceAuthError last_auth_error_; |
| 75 std::string additional_token_; | 87 std::string additional_token_; |
| 76 bool finished_; | 88 bool finished_; |
| 77 bool success_; | 89 bool success_; |
| 78 bool auth_data_cleared_; | 90 bool auth_data_cleared_; |
| 79 | 91 |
| 80 // The browsing data remover instance currently active, if any. | 92 // The browsing data remover instance currently active, if any. |
| 81 BrowsingDataRemover* browsing_data_remover_; | 93 BrowsingDataRemover* browsing_data_remover_; |
| 82 | 94 |
| 83 // The callbacks to invoke after browsing data has been cleared. | 95 // The callbacks to invoke after browsing data has been cleared. |
| 84 std::vector<base::Closure> auth_clear_callbacks_; | 96 std::vector<base::Closure> auth_clear_callbacks_; |
| 85 | 97 |
| 86 ScopedVector<policy::PolicyOAuth2TokenFetcher> oauth_fetchers_; | 98 ScopedVector<policy::PolicyOAuth2TokenFetcher> oauth_fetchers_; |
| 87 | 99 |
| 88 base::WeakPtrFactory<EnterpriseEnrollmentHelperImpl> weak_ptr_factory_; | 100 base::WeakPtrFactory<EnterpriseEnrollmentHelperImpl> weak_ptr_factory_; |
| 89 | 101 |
| 90 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelperImpl); | 102 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelperImpl); |
| 91 }; | 103 }; |
| 92 | 104 |
| 93 } // namespace chromeos | 105 } // namespace chromeos |
| 94 | 106 |
| 95 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER
_IMPL_H_ | 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER
_IMPL_H_ |
| OLD | NEW |