| 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" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (chromeos::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 chromeos::GetUserManager()->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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (chromeos::UserManager::IsInitialized()) { |
| 273 size_t user_count = chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 273 size_t user_count = chromeos::GetUserManager()->GetLoggedInUsers().size(); |
| 274 | 274 |
| 275 // We invalidate the user count if it changed while the log was open. | 275 // We invalidate the user count if it changed while the log was open. |
| 276 if (registered_user_count_at_log_initialization_ && | 276 if (registered_user_count_at_log_initialization_ && |
| 277 user_count != user_count_at_log_initialization_) { | 277 user_count != user_count_at_log_initialization_) { |
| 278 user_count = 0; | 278 user_count = 0; |
| 279 } | 279 } |
| 280 | 280 |
| 281 system_profile_proto->set_multi_profile_user_count(user_count); | 281 system_profile_proto->set_multi_profile_user_count(user_count); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 void ChromeOSMetricsProvider::SetBluetoothAdapter( | 285 void ChromeOSMetricsProvider::SetBluetoothAdapter( |
| 286 scoped_refptr<device::BluetoothAdapter> adapter) { | 286 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 287 adapter_ = adapter; | 287 adapter_ = adapter; |
| 288 } | 288 } |
| OLD | NEW |