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 19 matching lines...) Expand all Loading... |
30 EnterpriseEnrollmentHelperImpl( | 30 EnterpriseEnrollmentHelperImpl( |
31 EnrollmentStatusConsumer* status_consumer, | 31 EnrollmentStatusConsumer* status_consumer, |
32 const policy::EnrollmentConfig& enrollment_config, | 32 const policy::EnrollmentConfig& enrollment_config, |
33 const std::string& enrolling_user_domain); | 33 const std::string& enrolling_user_domain); |
34 ~EnterpriseEnrollmentHelperImpl() override; | 34 ~EnterpriseEnrollmentHelperImpl() override; |
35 | 35 |
36 // Overridden from EnterpriseEnrollmentHelper: | 36 // Overridden from EnterpriseEnrollmentHelper: |
37 void EnrollUsingAuthCode(const std::string& auth_code, | 37 void EnrollUsingAuthCode(const std::string& auth_code, |
38 bool fetch_additional_token) override; | 38 bool fetch_additional_token) override; |
39 void EnrollUsingToken(const std::string& token) override; | 39 void EnrollUsingToken(const std::string& token) override; |
| 40 void EnrollUsingAttestation() override; |
40 void ClearAuth(const base::Closure& callback) override; | 41 void ClearAuth(const base::Closure& callback) override; |
41 void GetDeviceAttributeUpdatePermission() override; | 42 void GetDeviceAttributeUpdatePermission() override; |
42 void UpdateDeviceAttributes(const std::string& asset_id, | 43 void UpdateDeviceAttributes(const std::string& asset_id, |
43 const std::string& location) override; | 44 const std::string& location) override; |
44 | 45 |
45 private: | 46 private: |
46 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, | 47 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
47 TestProperPageGetsLoadedOnEnrollmentSuccess); | 48 TestProperPageGetsLoadedOnEnrollmentSuccess); |
48 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, | 49 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
49 TestAttributePromptPageGetsLoaded); | 50 TestAttributePromptPageGetsLoaded); |
50 | 51 |
51 void DoEnrollUsingToken(const std::string& token); | 52 void DoEnroll(const std::string& token); |
52 | 53 |
53 // Handles completion of the OAuth2 token fetch attempt. | 54 // Handles completion of the OAuth2 token fetch attempt. |
54 void OnTokenFetched(bool is_additional_token, | 55 void OnTokenFetched(bool is_additional_token, |
55 const std::string& token, | 56 const std::string& token, |
56 const GoogleServiceAuthError& error); | 57 const GoogleServiceAuthError& error); |
57 | 58 |
58 // Handles completion of the enrollment attempt. | 59 // Handles completion of the enrollment attempt. |
59 void OnEnrollmentFinished(policy::EnrollmentStatus status); | 60 void OnEnrollmentFinished(policy::EnrollmentStatus status); |
60 | 61 |
61 // Handles completion of the device attribute update permission request. | 62 // Handles completion of the device attribute update permission request. |
(...skipping 10 matching lines...) Expand all Loading... |
72 void UMA(policy::MetricEnrollment sample); | 73 void UMA(policy::MetricEnrollment sample); |
73 | 74 |
74 // Called by ProfileHelper when a signin profile clearance has finished. | 75 // Called by ProfileHelper when a signin profile clearance has finished. |
75 // |callback| is a callback, that was passed to ClearAuth() before. | 76 // |callback| is a callback, that was passed to ClearAuth() before. |
76 void OnSigninProfileCleared(const base::Closure& callback); | 77 void OnSigninProfileCleared(const base::Closure& callback); |
77 | 78 |
78 const policy::EnrollmentConfig enrollment_config_; | 79 const policy::EnrollmentConfig enrollment_config_; |
79 const std::string enrolling_user_domain_; | 80 const std::string enrolling_user_domain_; |
80 bool fetch_additional_token_; | 81 bool fetch_additional_token_; |
81 | 82 |
82 bool started_; | |
83 std::string additional_token_; | 83 std::string additional_token_; |
84 bool finished_; | 84 enum { |
85 bool success_; | 85 OAUTH_NOT_STARTED, |
86 bool auth_data_cleared_; | 86 OAUTH_STARTED_WITH_AUTH_CODE, |
| 87 OAUTH_STARTED_WITH_TOKEN, |
| 88 OAUTH_FINISHED |
| 89 } oauth_status_ = OAUTH_NOT_STARTED; |
| 90 bool oauth_data_cleared_ = false; |
87 std::string oauth_token_; | 91 std::string oauth_token_; |
| 92 bool success_ = false; |
88 | 93 |
89 std::unique_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; | 94 std::unique_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; |
90 | 95 |
91 base::WeakPtrFactory<EnterpriseEnrollmentHelperImpl> weak_ptr_factory_; | 96 base::WeakPtrFactory<EnterpriseEnrollmentHelperImpl> weak_ptr_factory_; |
92 | 97 |
93 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelperImpl); | 98 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelperImpl); |
94 }; | 99 }; |
95 | 100 |
96 } // namespace chromeos | 101 } // namespace chromeos |
97 | 102 |
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER
_IMPL_H_ | 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER
_IMPL_H_ |
OLD | NEW |