| 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/metrics/proto/chrome_user_metrics_extension.pb.h" | 12 #include "chrome/common/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.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" |
| 19 |
| 20 #if defined(USE_X11) |
| 18 #include "ui/events/x/touch_factory_x11.h" | 21 #include "ui/events/x/touch_factory_x11.h" |
| 19 #include "ui/gfx/screen.h" | 22 #endif // defined(USE_X11) |
| 20 | 23 |
| 21 using metrics::ChromeUserMetricsExtension; | 24 using metrics::ChromeUserMetricsExtension; |
| 22 using metrics::PerfDataProto; | 25 using metrics::PerfDataProto; |
| 23 using metrics::SystemProfileProto; | 26 using metrics::SystemProfileProto; |
| 24 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; | 27 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; |
| 25 | 28 |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 28 PairedDevice::Type AsBluetoothDeviceType( | 31 PairedDevice::Type AsBluetoothDeviceType( |
| 29 device::BluetoothDevice::DeviceType device_type) { | 32 device::BluetoothDevice::DeviceType device_type) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 56 return PairedDevice::DEVICE_TABLET; | 59 return PairedDevice::DEVICE_TABLET; |
| 57 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 60 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
| 58 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 61 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
| 59 } | 62 } |
| 60 | 63 |
| 61 NOTREACHED(); | 64 NOTREACHED(); |
| 62 return PairedDevice::DEVICE_UNKNOWN; | 65 return PairedDevice::DEVICE_UNKNOWN; |
| 63 } | 66 } |
| 64 | 67 |
| 65 void WriteExternalTouchscreensProto(SystemProfileProto::Hardware* hardware) { | 68 void WriteExternalTouchscreensProto(SystemProfileProto::Hardware* hardware) { |
| 69 #if defined(USE_X11) |
| 66 std::set<std::pair<int, int> > touchscreen_ids = | 70 std::set<std::pair<int, int> > touchscreen_ids = |
| 67 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); | 71 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); |
| 68 for (std::set<std::pair<int, int> >::iterator it = touchscreen_ids.begin(); | 72 for (std::set<std::pair<int, int> >::iterator it = touchscreen_ids.begin(); |
| 69 it != touchscreen_ids.end(); | 73 it != touchscreen_ids.end(); |
| 70 ++it) { | 74 ++it) { |
| 71 SystemProfileProto::Hardware::TouchScreen* touchscreen = | 75 SystemProfileProto::Hardware::TouchScreen* touchscreen = |
| 72 hardware->add_external_touchscreen(); | 76 hardware->add_external_touchscreen(); |
| 73 touchscreen->set_vendor_id(it->first); | 77 touchscreen->set_vendor_id(it->first); |
| 74 touchscreen->set_product_id(it->second); | 78 touchscreen->set_product_id(it->second); |
| 75 } | 79 } |
| 80 #endif // defined(USE_X11) |
| 76 } | 81 } |
| 77 | 82 |
| 78 } // namespace | 83 } // namespace |
| 79 | 84 |
| 80 MetricsLogChromeOS::~MetricsLogChromeOS() { | 85 MetricsLogChromeOS::~MetricsLogChromeOS() { |
| 81 } | 86 } |
| 82 | 87 |
| 83 MetricsLogChromeOS::MetricsLogChromeOS(ChromeUserMetricsExtension* uma_proto) | 88 MetricsLogChromeOS::MetricsLogChromeOS(ChromeUserMetricsExtension* uma_proto) |
| 84 : uma_proto_(uma_proto) { | 89 : uma_proto_(uma_proto) { |
| 85 UpdateMultiProfileUserCount(); | 90 UpdateMultiProfileUserCount(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 212 } |
| 208 | 213 |
| 209 system_profile->set_multi_profile_user_count(user_count); | 214 system_profile->set_multi_profile_user_count(user_count); |
| 210 } | 215 } |
| 211 } | 216 } |
| 212 | 217 |
| 213 void MetricsLogChromeOS::SetBluetoothAdapter( | 218 void MetricsLogChromeOS::SetBluetoothAdapter( |
| 214 scoped_refptr<device::BluetoothAdapter> adapter) { | 219 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 215 adapter_ = adapter; | 220 adapter_ = adapter; |
| 216 } | 221 } |
| OLD | NEW |