Chromium Code Reviews| 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0; | 49 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0; |
| 50 | 50 |
| 51 // Called when some other error happens. | 51 // Called when some other error happens. |
| 52 virtual void OnOtherError(OtherError error) = 0; | 52 virtual void OnOtherError(OtherError error) = 0; |
| 53 | 53 |
| 54 // Called when enrollment finishes successfully. |additional_token| keeps | 54 // Called when enrollment finishes successfully. |additional_token| keeps |
| 55 // the additional access token, if it was requested by setting the | 55 // the additional access token, if it was requested by setting the |
| 56 // |fetch_additional_token| param of EnrollUsingProfile() to true. | 56 // |fetch_additional_token| param of EnrollUsingProfile() to true. |
| 57 // Otherwise, |additional_token| is empty. | 57 // Otherwise, |additional_token| is empty. |
| 58 virtual void OnDeviceEnrolled(const std::string& additional_token) = 0; | 58 virtual void OnDeviceEnrolled(const std::string& additional_token) = 0; |
| 59 | |
| 60 // Called when device attribute update permission granted, | |
| 61 // |status| indicates whether permission granted or not. | |
| 62 virtual void OnDeviceAttributeUpdatePermission(bool status) = 0; | |
| 63 | |
| 64 // Called when device attribute upload finishes. |status| indicates | |
| 65 // whether it is successful or not | |
| 66 virtual void OnDeviceAttributeUploadCompleted(bool status) = 0; | |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 // Factory method. Caller takes ownership of the returned object. | 69 // Factory method. Caller takes ownership of the returned object. |
| 62 static scoped_ptr<EnterpriseEnrollmentHelper> Create( | 70 static scoped_ptr<EnterpriseEnrollmentHelper> Create( |
| 63 EnrollmentStatusConsumer* status_consumer, | 71 EnrollmentStatusConsumer* status_consumer, |
| 64 const policy::EnrollmentConfig& enrollment_config, | 72 const policy::EnrollmentConfig& enrollment_config, |
| 65 const std::string& enrolling_user_domain); | 73 const std::string& enrolling_user_domain); |
| 66 | 74 |
| 67 virtual ~EnterpriseEnrollmentHelper(); | 75 virtual ~EnterpriseEnrollmentHelper(); |
| 68 | 76 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 83 // received token. | 91 // received token. |
| 84 // EnrollUsingAuthCode can be called only once during this object's lifetime, | 92 // EnrollUsingAuthCode can be called only once during this object's lifetime, |
| 85 // and only if neither of EnrollUsing* methods was called before. | 93 // and only if neither of EnrollUsing* methods was called before. |
| 86 virtual void EnrollUsingAuthCode(const std::string& auth_code) = 0; | 94 virtual void EnrollUsingAuthCode(const std::string& auth_code) = 0; |
| 87 | 95 |
| 88 // Starts enterprise enrollment using |token|. | 96 // Starts enterprise enrollment using |token|. |
| 89 // EnrollUsingToken can be called only once during this object's lifetime, and | 97 // EnrollUsingToken can be called only once during this object's lifetime, and |
| 90 // only if neither of EnrollUsing* was called before. | 98 // only if neither of EnrollUsing* was called before. |
| 91 virtual void EnrollUsingToken(const std::string& token) = 0; | 99 virtual void EnrollUsingToken(const std::string& token) = 0; |
| 92 | 100 |
| 101 // Starts device attribute update process. First tries to get | |
| 102 // permission to update device attributes for current user | |
| 103 // using stored during enrollment oauth token. | |
| 104 virtual void GetDeviceAttributeUpdatePermission() = 0; | |
| 105 | |
| 106 // Uploads device attributes on DM server. |asset_id| - Asset Identifier | |
| 107 // and |location| - Assigned Location, these attributes were typed by | |
| 108 // current user on the device attribute prompt screen after successful | |
| 109 // enrollment. | |
| 110 virtual void UpdateDeviceAttributes(const std::string& asset_id, | |
| 111 const std::string& location) = 0; | |
| 112 | |
| 93 // Clears authentication data from the profile (if EnrollUsingProfile was | 113 // Clears authentication data from the profile (if EnrollUsingProfile was |
| 94 // used) and revokes fetched tokens. | 114 // used) and revokes fetched tokens. |
| 95 // Does not revoke the additional token if enrollment finished successfully. | 115 // Does not revoke the additional token if enrollment finished successfully. |
| 96 // Calls |callback| on completion. | 116 // Calls |callback| on completion. |
| 97 virtual void ClearAuth(const base::Closure& callback) = 0; | 117 virtual void ClearAuth(const base::Closure& callback) = 0; |
| 98 | 118 |
| 99 protected: | 119 protected: |
| 100 // |status_consumer| must outlive |this|. Moreover, the user of this class | 120 // |status_consumer| must outlive |this|. Moreover, the user of this class |
| 101 // is responsible for clearing auth data in some cases (see comment for | 121 // is responsible for clearing auth data in some cases (see comment for |
| 102 // EnrollUsingProfile()). | 122 // EnrollUsingProfile()). |
| 103 explicit EnterpriseEnrollmentHelper( | 123 explicit EnterpriseEnrollmentHelper( |
| 104 EnrollmentStatusConsumer* status_consumer); | 124 EnrollmentStatusConsumer* status_consumer); |
| 105 | 125 |
| 106 EnrollmentStatusConsumer* status_consumer() { return status_consumer_; } | 126 EnrollmentStatusConsumer* status_consumer() { return status_consumer_; } |
| 107 | 127 |
| 108 private: | 128 private: |
| 129 // Gets oauth token, used during enterprise enrollment. | |
|
dzhioev (left Google)
2015/04/14 15:48:19
As far as I can see, you don't need to declare thi
Polina Bondarenko
2015/04/14 16:14:32
Done.
| |
| 130 virtual const std::string& GetOAuthToken() = 0; | |
| 131 | |
| 109 EnrollmentStatusConsumer* status_consumer_; | 132 EnrollmentStatusConsumer* status_consumer_; |
| 110 | 133 |
| 111 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper); | 134 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper); |
| 112 }; | 135 }; |
| 113 | 136 |
| 114 } // namespace chromeos | 137 } // namespace chromeos |
| 115 | 138 |
| 116 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_ | 139 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_ |
| OLD | NEW |