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_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
17 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 17 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
18 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
21 #include "google_apis/gaia/gaia_oauth_client.h" | 21 #include "google_apis/gaia/gaia_oauth_client.h" |
22 #include "policy/proto/device_management_backend.pb.h" | 22 #include "policy/proto/device_management_backend.pb.h" |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class SequencedTaskRunner; | 25 class SequencedTaskRunner; |
26 } | 26 } |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 class DeviceSettingsService; | 29 class DeviceSettingsService; |
| 30 class OwnerSettingsServiceChromeOS; |
30 } | 31 } |
31 | 32 |
32 namespace policy { | 33 namespace policy { |
33 | 34 |
34 class DeviceCloudPolicyStoreChromeOS; | 35 class DeviceCloudPolicyStoreChromeOS; |
35 class ServerBackedStateKeysBroker; | 36 class ServerBackedStateKeysBroker; |
36 | 37 |
37 // Implements the logic that establishes enterprise enrollment for Chromium OS | 38 // Implements the logic that establishes enterprise enrollment for Chromium OS |
38 // devices. The process is as follows: | 39 // devices. The process is as follows: |
39 // 1. Given an auth token, register with the policy service. | 40 // 1. Given an auth token, register with the policy service. |
(...skipping 18 matching lines...) Expand all Loading... |
58 // enrollment handler. |allowed_device_modes| determines what device modes | 59 // enrollment handler. |allowed_device_modes| determines what device modes |
59 // are acceptable. If the mode specified by the server is not acceptable, | 60 // are acceptable. If the mode specified by the server is not acceptable, |
60 // enrollment will fail with an EnrollmentStatus indicating | 61 // enrollment will fail with an EnrollmentStatus indicating |
61 // STATUS_REGISTRATION_BAD_MODE. | 62 // STATUS_REGISTRATION_BAD_MODE. |
62 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. | 63 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. |
63 EnrollmentHandlerChromeOS( | 64 EnrollmentHandlerChromeOS( |
64 DeviceCloudPolicyStoreChromeOS* store, | 65 DeviceCloudPolicyStoreChromeOS* store, |
65 EnterpriseInstallAttributes* install_attributes, | 66 EnterpriseInstallAttributes* install_attributes, |
66 ServerBackedStateKeysBroker* state_keys_broker, | 67 ServerBackedStateKeysBroker* state_keys_broker, |
67 chromeos::DeviceSettingsService* device_settings_service, | 68 chromeos::DeviceSettingsService* device_settings_service, |
| 69 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service, |
68 scoped_ptr<CloudPolicyClient> client, | 70 scoped_ptr<CloudPolicyClient> client, |
69 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 71 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
70 const std::string& auth_token, | 72 const std::string& auth_token, |
71 const std::string& client_id, | 73 const std::string& client_id, |
72 const std::string& requisition, | 74 const std::string& requisition, |
73 const AllowedDeviceModes& allowed_device_modes, | 75 const AllowedDeviceModes& allowed_device_modes, |
74 ManagementMode management_mode, | 76 ManagementMode management_mode, |
75 const EnrollmentCallback& completion_callback); | 77 const EnrollmentCallback& completion_callback); |
76 virtual ~EnrollmentHandlerChromeOS(); | 78 virtual ~EnrollmentHandlerChromeOS(); |
77 | 79 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 130 |
129 // Handles the policy validation result, proceeding with device lock if | 131 // Handles the policy validation result, proceeding with device lock if |
130 // successful. | 132 // successful. |
131 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); | 133 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); |
132 | 134 |
133 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 135 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
134 // DeviceSettingsService::SetManagementSettings() for consumer | 136 // DeviceSettingsService::SetManagementSettings() for consumer |
135 // enrollment. | 137 // enrollment. |
136 void StartLockDevice(); | 138 void StartLockDevice(); |
137 | 139 |
138 // Checks the status after SetManagementSettings() is done. Proceeds to | 140 // Called after SetManagementSettings() is done. Proceeds to robot |
139 // robot auth code storing if successful. | 141 // auth code storing if successful. |
140 void HandleSetManagementSettingsDone(); | 142 void HandleSetManagementSettingsDone(bool success); |
141 | 143 |
142 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 144 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
143 void HandleLockDeviceResult( | 145 void HandleLockDeviceResult( |
144 EnterpriseInstallAttributes::LockResult lock_result); | 146 EnterpriseInstallAttributes::LockResult lock_result); |
145 | 147 |
146 // Initiates storing of robot auth token. | 148 // Initiates storing of robot auth token. |
147 void StartStoreRobotAuth(); | 149 void StartStoreRobotAuth(); |
148 | 150 |
149 // Handles completion of the robot token store operation. | 151 // Handles completion of the robot token store operation. |
150 void HandleStoreRobotAuthTokenResult(bool result); | 152 void HandleStoreRobotAuthTokenResult(bool result); |
151 | 153 |
152 // Drops any ongoing actions. | 154 // Drops any ongoing actions. |
153 void Stop(); | 155 void Stop(); |
154 | 156 |
155 // Reports the result of the enrollment process to the initiator. | 157 // Reports the result of the enrollment process to the initiator. |
156 void ReportResult(EnrollmentStatus status); | 158 void ReportResult(EnrollmentStatus status); |
157 | 159 |
158 DeviceCloudPolicyStoreChromeOS* store_; | 160 DeviceCloudPolicyStoreChromeOS* store_; |
159 EnterpriseInstallAttributes* install_attributes_; | 161 EnterpriseInstallAttributes* install_attributes_; |
160 ServerBackedStateKeysBroker* state_keys_broker_; | 162 ServerBackedStateKeysBroker* state_keys_broker_; |
161 chromeos::DeviceSettingsService* device_settings_service_; | 163 chromeos::DeviceSettingsService* device_settings_service_; |
| 164 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service_; |
162 scoped_ptr<CloudPolicyClient> client_; | 165 scoped_ptr<CloudPolicyClient> client_; |
163 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 166 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
164 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 167 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
165 | 168 |
166 std::string auth_token_; | 169 std::string auth_token_; |
167 std::string client_id_; | 170 std::string client_id_; |
168 std::string requisition_; | 171 std::string requisition_; |
169 std::string current_state_key_; | 172 std::string current_state_key_; |
170 std::string refresh_token_; | 173 std::string refresh_token_; |
171 AllowedDeviceModes allowed_device_modes_; | 174 AllowedDeviceModes allowed_device_modes_; |
(...skipping 17 matching lines...) Expand all Loading... |
189 int lockbox_init_duration_; | 192 int lockbox_init_duration_; |
190 | 193 |
191 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 194 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
192 | 195 |
193 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 196 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
194 }; | 197 }; |
195 | 198 |
196 } // namespace policy | 199 } // namespace policy |
197 | 200 |
198 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 201 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
OLD | NEW |