| Index: chrome/browser/metrics/chromeos_metrics_provider.cc
|
| diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc
|
| index 0a4fd15a112a9de661e4fd0a807937f3a0749538..5ecec291ca0ac38824b6a898fedd8c709f00ad5a 100644
|
| --- a/chrome/browser/metrics/chromeos_metrics_provider.cc
|
| +++ b/chrome/browser/metrics/chromeos_metrics_provider.cc
|
| @@ -13,7 +13,9 @@
|
| #include "chrome/browser/chromeos/login/users/user_manager.h"
|
| #include "chrome/browser/metrics/metrics_service.h"
|
| #include "chrome/common/pref_names.h"
|
| +#include "chromeos/system/statistics_provider.h"
|
| #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "device/bluetooth/bluetooth_adapter.h"
|
| #include "device/bluetooth/bluetooth_adapter_factory.h"
|
| #include "device/bluetooth/bluetooth_device.h"
|
| @@ -94,7 +96,8 @@ void IncrementPrefValue(const char* path) {
|
|
|
| ChromeOSMetricsProvider::ChromeOSMetricsProvider()
|
| : registered_user_count_at_log_initialization_(false),
|
| - user_count_at_log_initialization_(0) {
|
| + user_count_at_log_initialization_(0),
|
| + weak_ptr_factory_(this) {
|
| }
|
|
|
| ChromeOSMetricsProvider::~ChromeOSMetricsProvider() {
|
| @@ -132,6 +135,24 @@ void ChromeOSMetricsProvider::OnDidCreateMetricsLog() {
|
| }
|
| }
|
|
|
| +void ChromeOSMetricsProvider::InitTaskGetHardwareClass(
|
| + const base::Closure& callback) {
|
| + // Run the (potentially expensive) task on the FILE thread to avoid blocking
|
| + // the UI thread.
|
| + content::BrowserThread::PostTaskAndReply(
|
| + content::BrowserThread::FILE,
|
| + FROM_HERE,
|
| + base::Bind(&ChromeOSMetricsProvider::InitTaskGetHardwareClassOnFileThread,
|
| + weak_ptr_factory_.GetWeakPtr()),
|
| + callback);
|
| +}
|
| +
|
| +void ChromeOSMetricsProvider::InitTaskGetHardwareClassOnFileThread() {
|
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
|
| + chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic(
|
| + "hardware_class", &hardware_class_);
|
| +}
|
| +
|
| void ChromeOSMetricsProvider::ProvideSystemProfileMetrics(
|
| metrics::SystemProfileProto* system_profile_proto) {
|
| WriteBluetoothProto(system_profile_proto);
|
| @@ -139,6 +160,7 @@ void ChromeOSMetricsProvider::ProvideSystemProfileMetrics(
|
|
|
| metrics::SystemProfileProto::Hardware* hardware =
|
| system_profile_proto->mutable_hardware();
|
| + hardware->set_hardware_class(hardware_class_);
|
| gfx::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport();
|
| if (has_touch == gfx::Display::TOUCH_SUPPORT_AVAILABLE)
|
| hardware->set_internal_display_supports_touch(true);
|
|
|