| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) { | 134 void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) { |
| 135 CHECK(local_state); | 135 CHECK(local_state); |
| 136 | 136 |
| 137 local_state_ = local_state; | 137 local_state_ = local_state; |
| 138 | 138 |
| 139 state_keys_update_subscription_ = state_keys_broker_->RegisterUpdateCallback( | 139 state_keys_update_subscription_ = state_keys_broker_->RegisterUpdateCallback( |
| 140 base::Bind(&DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated, | 140 base::Bind(&DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated, |
| 141 base::Unretained(this))); | 141 base::Unretained(this))); |
| 142 | 142 |
| 143 InitializeRequisition(); | 143 InitializeRequisition(); |
| 144 InitializeEnrollment(); | |
| 145 } | 144 } |
| 146 | 145 |
| 147 void DeviceCloudPolicyManagerChromeOS::AddDeviceCloudPolicyManagerObserver( | 146 void DeviceCloudPolicyManagerChromeOS::AddDeviceCloudPolicyManagerObserver( |
| 148 Observer* observer) { | 147 Observer* observer) { |
| 149 observers_.AddObserver(observer); | 148 observers_.AddObserver(observer); |
| 150 } | 149 } |
| 151 | 150 |
| 152 void DeviceCloudPolicyManagerChromeOS::RemoveDeviceCloudPolicyManagerObserver( | 151 void DeviceCloudPolicyManagerChromeOS::RemoveDeviceCloudPolicyManagerObserver( |
| 153 Observer* observer) { | 152 Observer* observer) { |
| 154 observers_.RemoveObserver(observer); | 153 observers_.RemoveObserver(observer); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 false)); | 356 false)); |
| 358 local_state_->SetBoolean( | 357 local_state_->SetBoolean( |
| 359 prefs::kDeviceEnrollmentCanExit, | 358 prefs::kDeviceEnrollmentCanExit, |
| 360 GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, | 359 GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, |
| 361 false)); | 360 false)); |
| 362 } | 361 } |
| 363 } | 362 } |
| 364 } | 363 } |
| 365 } | 364 } |
| 366 | 365 |
| 367 void DeviceCloudPolicyManagerChromeOS::InitializeEnrollment() { | |
| 368 // Enrollment happens during OOBE only. | |
| 369 if (chromeos::StartupUtils::IsOobeCompleted()) | |
| 370 return; | |
| 371 | |
| 372 if (DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode() == | |
| 373 ZeroTouchEnrollmentMode::FORCED) { | |
| 374 SetDeviceEnrollmentAutoStart(); | |
| 375 } | |
| 376 } | |
| 377 | |
| 378 void DeviceCloudPolicyManagerChromeOS::NotifyConnected() { | 366 void DeviceCloudPolicyManagerChromeOS::NotifyConnected() { |
| 379 FOR_EACH_OBSERVER( | 367 FOR_EACH_OBSERVER( |
| 380 Observer, observers_, OnDeviceCloudPolicyManagerConnected()); | 368 Observer, observers_, OnDeviceCloudPolicyManagerConnected()); |
| 381 } | 369 } |
| 382 | 370 |
| 383 void DeviceCloudPolicyManagerChromeOS::NotifyDisconnected() { | 371 void DeviceCloudPolicyManagerChromeOS::NotifyDisconnected() { |
| 384 FOR_EACH_OBSERVER( | 372 FOR_EACH_OBSERVER( |
| 385 Observer, observers_, OnDeviceCloudPolicyManagerDisconnected()); | 373 Observer, observers_, OnDeviceCloudPolicyManagerDisconnected()); |
| 386 } | 374 } |
| 387 | 375 |
| 388 void DeviceCloudPolicyManagerChromeOS::CreateStatusUploader() { | 376 void DeviceCloudPolicyManagerChromeOS::CreateStatusUploader() { |
| 389 status_uploader_.reset(new StatusUploader( | 377 status_uploader_.reset(new StatusUploader( |
| 390 client(), | 378 client(), |
| 391 base::WrapUnique(new DeviceStatusCollector( | 379 base::WrapUnique(new DeviceStatusCollector( |
| 392 local_state_, chromeos::system::StatisticsProvider::GetInstance(), | 380 local_state_, chromeos::system::StatisticsProvider::GetInstance(), |
| 393 DeviceStatusCollector::LocationUpdateRequester(), | 381 DeviceStatusCollector::LocationUpdateRequester(), |
| 394 DeviceStatusCollector::VolumeInfoFetcher(), | 382 DeviceStatusCollector::VolumeInfoFetcher(), |
| 395 DeviceStatusCollector::CPUStatisticsFetcher(), | 383 DeviceStatusCollector::CPUStatisticsFetcher(), |
| 396 DeviceStatusCollector::CPUTempFetcher())), | 384 DeviceStatusCollector::CPUTempFetcher())), |
| 397 task_runner_)); | 385 task_runner_)); |
| 398 } | 386 } |
| 399 | 387 |
| 400 } // namespace policy | 388 } // namespace policy |
| OLD | NEW |