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

Unified Diff: device/bluetooth/bluetooth_manager_win.cc

Issue 11411130: Implemented BluetoothTaskManagerWin class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed unnecessary lines. Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_manager_win.cc
diff --git a/device/bluetooth/bluetooth_manager_win.cc b/device/bluetooth/bluetooth_manager_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e3fef5450143471a7cf14a6cd8112ccc9a7a9376
--- /dev/null
+++ b/device/bluetooth/bluetooth_manager_win.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/bluetooth_manager_win.h"
+
+#include <BluetoothAPIs.h>
+#include "base/callback.h"
+#include "content/public/browser/browser_thread.h"
+#include "device/bluetooth/bluetooth_adapter_win.h"
+
+# pragma comment(lib, "Bthprops.lib")
+
+namespace {
+
+ const char* kBluetoothManagerThreadName = "BluetoothManagerThread";
bryeung 2012/11/22 18:13:25 no indent
youngki 2012/11/23 01:50:47 Done.
+ const BLUETOOTH_FIND_RADIO_PARAMS adapter_param =
+ { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
bryeung 2012/11/22 18:13:25 blank line
youngki 2012/11/23 01:50:47 Done.
+} // namespace
+
+namespace device {
+
+BluetoothManagerWin::BluetoothManagerWin()
+ : Thread(kBluetoothManagerThreadName) {}
+
+BluetoothManagerWin::~BluetoothManagerWin() {
+ Stop();
+}
+
+void BluetoothManagerWin::FindAdapterHandleAndReply(
+ base::WeakPtr<BluetoothAdapterWin> weak_ptr) {
+ HANDLE adapter_handle = FindAdapterHandle();
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&BluetoothAdapterWin::OnAdapterHandleAvailable,
+ weak_ptr,
+ adapter_handle));
+}
+
+HANDLE BluetoothManagerWin::FindAdapterHandle() {
+ HBLUETOOTH_RADIO_FIND adapter_handle = NULL;
+ HBLUETOOTH_RADIO_FIND handle = BluetoothFindFirstRadio(&adapter_param,
+ &adapter_handle);
+ if (handle)
+ BluetoothFindRadioClose(handle);
+
+ return adapter_handle;
+}
+
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698