Chromium Code Reviews| 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_manager_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.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 "chrome/browser/policy/cloud/cloud_policy_client.h" | 18 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
| 19 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 19 #include "chrome/browser/policy/cloud/cloud_policy_store.h" |
| 20 #include "google_apis/gaia/gaia_oauth_client.h" | 20 #include "google_apis/gaia/gaia_oauth_client.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace chromeos { | |
| 27 class DeviceOAuth2TokenService; | |
| 28 } | |
| 29 | |
| 26 namespace enterprise_management { | 30 namespace enterprise_management { |
| 27 class PolicyFetchResponse; | 31 class PolicyFetchResponse; |
| 28 } | 32 } |
| 29 | 33 |
| 30 namespace policy { | 34 namespace policy { |
| 31 | 35 |
| 32 // Implements the logic that establishes enterprise enrollment for Chromium OS | 36 // Implements the logic that establishes enterprise enrollment for Chromium OS |
| 33 // devices. The process is as follows: | 37 // devices. The process is as follows: |
| 34 // 1. Given an auth token, register with the policy service. | 38 // 1. Given an auth token, register with the policy service. |
| 35 // 2. Download the initial policy blob from the service. | 39 // 2. Download the initial policy blob from the service. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 DeviceMode device_mode, | 139 DeviceMode device_mode, |
| 136 const std::string& device_id, | 140 const std::string& device_id, |
| 137 EnterpriseInstallAttributes::LockResult lock_result); | 141 EnterpriseInstallAttributes::LockResult lock_result); |
| 138 | 142 |
| 139 // Drops any ongoing actions. | 143 // Drops any ongoing actions. |
| 140 void Stop(); | 144 void Stop(); |
| 141 | 145 |
| 142 // Reports the result of the enrollment process to the initiator. | 146 // Reports the result of the enrollment process to the initiator. |
| 143 void ReportResult(EnrollmentStatus status); | 147 void ReportResult(EnrollmentStatus status); |
| 144 | 148 |
| 149 // Continuation of OnStoreLoaded(). | |
| 150 void DidGetTokenService(chromeos::DeviceOAuth2TokenService* token_service); | |
| 151 | |
| 145 DeviceCloudPolicyStoreChromeOS* store_; | 152 DeviceCloudPolicyStoreChromeOS* store_; |
| 146 EnterpriseInstallAttributes* install_attributes_; | 153 EnterpriseInstallAttributes* install_attributes_; |
| 147 scoped_ptr<CloudPolicyClient> client_; | 154 scoped_ptr<CloudPolicyClient> client_; |
| 148 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 155 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 149 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 156 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
| 150 | 157 |
| 151 std::string auth_token_; | 158 std::string auth_token_; |
| 152 std::string client_id_; | 159 std::string client_id_; |
| 153 std::string robot_refresh_token_; | 160 std::string robot_refresh_token_; |
| 154 bool is_auto_enrollment_; | 161 bool is_auto_enrollment_; |
| 155 std::string requisition_; | 162 std::string requisition_; |
| 156 AllowedDeviceModes allowed_device_modes_; | 163 AllowedDeviceModes allowed_device_modes_; |
| 157 EnrollmentCallback completion_callback_; | 164 EnrollmentCallback completion_callback_; |
| 158 | 165 |
| 159 // The device mode as received in the registration request. | 166 // The device mode as received in the registration request. |
| 160 DeviceMode device_mode_; | 167 DeviceMode device_mode_; |
| 161 | 168 |
| 162 // The validated policy response info to be installed in the store. | 169 // The validated policy response info to be installed in the store. |
| 163 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; | 170 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; |
| 164 std::string username_; | 171 std::string username_; |
| 165 std::string device_id_; | 172 std::string device_id_; |
| 166 | 173 |
| 167 // Current enrollment step. | 174 // Current enrollment step. |
| 168 EnrollmentStep enrollment_step_; | 175 EnrollmentStep enrollment_step_; |
| 169 | 176 |
| 170 // Total amount of time in milliseconds spent waiting for lockbox | 177 // Total amount of time in milliseconds spent waiting for lockbox |
| 171 // initialization. | 178 // initialization. |
| 172 int lockbox_init_duration_; | 179 int lockbox_init_duration_; |
| 173 | 180 |
| 174 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_factory_; | 181 // Used for locking the device. |
| 182 base::WeakPtrFactory<EnrollmentHandlerChromeOS> lock_weak_factory_; | |
| 183 // Used for getting the OAuth2 token service. This needs to be separate | |
|
pneubeck (no reviews)
2013/10/23 07:27:38
nit: empty line before comment.
satorux1
2013/10/24 01:49:26
Done.
| |
| 184 // as lock_weak_factory_ could be invalidated at a random time. | |
| 185 base::WeakPtrFactory<EnrollmentHandlerChromeOS> token_weak_factory_; | |
| 175 | 186 |
| 176 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 187 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 177 }; | 188 }; |
| 178 | 189 |
| 179 } // namespace policy | 190 } // namespace policy |
| 180 | 191 |
| 181 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 192 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |