| 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> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 15 #include "chrome/common/chrome_features.h" | 15 #include "chrome/common/chrome_features.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "chromeos/system/statistics_provider.h" | 17 #include "chromeos/system/statistics_provider.h" |
| 18 #include "components/metrics/leak_detector/leak_detector.h" | 18 #include "components/metrics/leak_detector/leak_detector.h" |
| 19 #include "components/metrics/metrics_service.h" | 19 #include "components/metrics/metrics_service.h" |
| 20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 21 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
| 22 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| 23 #include "components/user_manager/user_manager.h" | 23 #include "components/user_manager/user_manager.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "device/bluetooth/bluetooth_adapter.h" | 25 #include "device/bluetooth/bluetooth_adapter.h" |
| 26 #include "device/bluetooth/bluetooth_adapter_factory.h" | 26 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 27 #include "device/bluetooth/bluetooth_device.h" | 27 #include "device/bluetooth/bluetooth_device.h" |
| 28 #include "ui/display/display.h" |
| 28 #include "ui/events/event_utils.h" | 29 #include "ui/events/event_utils.h" |
| 29 #include "ui/gfx/screen.h" | |
| 30 | 30 |
| 31 #if defined(USE_X11) | 31 #if defined(USE_X11) |
| 32 #include "ui/events/devices/x11/touch_factory_x11.h" | 32 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 33 #endif // defined(USE_X11) | 33 #endif // defined(USE_X11) |
| 34 | 34 |
| 35 using metrics::ChromeUserMetricsExtension; | 35 using metrics::ChromeUserMetricsExtension; |
| 36 using metrics::SampledProfile; | 36 using metrics::SampledProfile; |
| 37 using metrics::SystemProfileProto; | 37 using metrics::SystemProfileProto; |
| 38 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; | 38 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; |
| 39 | 39 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ChromeOSMetricsProvider::ProvideSystemProfileMetrics( | 191 void ChromeOSMetricsProvider::ProvideSystemProfileMetrics( |
| 192 metrics::SystemProfileProto* system_profile_proto) { | 192 metrics::SystemProfileProto* system_profile_proto) { |
| 193 WriteBluetoothProto(system_profile_proto); | 193 WriteBluetoothProto(system_profile_proto); |
| 194 UpdateMultiProfileUserCount(system_profile_proto); | 194 UpdateMultiProfileUserCount(system_profile_proto); |
| 195 | 195 |
| 196 metrics::SystemProfileProto::Hardware* hardware = | 196 metrics::SystemProfileProto::Hardware* hardware = |
| 197 system_profile_proto->mutable_hardware(); | 197 system_profile_proto->mutable_hardware(); |
| 198 hardware->set_hardware_class(hardware_class_); | 198 hardware->set_hardware_class(hardware_class_); |
| 199 gfx::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport(); | 199 display::Display::TouchSupport has_touch = |
| 200 if (has_touch == gfx::Display::TOUCH_SUPPORT_AVAILABLE) | 200 ui::GetInternalDisplayTouchSupport(); |
| 201 if (has_touch == display::Display::TOUCH_SUPPORT_AVAILABLE) |
| 201 hardware->set_internal_display_supports_touch(true); | 202 hardware->set_internal_display_supports_touch(true); |
| 202 else if (has_touch == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE) | 203 else if (has_touch == display::Display::TOUCH_SUPPORT_UNAVAILABLE) |
| 203 hardware->set_internal_display_supports_touch(false); | 204 hardware->set_internal_display_supports_touch(false); |
| 204 WriteExternalTouchscreensProto(hardware); | 205 WriteExternalTouchscreensProto(hardware); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void ChromeOSMetricsProvider::ProvideStabilityMetrics( | 208 void ChromeOSMetricsProvider::ProvideStabilityMetrics( |
| 208 metrics::SystemProfileProto* system_profile_proto) { | 209 metrics::SystemProfileProto* system_profile_proto) { |
| 209 metrics::SystemProfileProto::Stability* stability_proto = | 210 metrics::SystemProfileProto::Stability* stability_proto = |
| 210 system_profile_proto->mutable_stability(); | 211 system_profile_proto->mutable_stability(); |
| 211 PrefService* pref = g_browser_process->local_state(); | 212 PrefService* pref = g_browser_process->local_state(); |
| 212 int count = pref->GetInteger(prefs::kStabilityOtherUserCrashCount); | 213 int count = pref->GetInteger(prefs::kStabilityOtherUserCrashCount); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 base::Closure callback, | 325 base::Closure callback, |
| 325 scoped_refptr<device::BluetoothAdapter> adapter) { | 326 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 326 adapter_ = adapter; | 327 adapter_ = adapter; |
| 327 callback.Run(); | 328 callback.Run(); |
| 328 } | 329 } |
| 329 | 330 |
| 330 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { | 331 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { |
| 331 UMA_HISTOGRAM_ENUMERATION( | 332 UMA_HISTOGRAM_ENUMERATION( |
| 332 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); | 333 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); |
| 333 } | 334 } |
| OLD | NEW |