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 #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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" | 17 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" |
| 18 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" | 18 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" |
| 19 #include "chrome/browser/chromeos/login/startup_utils.h" | 19 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 20 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 21 #include "chrome/browser/chromeos/policy/device_status_collector.h" | 21 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
| 22 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 22 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 23 #include "chrome/browser/chromeos/policy/heartbeat_scheduler.h" | 23 #include "chrome/browser/chromeos/policy/heartbeat_scheduler.h" |
| 24 #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory _chromeos.h" | 24 #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory _chromeos.h" |
| 25 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 25 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| 26 #include "chrome/browser/chromeos/policy/status_uploader.h" | 26 #include "chrome/browser/chromeos/policy/status_uploader.h" |
| 27 #include "chrome/browser/chromeos/policy/system_log_delegate.h" | |
| 28 #include "chrome/browser/chromeos/policy/system_log_upload_job.h" | |
| 29 #include "chrome/browser/chromeos/policy/system_log_uploader.h" | |
| 27 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 28 #include "chromeos/chromeos_constants.h" | 31 #include "chromeos/chromeos_constants.h" |
| 29 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 30 #include "chromeos/system/statistics_provider.h" | 33 #include "chromeos/system/statistics_provider.h" |
| 31 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 34 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 32 #include "components/policy/core/common/cloud/cloud_policy_service.h" | 35 #include "components/policy/core/common/cloud/cloud_policy_service.h" |
| 33 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 36 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 34 #include "components/policy/core/common/remote_commands/remote_commands_factory. h" | 37 #include "components/policy/core/common/remote_commands/remote_commands_factory. h" |
| 35 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 36 #include "crypto/sha2.h" | 39 #include "crypto/sha2.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 attestation_policy_observer_.reset( | 249 attestation_policy_observer_.reset( |
| 247 new chromeos::attestation::AttestationPolicyObserver(client())); | 250 new chromeos::attestation::AttestationPolicyObserver(client())); |
| 248 | 251 |
| 249 // Enable device reporting and status monitoring for enterprise enrolled | 252 // Enable device reporting and status monitoring for enterprise enrolled |
| 250 // devices. We want to create these objects for enrolled devices, even if | 253 // devices. We want to create these objects for enrolled devices, even if |
| 251 // monitoring is currently inactive, in case monitoring is turned back on in | 254 // monitoring is currently inactive, in case monitoring is turned back on in |
| 252 // a future policy fetch - the classes themselves track the current state of | 255 // a future policy fetch - the classes themselves track the current state of |
| 253 // the monitoring settings and only perform monitoring if it is active. | 256 // the monitoring settings and only perform monitoring if it is active. |
| 254 if (install_attributes->IsEnterpriseDevice()) { | 257 if (install_attributes->IsEnterpriseDevice()) { |
| 255 CreateStatusUploader(); | 258 CreateStatusUploader(); |
| 259 CreateSystemLogUploader(); | |
| 256 heartbeat_scheduler_.reset( | 260 heartbeat_scheduler_.reset( |
| 257 new HeartbeatScheduler(g_browser_process->gcm_driver(), | 261 new HeartbeatScheduler(g_browser_process->gcm_driver(), |
| 258 install_attributes->GetDomain(), | 262 install_attributes->GetDomain(), |
| 259 install_attributes->GetDeviceId(), | 263 install_attributes->GetDeviceId(), |
| 260 task_runner_)); | 264 task_runner_)); |
| 261 } | 265 } |
| 262 | 266 |
| 263 NotifyConnected(); | 267 NotifyConnected(); |
| 264 } | 268 } |
| 265 | 269 |
| 266 void DeviceCloudPolicyManagerChromeOS::Unregister( | 270 void DeviceCloudPolicyManagerChromeOS::Unregister( |
| 267 const UnregisterCallback& callback) { | 271 const UnregisterCallback& callback) { |
| 268 if (!service()) { | 272 if (!service()) { |
| 269 LOG(ERROR) << "Tried to unregister but DeviceCloudPolicyManagerChromeOS is " | 273 LOG(ERROR) << "Tried to unregister but DeviceCloudPolicyManagerChromeOS is " |
| 270 << "not connected."; | 274 << "not connected."; |
| 271 callback.Run(false); | 275 callback.Run(false); |
| 272 return; | 276 return; |
| 273 } | 277 } |
| 274 | 278 |
| 275 service()->Unregister(callback); | 279 service()->Unregister(callback); |
| 276 } | 280 } |
| 277 | 281 |
| 278 void DeviceCloudPolicyManagerChromeOS::Disconnect() { | 282 void DeviceCloudPolicyManagerChromeOS::Disconnect() { |
| 279 status_uploader_.reset(); | 283 status_uploader_.reset(); |
| 284 syslog_uploader_.reset(); | |
| 280 heartbeat_scheduler_.reset(); | 285 heartbeat_scheduler_.reset(); |
| 281 core()->Disconnect(); | 286 core()->Disconnect(); |
| 282 | 287 |
| 283 NotifyDisconnected(); | 288 NotifyDisconnected(); |
| 284 } | 289 } |
| 285 | 290 |
| 286 void DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated() { | 291 void DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated() { |
| 287 if (client() && ForcedReEnrollmentEnabled()) | 292 if (client() && ForcedReEnrollmentEnabled()) |
| 288 client()->SetStateKeysToUpload(state_keys_broker_->state_keys()); | 293 client()->SetStateKeysToUpload(state_keys_broker_->state_keys()); |
| 289 } | 294 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 status_uploader_.reset(new StatusUploader( | 339 status_uploader_.reset(new StatusUploader( |
| 335 client(), | 340 client(), |
| 336 make_scoped_ptr(new DeviceStatusCollector( | 341 make_scoped_ptr(new DeviceStatusCollector( |
| 337 local_state_, chromeos::system::StatisticsProvider::GetInstance(), | 342 local_state_, chromeos::system::StatisticsProvider::GetInstance(), |
| 338 DeviceStatusCollector::LocationUpdateRequester(), | 343 DeviceStatusCollector::LocationUpdateRequester(), |
| 339 DeviceStatusCollector::VolumeInfoFetcher(), | 344 DeviceStatusCollector::VolumeInfoFetcher(), |
| 340 DeviceStatusCollector::CPUStatisticsFetcher())), | 345 DeviceStatusCollector::CPUStatisticsFetcher())), |
| 341 task_runner_)); | 346 task_runner_)); |
| 342 } | 347 } |
| 343 | 348 |
| 349 void DeviceCloudPolicyManagerChromeOS::CreateSystemLogUploader() { | |
| 350 syslog_uploader_.reset(new SystemLogUploader( | |
| 351 task_runner_, make_scoped_ptr(new SystemLogUploadJob( | |
|
Andrew T Wilson (Slow)
2015/06/29 15:06:08
I don't like having all of these dependencies expo
Polina Bondarenko
2015/07/02 15:28:03
Done, I'd go with 2)
| |
| 352 make_scoped_ptr(new SystemLogDelegate()))))); | |
| 353 } | |
| 354 | |
| 344 } // namespace policy | 355 } // namespace policy |
| OLD | NEW |