Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc

Issue 1193333017: Added system log uploader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added FileReader - helper class that reads files thread safely. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_uploader.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
28 #include "chromeos/chromeos_constants.h" 29 #include "chromeos/chromeos_constants.h"
29 #include "chromeos/chromeos_switches.h" 30 #include "chromeos/chromeos_switches.h"
30 #include "chromeos/system/statistics_provider.h" 31 #include "chromeos/system/statistics_provider.h"
31 #include "components/policy/core/common/cloud/cloud_policy_core.h" 32 #include "components/policy/core/common/cloud/cloud_policy_core.h"
32 #include "components/policy/core/common/cloud/cloud_policy_service.h" 33 #include "components/policy/core/common/cloud/cloud_policy_service.h"
33 #include "components/policy/core/common/cloud/cloud_policy_store.h" 34 #include "components/policy/core/common/cloud/cloud_policy_store.h"
34 #include "components/policy/core/common/remote_commands/remote_commands_factory. h" 35 #include "components/policy/core/common/remote_commands/remote_commands_factory. h"
35 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
36 #include "crypto/sha2.h" 37 #include "crypto/sha2.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 attestation_policy_observer_.reset( 247 attestation_policy_observer_.reset(
247 new chromeos::attestation::AttestationPolicyObserver(client())); 248 new chromeos::attestation::AttestationPolicyObserver(client()));
248 249
249 // Enable device reporting and status monitoring for enterprise enrolled 250 // Enable device reporting and status monitoring for enterprise enrolled
250 // devices. We want to create these objects for enrolled devices, even if 251 // 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 252 // 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 253 // a future policy fetch - the classes themselves track the current state of
253 // the monitoring settings and only perform monitoring if it is active. 254 // the monitoring settings and only perform monitoring if it is active.
254 if (install_attributes->IsEnterpriseDevice()) { 255 if (install_attributes->IsEnterpriseDevice()) {
255 CreateStatusUploader(); 256 CreateStatusUploader();
257 CreateSystemLogUploader();
256 heartbeat_scheduler_.reset( 258 heartbeat_scheduler_.reset(
257 new HeartbeatScheduler(g_browser_process->gcm_driver(), 259 new HeartbeatScheduler(g_browser_process->gcm_driver(),
258 install_attributes->GetDomain(), 260 install_attributes->GetDomain(),
259 install_attributes->GetDeviceId(), 261 install_attributes->GetDeviceId(),
260 task_runner_)); 262 task_runner_));
261 } 263 }
262 264
263 NotifyConnected(); 265 NotifyConnected();
264 } 266 }
265 267
266 void DeviceCloudPolicyManagerChromeOS::Unregister( 268 void DeviceCloudPolicyManagerChromeOS::Unregister(
267 const UnregisterCallback& callback) { 269 const UnregisterCallback& callback) {
268 if (!service()) { 270 if (!service()) {
269 LOG(ERROR) << "Tried to unregister but DeviceCloudPolicyManagerChromeOS is " 271 LOG(ERROR) << "Tried to unregister but DeviceCloudPolicyManagerChromeOS is "
270 << "not connected."; 272 << "not connected.";
271 callback.Run(false); 273 callback.Run(false);
272 return; 274 return;
273 } 275 }
274 276
275 service()->Unregister(callback); 277 service()->Unregister(callback);
276 } 278 }
277 279
278 void DeviceCloudPolicyManagerChromeOS::Disconnect() { 280 void DeviceCloudPolicyManagerChromeOS::Disconnect() {
279 status_uploader_.reset(); 281 status_uploader_.reset();
282 syslog_uploader_.reset();
280 heartbeat_scheduler_.reset(); 283 heartbeat_scheduler_.reset();
281 core()->Disconnect(); 284 core()->Disconnect();
282 285
283 NotifyDisconnected(); 286 NotifyDisconnected();
284 } 287 }
285 288
286 void DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated() { 289 void DeviceCloudPolicyManagerChromeOS::OnStateKeysUpdated() {
287 if (client() && ForcedReEnrollmentEnabled()) 290 if (client() && ForcedReEnrollmentEnabled())
288 client()->SetStateKeysToUpload(state_keys_broker_->state_keys()); 291 client()->SetStateKeysToUpload(state_keys_broker_->state_keys());
289 } 292 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 status_uploader_.reset(new StatusUploader( 337 status_uploader_.reset(new StatusUploader(
335 client(), 338 client(),
336 make_scoped_ptr(new DeviceStatusCollector( 339 make_scoped_ptr(new DeviceStatusCollector(
337 local_state_, chromeos::system::StatisticsProvider::GetInstance(), 340 local_state_, chromeos::system::StatisticsProvider::GetInstance(),
338 DeviceStatusCollector::LocationUpdateRequester(), 341 DeviceStatusCollector::LocationUpdateRequester(),
339 DeviceStatusCollector::VolumeInfoFetcher(), 342 DeviceStatusCollector::VolumeInfoFetcher(),
340 DeviceStatusCollector::CPUStatisticsFetcher())), 343 DeviceStatusCollector::CPUStatisticsFetcher())),
341 task_runner_)); 344 task_runner_));
342 } 345 }
343 346
347 void DeviceCloudPolicyManagerChromeOS::CreateSystemLogUploader() {
348 syslog_uploader_.reset(new SystemLogUploader(task_runner_));
Andrew T Wilson (Slow) 2015/07/03 15:40:47 This is OK to leave as-is, but in general I don't
Polina Bondarenko 2015/07/08 10:07:23 Removed the factory method.
349 }
350
344 } // namespace policy 351 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698