Index: device/bluetooth/bluetooth_task_manager_win.cc |
diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6cc51de197d279e87509666addbc4609441f9083 |
--- /dev/null |
+++ b/device/bluetooth/bluetooth_task_manager_win.cc |
@@ -0,0 +1,47 @@ |
+// 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_task_manager_win.h" |
+ |
+#include "base/bind.h" |
+#include "base/message_loop.h" |
+#include "device/bluetooth/bluetooth_polling_thread_win.h" |
+ |
+namespace device { |
+ |
+BluetoothTaskManagerWin::BluetoothTaskManagerWin() |
+ : ui_task_runner_(MessageLoop::current()->message_loop_proxy()), |
+ ALLOW_THIS_IN_INITIALIZER_LIST(thread_(this)) { |
+} |
+ |
+BluetoothTaskManagerWin::~BluetoothTaskManagerWin() { |
+} |
+ |
+void BluetoothTaskManagerWin::AddObserver(Observer* observer) { |
+ CHECK(observer); |
+ observers_.AddObserver(observer); |
+} |
+ |
+void BluetoothTaskManagerWin::RemoveObserver(Observer* observer) { |
+ CHECK(observer); |
+ observers_.RemoveObserver(observer); |
+} |
+ |
+void BluetoothTaskManagerWin::StartThread() { |
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
+ thread_.StartPolling(); |
+} |
+ |
+void BluetoothTaskManagerWin::StopThread() { |
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
+ thread_.Cancel(); |
+} |
+ |
+void BluetoothTaskManagerWin::OnAdapterStateChanged(const AdapterState* state) { |
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
+ FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_, |
+ AdapterStateChanged(*state)); |
+} |
+ |
+} // namespace device |