| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/chromeos_metrics_provider.h" | 5 #include "chrome/browser/metrics/chromeos_metrics_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 14 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 15 #include "chromeos/system/statistics_provider.h" | 17 #include "chromeos/system/statistics_provider.h" |
| 16 #include "components/metrics/metrics_service.h" | 18 #include "components/metrics/metrics_service.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 device::BluetoothDevice* device = *iter; | 243 device::BluetoothDevice* device = *iter; |
| 242 // Don't collect information about LE devices yet. | 244 // Don't collect information about LE devices yet. |
| 243 if (!device->IsPaired()) | 245 if (!device->IsPaired()) |
| 244 continue; | 246 continue; |
| 245 | 247 |
| 246 PairedDevice* paired_device = bluetooth->add_paired_device(); | 248 PairedDevice* paired_device = bluetooth->add_paired_device(); |
| 247 paired_device->set_bluetooth_class(device->GetBluetoothClass()); | 249 paired_device->set_bluetooth_class(device->GetBluetoothClass()); |
| 248 paired_device->set_type(AsBluetoothDeviceType(device->GetDeviceType())); | 250 paired_device->set_type(AsBluetoothDeviceType(device->GetDeviceType())); |
| 249 | 251 |
| 250 // |address| is xx:xx:xx:xx:xx:xx, extract the first three components and | 252 // |address| is xx:xx:xx:xx:xx:xx, extract the first three components and |
| 251 // pack into a uint32. | 253 // pack into a uint32_t. |
| 252 std::string address = device->GetAddress(); | 254 std::string address = device->GetAddress(); |
| 253 if (address.size() > 9 && address[2] == ':' && address[5] == ':' && | 255 if (address.size() > 9 && address[2] == ':' && address[5] == ':' && |
| 254 address[8] == ':') { | 256 address[8] == ':') { |
| 255 std::string vendor_prefix_str; | 257 std::string vendor_prefix_str; |
| 256 uint64 vendor_prefix; | 258 uint64_t vendor_prefix; |
| 257 | 259 |
| 258 base::RemoveChars(address.substr(0, 9), ":", &vendor_prefix_str); | 260 base::RemoveChars(address.substr(0, 9), ":", &vendor_prefix_str); |
| 259 DCHECK_EQ(6U, vendor_prefix_str.size()); | 261 DCHECK_EQ(6U, vendor_prefix_str.size()); |
| 260 base::HexStringToUInt64(vendor_prefix_str, &vendor_prefix); | 262 base::HexStringToUInt64(vendor_prefix_str, &vendor_prefix); |
| 261 | 263 |
| 262 paired_device->set_vendor_prefix(vendor_prefix); | 264 paired_device->set_vendor_prefix(vendor_prefix); |
| 263 } | 265 } |
| 264 | 266 |
| 265 switch (device->GetVendorIDSource()) { | 267 switch (device->GetVendorIDSource()) { |
| 266 case device::BluetoothDevice::VENDOR_ID_BLUETOOTH: | 268 case device::BluetoothDevice::VENDOR_ID_BLUETOOTH: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 297 | 299 |
| 298 void ChromeOSMetricsProvider::SetBluetoothAdapter( | 300 void ChromeOSMetricsProvider::SetBluetoothAdapter( |
| 299 scoped_refptr<device::BluetoothAdapter> adapter) { | 301 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 300 adapter_ = adapter; | 302 adapter_ = adapter; |
| 301 } | 303 } |
| 302 | 304 |
| 303 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { | 305 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { |
| 304 UMA_HISTOGRAM_ENUMERATION( | 306 UMA_HISTOGRAM_ENUMERATION( |
| 305 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); | 307 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); |
| 306 } | 308 } |
| OLD | NEW |