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/metrics_log_chromeos.h" | 5 #include "chrome/browser/metrics/metrics_log_chromeos.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 13 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
14 #include "device/bluetooth/bluetooth_adapter.h" | 14 #include "device/bluetooth/bluetooth_adapter.h" |
15 #include "device/bluetooth/bluetooth_adapter_factory.h" | 15 #include "device/bluetooth/bluetooth_adapter_factory.h" |
16 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
17 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
18 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
19 | 19 |
20 #if defined(USE_X11) | 20 #if defined(USE_X11) |
21 #include "ui/events/x/touch_factory_x11.h" | 21 #include "ui/events/x/touch_factory_x11.h" |
22 #endif // defined(USE_X11) | 22 #endif // defined(USE_X11) |
23 | 23 |
24 using metrics::ChromeUserMetricsExtension; | 24 using metrics::ChromeUserMetricsExtension; |
25 using metrics::PerfDataProto; | 25 using metrics::SampledProfile; |
26 using metrics::SystemProfileProto; | 26 using metrics::SystemProfileProto; |
27 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; | 27 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 PairedDevice::Type AsBluetoothDeviceType( | 31 PairedDevice::Type AsBluetoothDeviceType( |
32 device::BluetoothDevice::DeviceType device_type) { | 32 device::BluetoothDevice::DeviceType device_type) { |
33 switch (device_type) { | 33 switch (device_type) { |
34 case device::BluetoothDevice::DEVICE_UNKNOWN: | 34 case device::BluetoothDevice::DEVICE_UNKNOWN: |
35 return PairedDevice::DEVICE_UNKNOWN; | 35 return PairedDevice::DEVICE_UNKNOWN; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 MetricsLogChromeOS::~MetricsLogChromeOS() { | 85 MetricsLogChromeOS::~MetricsLogChromeOS() { |
86 } | 86 } |
87 | 87 |
88 MetricsLogChromeOS::MetricsLogChromeOS(ChromeUserMetricsExtension* uma_proto) | 88 MetricsLogChromeOS::MetricsLogChromeOS(ChromeUserMetricsExtension* uma_proto) |
89 : uma_proto_(uma_proto) { | 89 : uma_proto_(uma_proto) { |
90 UpdateMultiProfileUserCount(); | 90 UpdateMultiProfileUserCount(); |
91 } | 91 } |
92 | 92 |
93 void MetricsLogChromeOS::LogChromeOSMetrics() { | 93 void MetricsLogChromeOS::LogChromeOSMetrics() { |
94 std::vector<PerfDataProto> perf_data; | 94 std::vector<SampledProfile> perf_data; |
95 if (perf_provider_.GetPerfData(&perf_data)) { | 95 if (perf_provider_.GetPerfData(&perf_data)) { |
96 for (std::vector<PerfDataProto>::iterator iter = perf_data.begin(); | 96 for (std::vector<SampledProfile>::iterator iter = perf_data.begin(); |
97 iter != perf_data.end(); | 97 iter != perf_data.end(); |
98 ++iter) { | 98 ++iter) { |
99 uma_proto_->add_perf_data()->Swap(&(*iter)); | 99 uma_proto_->add_sampled_profile()->Swap(&(*iter)); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 WriteBluetoothProto(); | 103 WriteBluetoothProto(); |
104 UpdateMultiProfileUserCount(); | 104 UpdateMultiProfileUserCount(); |
105 | 105 |
106 SystemProfileProto::Hardware* hardware = | 106 SystemProfileProto::Hardware* hardware = |
107 uma_proto_->mutable_system_profile()->mutable_hardware(); | 107 uma_proto_->mutable_system_profile()->mutable_hardware(); |
108 gfx::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport(); | 108 gfx::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport(); |
109 if (has_touch == gfx::Display::TOUCH_SUPPORT_AVAILABLE) | 109 if (has_touch == gfx::Display::TOUCH_SUPPORT_AVAILABLE) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 system_profile->set_multi_profile_user_count(user_count); | 213 system_profile->set_multi_profile_user_count(user_count); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 void MetricsLogChromeOS::SetBluetoothAdapter( | 217 void MetricsLogChromeOS::SetBluetoothAdapter( |
218 scoped_refptr<device::BluetoothAdapter> adapter) { | 218 scoped_refptr<device::BluetoothAdapter> adapter) { |
219 adapter_ = adapter; | 219 adapter_ = adapter; |
220 } | 220 } |
OLD | NEW |