Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper.h

Issue 2977033002: Mixed Licenses Enrollment (Closed)
Patch Set: Fix last nit Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map>
8 #include <memory> 9 #include <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
15 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
14 16
15 class GoogleServiceAuthError; 17 class GoogleServiceAuthError;
16 18
17 namespace policy { 19 namespace policy {
18 struct EnrollmentConfig; 20 struct EnrollmentConfig;
19 class EnrollmentStatus; 21 class EnrollmentStatus;
20 } 22 }
21 23
22 namespace chromeos { 24 namespace chromeos {
23 25
26 // Maps a license type to number of available licenses.
27 using EnrollmentLicenseMap = std::map<policy::LicenseType, int>;
28
24 class ActiveDirectoryJoinDelegate; 29 class ActiveDirectoryJoinDelegate;
25 30
26 // This class is capable to enroll the device into enterprise domain, using 31 // This class is capable to enroll the device into enterprise domain, using
27 // either a profile containing authentication data or OAuth token. 32 // either a profile containing authentication data or OAuth token.
28 // It can also clear an authentication data from the profile and revoke tokens 33 // It can also clear an authentication data from the profile and revoke tokens
29 // that are not longer needed. 34 // that are not longer needed.
30 class EnterpriseEnrollmentHelper { 35 class EnterpriseEnrollmentHelper {
31 public: 36 public:
32 typedef policy::DeviceCloudPolicyInitializer::EnrollmentCallback 37 using EnrollmentCallback =
33 EnrollmentCallback; 38 policy::DeviceCloudPolicyInitializer::EnrollmentCallback;
34 39
35 // Enumeration of the possible errors that can occur during enrollment which 40 // Enumeration of the possible errors that can occur during enrollment which
36 // are not covered by GoogleServiceAuthError or EnrollmentStatus. 41 // are not covered by GoogleServiceAuthError or EnrollmentStatus.
37 enum OtherError { 42 enum OtherError {
38 // Existing enrollment domain doesn't match authentication user. 43 // Existing enrollment domain doesn't match authentication user.
39 OTHER_ERROR_DOMAIN_MISMATCH, 44 OTHER_ERROR_DOMAIN_MISMATCH,
40 // Unexpected error condition, indicates a bug in the code. 45 // Unexpected error condition, indicates a bug in the code.
41 OTHER_ERROR_FATAL 46 OTHER_ERROR_FATAL
42 }; 47 };
43 48
44 class EnrollmentStatusConsumer { 49 class EnrollmentStatusConsumer {
45 public: 50 public:
46 // Called when an error happens on attempt to receive authentication tokens. 51 // Called when an error happens on attempt to receive authentication tokens.
47 virtual void OnAuthError(const GoogleServiceAuthError& error) = 0; 52 virtual void OnAuthError(const GoogleServiceAuthError& error) = 0;
48 53
54 // Called when there are multiple license types available for enrollment,
55 // and admin allowed user to choose license type to assign.
56 // Enrollment is paused, and will resume once UseLicenseType() is called.
57 virtual void OnMultipleLicensesAvailable(
58 const EnrollmentLicenseMap& licenses) = 0;
59
49 // Called when an error happens during enrollment. 60 // Called when an error happens during enrollment.
50 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0; 61 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0;
51 62
52 // Called when some other error happens. 63 // Called when some other error happens.
53 virtual void OnOtherError(OtherError error) = 0; 64 virtual void OnOtherError(OtherError error) = 0;
54 65
55 // Called when enrollment finishes successfully. |additional_token| keeps 66 // Called when enrollment finishes successfully. |additional_token| keeps
56 // the additional access token, if it was requested by setting the 67 // the additional access token, if it was requested by setting the
57 // |fetch_additional_token| param of EnrollUsingProfile() to true. 68 // |fetch_additional_token| param of EnrollUsingProfile() to true.
58 // Otherwise, |additional_token| is empty. 69 // Otherwise, |additional_token| is empty.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Starts enterprise enrollment using |token|. 110 // Starts enterprise enrollment using |token|.
100 // EnrollUsingToken can be called only once during this object's lifetime, and 111 // EnrollUsingToken can be called only once during this object's lifetime, and
101 // only if none of the EnrollUsing* was called before. 112 // only if none of the EnrollUsing* was called before.
102 virtual void EnrollUsingToken(const std::string& token) = 0; 113 virtual void EnrollUsingToken(const std::string& token) = 0;
103 114
104 // Starts enterprise enrollment using PCA attestation. 115 // Starts enterprise enrollment using PCA attestation.
105 // EnrollUsingAttestation can be called only once during the object's 116 // EnrollUsingAttestation can be called only once during the object's
106 // lifetime, and only if none of the EnrollUsing* was called before. 117 // lifetime, and only if none of the EnrollUsing* was called before.
107 virtual void EnrollUsingAttestation() = 0; 118 virtual void EnrollUsingAttestation() = 0;
108 119
120 // Continue enrollment using license |type|.
121 virtual void UseLicenseType(policy::LicenseType type) = 0;
122
109 // Starts device attribute update process. First tries to get 123 // Starts device attribute update process. First tries to get
110 // permission to update device attributes for current user 124 // permission to update device attributes for current user
111 // using stored during enrollment oauth token. 125 // using stored during enrollment oauth token.
112 virtual void GetDeviceAttributeUpdatePermission() = 0; 126 virtual void GetDeviceAttributeUpdatePermission() = 0;
113 127
114 // Uploads device attributes on DM server. |asset_id| - Asset Identifier 128 // Uploads device attributes on DM server. |asset_id| - Asset Identifier
115 // and |location| - Assigned Location, these attributes were typed by 129 // and |location| - Assigned Location, these attributes were typed by
116 // current user on the device attribute prompt screen after successful 130 // current user on the device attribute prompt screen after successful
117 // enrollment. 131 // enrollment.
118 virtual void UpdateDeviceAttributes(const std::string& asset_id, 132 virtual void UpdateDeviceAttributes(const std::string& asset_id,
(...skipping 20 matching lines...) Expand all
139 // If this is not nullptr, then it will be used to create the enrollment 153 // If this is not nullptr, then it will be used to create the enrollment
140 // helper. |create_mock_enrollment_helper_| needs to outlive this class. 154 // helper. |create_mock_enrollment_helper_| needs to outlive this class.
141 static CreateMockEnrollmentHelper create_mock_enrollment_helper_; 155 static CreateMockEnrollmentHelper create_mock_enrollment_helper_;
142 156
143 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper); 157 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper);
144 }; 158 };
145 159
146 } // namespace chromeos 160 } // namespace chromeos
147 161
148 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_ 162 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698