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_status_collector.h" | 5 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" |
11 #include "base/location.h" | 12 #include "base/location.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
16 #include "base/prefs/scoped_user_pref_update.h" | 17 #include "base/prefs/scoped_user_pref_update.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chromeos/login/user.h" | 21 #include "chrome/browser/chromeos/login/user.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 22 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/browser/policy/browser_policy_connector.h" | 24 #include "chrome/browser/policy/browser_policy_connector.h" |
24 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 25 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
25 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" | 26 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" |
26 #include "chrome/common/chrome_version_info.h" | 27 #include "chrome/common/chrome_version_info.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chromeos/chromeos_switches.h" |
28 #include "chromeos/network/device_state.h" | 30 #include "chromeos/network/device_state.h" |
29 #include "chromeos/network/network_handler.h" | 31 #include "chromeos/network/network_handler.h" |
30 #include "chromeos/network/network_state_handler.h" | 32 #include "chromeos/network/network_state_handler.h" |
31 #include "chromeos/settings/cros_settings_names.h" | 33 #include "chromeos/settings/cros_settings_names.h" |
32 #include "chromeos/system/statistics_provider.h" | 34 #include "chromeos/system/statistics_provider.h" |
33 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
34 #include "third_party/cros_system_api/dbus/service_constants.h" | 36 #include "third_party/cros_system_api/dbus/service_constants.h" |
35 | 37 |
36 using base::Time; | 38 using base::Time; |
37 using base::TimeDelta; | 39 using base::TimeDelta; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 507 |
506 if (report_boot_mode_) | 508 if (report_boot_mode_) |
507 GetBootMode(status); | 509 GetBootMode(status); |
508 | 510 |
509 if (report_location_) | 511 if (report_location_) |
510 GetLocation(status); | 512 GetLocation(status); |
511 | 513 |
512 if (report_network_interfaces_) | 514 if (report_network_interfaces_) |
513 GetNetworkInterfaces(status); | 515 GetNetworkInterfaces(status); |
514 | 516 |
515 if (report_users_) | 517 if (report_users_ && CommandLine::ForCurrentProcess()->HasSwitch( |
| 518 chromeos::switches::kEnableEnterpriseUserReporting)) { |
516 GetUsers(status); | 519 GetUsers(status); |
| 520 } |
517 | 521 |
518 return true; | 522 return true; |
519 } | 523 } |
520 | 524 |
521 bool DeviceStatusCollector::GetSessionStatus( | 525 bool DeviceStatusCollector::GetSessionStatus( |
522 em::SessionStatusReportRequest* status) { | 526 em::SessionStatusReportRequest* status) { |
523 return false; | 527 return false; |
524 } | 528 } |
525 | 529 |
526 void DeviceStatusCollector::OnSubmittedSuccessfully() { | 530 void DeviceStatusCollector::OnSubmittedSuccessfully() { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 location.SetDouble(kSpeed, position.speed); | 588 location.SetDouble(kSpeed, position.speed); |
585 location.SetString(kTimestamp, | 589 location.SetString(kTimestamp, |
586 base::Int64ToString(position.timestamp.ToInternalValue())); | 590 base::Int64ToString(position.timestamp.ToInternalValue())); |
587 local_state_->Set(prefs::kDeviceLocation, location); | 591 local_state_->Set(prefs::kDeviceLocation, location); |
588 } | 592 } |
589 | 593 |
590 ScheduleGeolocationUpdateRequest(); | 594 ScheduleGeolocationUpdateRequest(); |
591 } | 595 } |
592 | 596 |
593 } // namespace policy | 597 } // namespace policy |
OLD | NEW |