Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: device/bluetooth/bluetooth_adapter_experimental_chromeos.cc

Issue 13872017: Bluetooth: gather usage metrics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only include ChromeOS specific header on ChromeOS Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" 5 #include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h"
11 #include "chromeos/dbus/dbus_thread_manager.h" 12 #include "chromeos/dbus/dbus_thread_manager.h"
12 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h" 13 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h"
13 #include "chromeos/dbus/experimental_bluetooth_device_client.h" 14 #include "chromeos/dbus/experimental_bluetooth_device_client.h"
14 #include "device/bluetooth/bluetooth_device.h" 15 #include "device/bluetooth/bluetooth_device.h"
15 #include "device/bluetooth/bluetooth_device_experimental_chromeos.h" 16 #include "device/bluetooth/bluetooth_device_experimental_chromeos.h"
16 17
17 using device::BluetoothAdapter; 18 using device::BluetoothAdapter;
18 using device::BluetoothDevice; 19 using device::BluetoothDevice;
19 20
20 namespace chromeos { 21 namespace chromeos {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 243
243 if (property_name == properties->bluetooth_class.name() || 244 if (property_name == properties->bluetooth_class.name() ||
244 property_name == properties->alias.name() || 245 property_name == properties->alias.name() ||
245 property_name == properties->paired.name() || 246 property_name == properties->paired.name() ||
246 property_name == properties->connected.name() || 247 property_name == properties->connected.name() ||
247 property_name == properties->uuids.name()) { 248 property_name == properties->uuids.name()) {
248 FOR_EACH_OBSERVER( 249 FOR_EACH_OBSERVER(
249 BluetoothAdapter::Observer, observers_, 250 BluetoothAdapter::Observer, observers_,
250 DeviceChanged(this, device_chromeos)); 251 DeviceChanged(this, device_chromeos));
251 } 252 }
253
254 // UMA connection counting
255 if (property_name == properties->connected.name()) {
256 int count = 0;
257
258 for (DevicesMap::iterator iter = devices_.begin();
259 iter != devices_.end(); ++iter) {
260 if (iter->second->IsConnected())
261 ++count;
262 }
263
264 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count);
265 }
252 } 266 }
253 267
254 BluetoothDeviceExperimentalChromeOS* 268 BluetoothDeviceExperimentalChromeOS*
255 BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath( 269 BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath(
256 const dbus::ObjectPath& object_path) { 270 const dbus::ObjectPath& object_path) {
257 for (DevicesMap::iterator iter = devices_.begin(); 271 for (DevicesMap::iterator iter = devices_.begin();
258 iter != devices_.end(); ++iter) { 272 iter != devices_.end(); ++iter) {
259 BluetoothDeviceExperimentalChromeOS* device_chromeos = 273 BluetoothDeviceExperimentalChromeOS* device_chromeos =
260 static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second); 274 static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second);
261 if (device_chromeos->object_path() == object_path) 275 if (device_chromeos->object_path() == object_path)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError( 391 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError(
378 const ErrorCallback& error_callback, 392 const ErrorCallback& error_callback,
379 const std::string& error_name, 393 const std::string& error_name,
380 const std::string& error_message) { 394 const std::string& error_message) {
381 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: " 395 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: "
382 << error_name << ": " << error_message; 396 << error_name << ": " << error_message;
383 error_callback.Run(); 397 error_callback.Run();
384 } 398 }
385 399
386 } // namespace chromeos 400 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698