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 "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
14 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
15 #include "chromeos/system/statistics_provider.h" | 14 #include "chromeos/system/statistics_provider.h" |
16 #include "components/metrics/metrics_service.h" | 15 #include "components/metrics/metrics_service.h" |
17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 16 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 17 #include "components/user_manager/user_manager.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "device/bluetooth/bluetooth_adapter.h" | 19 #include "device/bluetooth/bluetooth_adapter.h" |
20 #include "device/bluetooth/bluetooth_adapter_factory.h" | 20 #include "device/bluetooth/bluetooth_adapter_factory.h" |
21 #include "device/bluetooth/bluetooth_device.h" | 21 #include "device/bluetooth/bluetooth_device.h" |
22 #include "ui/events/event_utils.h" | 22 #include "ui/events/event_utils.h" |
23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
24 | 24 |
25 #if defined(USE_X11) | 25 #if defined(USE_X11) |
26 #include "ui/events/x/touch_factory_x11.h" | 26 #include "ui/events/x/touch_factory_x11.h" |
27 #endif // defined(USE_X11) | 27 #endif // defined(USE_X11) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 else | 121 else |
122 NOTREACHED() << "Unexpected Chrome OS crash type " << crash_type; | 122 NOTREACHED() << "Unexpected Chrome OS crash type " << crash_type; |
123 | 123 |
124 // Wake up metrics logs sending if necessary now that new | 124 // Wake up metrics logs sending if necessary now that new |
125 // log data is available. | 125 // log data is available. |
126 g_browser_process->metrics_service()->OnApplicationNotIdle(); | 126 g_browser_process->metrics_service()->OnApplicationNotIdle(); |
127 } | 127 } |
128 | 128 |
129 void ChromeOSMetricsProvider::OnDidCreateMetricsLog() { | 129 void ChromeOSMetricsProvider::OnDidCreateMetricsLog() { |
130 registered_user_count_at_log_initialization_ = false; | 130 registered_user_count_at_log_initialization_ = false; |
131 if (chromeos::UserManager::IsInitialized()) { | 131 if (user_manager::UserManager::IsInitialized()) { |
132 registered_user_count_at_log_initialization_ = true; | 132 registered_user_count_at_log_initialization_ = true; |
133 user_count_at_log_initialization_ = | 133 user_count_at_log_initialization_ = |
134 chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 134 user_manager::UserManager::Get()->GetLoggedInUsers().size(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 void ChromeOSMetricsProvider::InitTaskGetHardwareClass( | 138 void ChromeOSMetricsProvider::InitTaskGetHardwareClass( |
139 const base::Closure& callback) { | 139 const base::Closure& callback) { |
140 // Run the (potentially expensive) task on the FILE thread to avoid blocking | 140 // Run the (potentially expensive) task on the FILE thread to avoid blocking |
141 // the UI thread. | 141 // the UI thread. |
142 content::BrowserThread::PostTaskAndReply( | 142 content::BrowserThread::PostTaskAndReply( |
143 content::BrowserThread::FILE, | 143 content::BrowserThread::FILE, |
144 FROM_HERE, | 144 FROM_HERE, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 | 263 |
264 paired_device->set_vendor_id(device->GetVendorID()); | 264 paired_device->set_vendor_id(device->GetVendorID()); |
265 paired_device->set_product_id(device->GetProductID()); | 265 paired_device->set_product_id(device->GetProductID()); |
266 paired_device->set_device_id(device->GetDeviceID()); | 266 paired_device->set_device_id(device->GetDeviceID()); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 void ChromeOSMetricsProvider::UpdateMultiProfileUserCount( | 270 void ChromeOSMetricsProvider::UpdateMultiProfileUserCount( |
271 metrics::SystemProfileProto* system_profile_proto) { | 271 metrics::SystemProfileProto* system_profile_proto) { |
272 if (chromeos::UserManager::IsInitialized()) { | 272 if (user_manager::UserManager::IsInitialized()) { |
273 size_t user_count = chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 273 size_t user_count = |
| 274 user_manager::UserManager::Get()->GetLoggedInUsers().size(); |
274 | 275 |
275 // We invalidate the user count if it changed while the log was open. | 276 // We invalidate the user count if it changed while the log was open. |
276 if (registered_user_count_at_log_initialization_ && | 277 if (registered_user_count_at_log_initialization_ && |
277 user_count != user_count_at_log_initialization_) { | 278 user_count != user_count_at_log_initialization_) { |
278 user_count = 0; | 279 user_count = 0; |
279 } | 280 } |
280 | 281 |
281 system_profile_proto->set_multi_profile_user_count(user_count); | 282 system_profile_proto->set_multi_profile_user_count(user_count); |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 void ChromeOSMetricsProvider::SetBluetoothAdapter( | 286 void ChromeOSMetricsProvider::SetBluetoothAdapter( |
286 scoped_refptr<device::BluetoothAdapter> adapter) { | 287 scoped_refptr<device::BluetoothAdapter> adapter) { |
287 adapter_ = adapter; | 288 adapter_ = adapter; |
288 } | 289 } |
OLD | NEW |