| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "device/bluetooth/bluetooth_adapter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "device/bluetooth/bluetooth_common.h" |
| 14 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device.h" |
| 15 #include "device/bluetooth/bluetooth_discovery_session.h" | 16 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 16 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" | 17 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" |
| 17 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 18 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 18 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 19 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 19 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 20 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 20 | 21 |
| 21 namespace device { | 22 namespace device { |
| 22 | 23 |
| 23 BluetoothAdapter::ServiceOptions::ServiceOptions() { | 24 BluetoothAdapter::ServiceOptions::ServiceOptions() { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // if masked_filter is pointing to empty filter, and there are | 346 // if masked_filter is pointing to empty filter, and there are |
| 346 // multiple empty filters in discovery_sessions_, make sure we'll | 347 // multiple empty filters in discovery_sessions_, make sure we'll |
| 347 // process next empty sessions. | 348 // process next empty sessions. |
| 348 omit = false; | 349 omit = false; |
| 349 continue; | 350 continue; |
| 350 } | 351 } |
| 351 | 352 |
| 352 if (first_merge) { | 353 if (first_merge) { |
| 353 first_merge = false; | 354 first_merge = false; |
| 354 if (curr_filter) { | 355 if (curr_filter) { |
| 355 result.reset(new BluetoothDiscoveryFilter( | 356 result.reset(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_DUAL)); |
| 356 BluetoothDiscoveryFilter::Transport::TRANSPORT_DUAL)); | |
| 357 result->CopyFrom(*curr_filter); | 357 result->CopyFrom(*curr_filter); |
| 358 } | 358 } |
| 359 continue; | 359 continue; |
| 360 } | 360 } |
| 361 | 361 |
| 362 result = BluetoothDiscoveryFilter::Merge(result.get(), curr_filter); | 362 result = BluetoothDiscoveryFilter::Merge(result.get(), curr_filter); |
| 363 } | 363 } |
| 364 | 364 |
| 365 return result; | 365 return result; |
| 366 } | 366 } |
| 367 | 367 |
| 368 // static | 368 // static |
| 369 void BluetoothAdapter::RecordBluetoothDiscoverySessionStartOutcome( | 369 void BluetoothAdapter::RecordBluetoothDiscoverySessionStartOutcome( |
| 370 UMABluetoothDiscoverySessionOutcome outcome) { | 370 UMABluetoothDiscoverySessionOutcome outcome) { |
| 371 UMA_HISTOGRAM_ENUMERATION( | 371 UMA_HISTOGRAM_ENUMERATION( |
| 372 "Bluetooth.DiscoverySession.Start.Outcome", static_cast<int>(outcome), | 372 "Bluetooth.DiscoverySession.Start.Outcome", static_cast<int>(outcome), |
| 373 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); | 373 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); |
| 374 } | 374 } |
| 375 | 375 |
| 376 // static | 376 // static |
| 377 void BluetoothAdapter::RecordBluetoothDiscoverySessionStopOutcome( | 377 void BluetoothAdapter::RecordBluetoothDiscoverySessionStopOutcome( |
| 378 UMABluetoothDiscoverySessionOutcome outcome) { | 378 UMABluetoothDiscoverySessionOutcome outcome) { |
| 379 UMA_HISTOGRAM_ENUMERATION( | 379 UMA_HISTOGRAM_ENUMERATION( |
| 380 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome), | 380 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome), |
| 381 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); | 381 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace device | 384 } // namespace device |
| OLD | NEW |