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 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/port.h" | 10 #include "base/port.h" |
11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" | 16 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" |
| 17 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" |
17 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
18 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
19 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" |
20 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 21 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
21 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" | 22 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" |
22 #include "chrome/common/chrome_content_client.h" | 23 #include "chrome/common/chrome_content_client.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chromeos/chromeos_constants.h" | 25 #include "chromeos/chromeos_constants.h" |
25 #include "chromeos/chromeos_switches.h" | 26 #include "chromeos/chromeos_switches.h" |
26 #include "chromeos/system/statistics_provider.h" | 27 #include "chromeos/system/statistics_provider.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scoped_ptr<CloudPolicyClient> client( | 299 scoped_ptr<CloudPolicyClient> client( |
299 new CloudPolicyClient(GetMachineID(), GetMachineModel(), | 300 new CloudPolicyClient(GetMachineID(), GetMachineModel(), |
300 kPolicyVerificationKeyHash, | 301 kPolicyVerificationKeyHash, |
301 USER_AFFILIATION_NONE, | 302 USER_AFFILIATION_NONE, |
302 device_status_provider_.get(), | 303 device_status_provider_.get(), |
303 device_management_service_, | 304 device_management_service_, |
304 request_context)); | 305 request_context)); |
305 | 306 |
306 // Set state keys to upload immediately after creation so the first policy | 307 // Set state keys to upload immediately after creation so the first policy |
307 // fetch submits them to the server. | 308 // fetch submits them to the server. |
308 if (CommandLine::ForCurrentProcess()->HasSwitch( | 309 if (chromeos::AutoEnrollmentController::GetMode() == |
309 chromeos::switches::kEnterpriseEnableForcedReEnrollment)) { | 310 chromeos::AutoEnrollmentController::MODE_FORCED_RE_ENROLLMENT) { |
310 std::vector<std::string> state_keys; | 311 std::vector<std::string> state_keys; |
311 if (GetDeviceStateKeys(base::Time::Now(), &state_keys)) | 312 if (GetDeviceStateKeys(base::Time::Now(), &state_keys)) |
312 client->SetStateKeysToUpload(state_keys); | 313 client->SetStateKeysToUpload(state_keys); |
313 } | 314 } |
314 | 315 |
315 return client.Pass(); | 316 return client.Pass(); |
316 } | 317 } |
317 | 318 |
318 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 319 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
319 const EnrollmentCallback& callback, | 320 const EnrollmentCallback& callback, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 crypto::SHA256HashString(disk_serial_number) + | 419 crypto::SHA256HashString(disk_serial_number) + |
419 crypto::SHA256HashString(machine_id) + | 420 crypto::SHA256HashString(machine_id) + |
420 crypto::SHA256HashString(base::Int64ToString(quantized_time)))); | 421 crypto::SHA256HashString(base::Int64ToString(quantized_time)))); |
421 quantized_time += quantum_size; | 422 quantized_time += quantum_size; |
422 } | 423 } |
423 | 424 |
424 return true; | 425 return true; |
425 } | 426 } |
426 | 427 |
427 } // namespace policy | 428 } // namespace policy |
OLD | NEW |