OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_low_energy_device_mac.h" | 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
6 | 6 |
7 #import <CoreFoundation/CoreFoundation.h> | 7 #import <CoreFoundation/CoreFoundation.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 GattServiceMap gatt_services_swapped; | 357 GattServiceMap gatt_services_swapped; |
358 gatt_services_swapped.swap(gatt_services_); | 358 gatt_services_swapped.swap(gatt_services_); |
359 gatt_services_swapped.clear(); | 359 gatt_services_swapped.clear(); |
360 device_uuids_.ClearServiceUUIDs(); | 360 device_uuids_.ClearServiceUUIDs(); |
361 // There are two cases in which this function will be called: | 361 // There are two cases in which this function will be called: |
362 // 1. When the connection to the device breaks (either because | 362 // 1. When the connection to the device breaks (either because |
363 // we closed it or the device closed it). | 363 // we closed it or the device closed it). |
364 // 2. When we cancel a pending connection request. | 364 // 2. When we cancel a pending connection request. |
365 if (create_gatt_connection_error_callbacks_.empty()) { | 365 if (create_gatt_connection_error_callbacks_.empty()) { |
366 // If there are no pending callbacks then the connection broke (#1). | 366 // If there are no pending callbacks then the connection broke (#1). |
367 DidDisconnectGatt(true /* notifyDeviceChanged */); | 367 DidDisconnectGatt(); |
368 return; | 368 return; |
369 } | 369 } |
370 // Else we canceled the connection request (#2). | 370 // Else we canceled the connection request (#2). |
371 // TODO(http://crbug.com/585897): Need to pass the error. | 371 // TODO(http://crbug.com/585897): Need to pass the error. |
372 DidFailToConnectGatt(BluetoothDevice::ConnectErrorCode::ERROR_FAILED); | 372 DidFailToConnectGatt(BluetoothDevice::ConnectErrorCode::ERROR_FAILED); |
373 } | 373 } |
OLD | NEW |