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