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 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
16 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, | 110 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, |
110 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 111 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
111 ServerBackedStateKeysBroker* state_keys_broker) | 112 ServerBackedStateKeysBroker* state_keys_broker) |
112 : CloudPolicyManager( | 113 : CloudPolicyManager( |
113 dm_protocol::kChromeDevicePolicyType, | 114 dm_protocol::kChromeDevicePolicyType, |
114 std::string(), | 115 std::string(), |
115 store.get(), | 116 store.get(), |
116 task_runner, | 117 task_runner, |
117 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 118 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
118 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)), | 119 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)), |
119 device_store_(store.Pass()), | 120 device_store_(std::move(store)), |
120 state_keys_broker_(state_keys_broker), | 121 state_keys_broker_(state_keys_broker), |
121 task_runner_(task_runner), | 122 task_runner_(task_runner), |
122 local_state_(nullptr) { | 123 local_state_(nullptr) {} |
123 } | |
124 | 124 |
125 DeviceCloudPolicyManagerChromeOS::~DeviceCloudPolicyManagerChromeOS() {} | 125 DeviceCloudPolicyManagerChromeOS::~DeviceCloudPolicyManagerChromeOS() {} |
126 | 126 |
127 void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) { | 127 void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) { |
128 CHECK(local_state); | 128 CHECK(local_state); |
129 | 129 |
130 local_state_ = local_state; | 130 local_state_ = local_state; |
131 | 131 |
132 state_keys_update_subscription_ = state_keys_broker_->RegisterUpdateCallback( | 132 state_keys_update_subscription_ = state_keys_broker_->RegisterUpdateCallback( |
133 base::Bind(&DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated, | 133 base::Bind(&DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 void DeviceCloudPolicyManagerChromeOS::StartConnection( | 244 void DeviceCloudPolicyManagerChromeOS::StartConnection( |
245 scoped_ptr<CloudPolicyClient> client_to_connect, | 245 scoped_ptr<CloudPolicyClient> client_to_connect, |
246 EnterpriseInstallAttributes* install_attributes) { | 246 EnterpriseInstallAttributes* install_attributes) { |
247 CHECK(!service()); | 247 CHECK(!service()); |
248 | 248 |
249 // Set state keys here so the first policy fetch submits them to the server. | 249 // Set state keys here so the first policy fetch submits them to the server. |
250 if (ForcedReEnrollmentEnabled()) | 250 if (ForcedReEnrollmentEnabled()) |
251 client_to_connect->SetStateKeysToUpload(state_keys_broker_->state_keys()); | 251 client_to_connect->SetStateKeysToUpload(state_keys_broker_->state_keys()); |
252 | 252 |
253 core()->Connect(client_to_connect.Pass()); | 253 core()->Connect(std::move(client_to_connect)); |
254 core()->StartRefreshScheduler(); | 254 core()->StartRefreshScheduler(); |
255 core()->StartRemoteCommandsService( | 255 core()->StartRemoteCommandsService( |
256 scoped_ptr<RemoteCommandsFactory>(new DeviceCommandsFactoryChromeOS())); | 256 scoped_ptr<RemoteCommandsFactory>(new DeviceCommandsFactoryChromeOS())); |
257 core()->TrackRefreshDelayPref(local_state_, | 257 core()->TrackRefreshDelayPref(local_state_, |
258 prefs::kDevicePolicyRefreshRate); | 258 prefs::kDevicePolicyRefreshRate); |
259 attestation_policy_observer_.reset( | 259 attestation_policy_observer_.reset( |
260 new chromeos::attestation::AttestationPolicyObserver(client())); | 260 new chromeos::attestation::AttestationPolicyObserver(client())); |
261 | 261 |
262 // Enable device reporting and status monitoring for enterprise enrolled | 262 // Enable device reporting and status monitoring for enterprise enrolled |
263 // devices. We want to create these objects for enrolled devices, even if | 263 // devices. We want to create these objects for enrolled devices, even if |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 make_scoped_ptr(new DeviceStatusCollector( | 350 make_scoped_ptr(new DeviceStatusCollector( |
351 local_state_, chromeos::system::StatisticsProvider::GetInstance(), | 351 local_state_, chromeos::system::StatisticsProvider::GetInstance(), |
352 DeviceStatusCollector::LocationUpdateRequester(), | 352 DeviceStatusCollector::LocationUpdateRequester(), |
353 DeviceStatusCollector::VolumeInfoFetcher(), | 353 DeviceStatusCollector::VolumeInfoFetcher(), |
354 DeviceStatusCollector::CPUStatisticsFetcher(), | 354 DeviceStatusCollector::CPUStatisticsFetcher(), |
355 DeviceStatusCollector::CPUTempFetcher())), | 355 DeviceStatusCollector::CPUTempFetcher())), |
356 task_runner_)); | 356 task_runner_)); |
357 } | 357 } |
358 | 358 |
359 } // namespace policy | 359 } // namespace policy |
OLD | NEW |