| 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 13 #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" |
| 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" |
| 18 #include "components/metrics/leak_detector/leak_detector.h" |
| 16 #include "components/metrics/metrics_service.h" | 19 #include "components/metrics/metrics_service.h" |
| 17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 18 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
| 19 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| 20 #include "components/user_manager/user_manager.h" | 23 #include "components/user_manager/user_manager.h" |
| 21 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 22 #include "device/bluetooth/bluetooth_adapter.h" | 25 #include "device/bluetooth/bluetooth_adapter.h" |
| 23 #include "device/bluetooth/bluetooth_adapter_factory.h" | 26 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 24 #include "device/bluetooth/bluetooth_device.h" | 27 #include "device/bluetooth/bluetooth_device.h" |
| 25 #include "ui/events/event_utils.h" | 28 #include "ui/events/event_utils.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 policy::BrowserPolicyConnectorChromeOS* connector = | 137 policy::BrowserPolicyConnectorChromeOS* connector = |
| 135 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 138 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 136 if (!connector) | 139 if (!connector) |
| 137 return ERROR_GETTING_ENROLLMENT_STATUS; | 140 return ERROR_GETTING_ENROLLMENT_STATUS; |
| 138 | 141 |
| 139 return connector->IsEnterpriseManaged() ? MANAGED : NON_MANAGED; | 142 return connector->IsEnterpriseManaged() ? MANAGED : NON_MANAGED; |
| 140 } | 143 } |
| 141 | 144 |
| 142 void ChromeOSMetricsProvider::Init() { | 145 void ChromeOSMetricsProvider::Init() { |
| 143 perf_provider_.Init(); | 146 perf_provider_.Init(); |
| 147 |
| 148 if (base::FeatureList::IsEnabled(features::kRuntimeMemoryLeakDetector)) { |
| 149 leak_detector_controller_.reset(new metrics::LeakDetectorController); |
| 150 } |
| 144 } | 151 } |
| 145 | 152 |
| 146 void ChromeOSMetricsProvider::OnDidCreateMetricsLog() { | 153 void ChromeOSMetricsProvider::OnDidCreateMetricsLog() { |
| 147 registered_user_count_at_log_initialization_ = false; | 154 registered_user_count_at_log_initialization_ = false; |
| 148 if (user_manager::UserManager::IsInitialized()) { | 155 if (user_manager::UserManager::IsInitialized()) { |
| 149 registered_user_count_at_log_initialization_ = true; | 156 registered_user_count_at_log_initialization_ = true; |
| 150 user_count_at_log_initialization_ = | 157 user_count_at_log_initialization_ = |
| 151 user_manager::UserManager::Get()->GetLoggedInUsers().size(); | 158 user_manager::UserManager::Get()->GetLoggedInUsers().size(); |
| 152 } | 159 } |
| 153 } | 160 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 310 |
| 304 void ChromeOSMetricsProvider::SetBluetoothAdapter( | 311 void ChromeOSMetricsProvider::SetBluetoothAdapter( |
| 305 scoped_refptr<device::BluetoothAdapter> adapter) { | 312 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 306 adapter_ = adapter; | 313 adapter_ = adapter; |
| 307 } | 314 } |
| 308 | 315 |
| 309 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { | 316 void ChromeOSMetricsProvider::RecordEnrollmentStatus() { |
| 310 UMA_HISTOGRAM_ENUMERATION( | 317 UMA_HISTOGRAM_ENUMERATION( |
| 311 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); | 318 "UMA.EnrollmentStatus", GetEnrollmentStatus(), ENROLLMENT_STATUS_MAX); |
| 312 } | 319 } |
| OLD | NEW |