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

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

Issue 1672843002: Implement fake Bluetooth adapter for BluetoothTest.ConstructFakeAdapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move ScopedHandle from task manager to low level code Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_classic_win.h" 5 #include "device/bluetooth/bluetooth_classic_win.h"
6 6
7 namespace { 7 namespace {
8 static device::win::BluetoothClassicWrapper* g_instance_ = nullptr; 8 static device::win::BluetoothClassicWrapper* g_instance_ = nullptr;
9 } // namespace 9 } // namespace
10 10
(...skipping 17 matching lines...) Expand all
28 delete g_instance_; 28 delete g_instance_;
29 g_instance_ = instance; 29 g_instance_ = instance;
30 } 30 }
31 31
32 BluetoothClassicWrapper::BluetoothClassicWrapper() {} 32 BluetoothClassicWrapper::BluetoothClassicWrapper() {}
33 BluetoothClassicWrapper::~BluetoothClassicWrapper() {} 33 BluetoothClassicWrapper::~BluetoothClassicWrapper() {}
34 34
35 HBLUETOOTH_RADIO_FIND BluetoothClassicWrapper::FindFirstRadio( 35 HBLUETOOTH_RADIO_FIND BluetoothClassicWrapper::FindFirstRadio(
36 const BLUETOOTH_FIND_RADIO_PARAMS* params, 36 const BLUETOOTH_FIND_RADIO_PARAMS* params,
37 HANDLE* out_handle) { 37 HANDLE* out_handle) {
38 return BluetoothFindFirstRadio(params, out_handle); 38 HANDLE radio_handle = NULL;
39 HBLUETOOTH_RADIO_FIND radio_find_handle =
40 BluetoothFindFirstRadio(params, &radio_handle);
41 if (radio_find_handle) {
42 if (opened_radio_handle_.IsValid())
scheib 2016/02/07 01:45:18 .Set() performs Close (and in that, IsValid). So j
gogerald1 2016/02/08 17:00:04 Done.
43 opened_radio_handle_.Close();
44 opened_radio_handle_.Set(radio_handle);
45 *out_handle = opened_radio_handle_.Get();
46 }
47 return radio_find_handle;
39 } 48 }
40 49
41 DWORD BluetoothClassicWrapper::GetRadioInfo( 50 DWORD BluetoothClassicWrapper::GetRadioInfo(
42 HANDLE handle, 51 HANDLE handle,
43 PBLUETOOTH_RADIO_INFO out_radio_info) { 52 PBLUETOOTH_RADIO_INFO out_radio_info) {
44 return BluetoothGetRadioInfo(handle, out_radio_info); 53 return BluetoothGetRadioInfo(handle, out_radio_info);
45 } 54 }
46 55
47 BOOL BluetoothClassicWrapper::FindRadioClose(HBLUETOOTH_RADIO_FIND handle) { 56 BOOL BluetoothClassicWrapper::FindRadioClose(HBLUETOOTH_RADIO_FIND handle) {
48 return BluetoothFindRadioClose(handle); 57 return BluetoothFindRadioClose(handle);
(...skipping 23 matching lines...) Expand all
72 return BluetoothEnableDiscovery(handle, is_enable); 81 return BluetoothEnableDiscovery(handle, is_enable);
73 } 82 }
74 83
75 BOOL BluetoothClassicWrapper::EnableIncomingConnections(HANDLE handle, 84 BOOL BluetoothClassicWrapper::EnableIncomingConnections(HANDLE handle,
76 BOOL is_enable) { 85 BOOL is_enable) {
77 return BluetoothEnableIncomingConnections(handle, is_enable); 86 return BluetoothEnableIncomingConnections(handle, is_enable);
78 } 87 }
79 88
80 } // namespace win 89 } // namespace win
81 } // namespace device 90 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698