OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 10 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
11 #include "chrome/browser/chromeos/dbus/bluetooth_adapter_client.h" | 11 #include "chrome/browser/chromeos/dbus/bluetooth_adapter_client.h" |
12 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 12 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 class BluetoothAdapterImpl : public BluetoothAdapter, | 16 class BluetoothAdapterImpl : public BluetoothAdapter, |
17 public BluetoothAdapterClient::Observer { | 17 public BluetoothAdapterClient::Observer { |
18 public: | 18 public: |
19 explicit BluetoothAdapterImpl(const std::string& id) : id_(id) { | 19 explicit BluetoothAdapterImpl(const std::string& id) : id_(id) { |
20 DBusThreadManager* dbus_thread_manager = DBusThreadManager::Get(); | 20 DBusThreadManager* dbus_thread_manager = DBusThreadManager::Get(); |
21 DCHECK(dbus_thread_manager); | 21 DCHECK(dbus_thread_manager); |
22 bluetooth_adapter_client_ = dbus_thread_manager->bluetooth_adapter_client(); | 22 bluetooth_adapter_client_ = |
| 23 dbus_thread_manager->GetBluetoothAdapterClient(); |
23 DCHECK(bluetooth_adapter_client_); | 24 DCHECK(bluetooth_adapter_client_); |
24 bluetooth_adapter_client_->AddObserver(this, id_); | 25 bluetooth_adapter_client_->AddObserver(this, id_); |
25 } | 26 } |
26 | 27 |
27 virtual ~BluetoothAdapterImpl() { | 28 virtual ~BluetoothAdapterImpl() { |
28 DCHECK(bluetooth_adapter_client_); | 29 DCHECK(bluetooth_adapter_client_); |
29 bluetooth_adapter_client_->RemoveObserver(this, id_); | 30 bluetooth_adapter_client_->RemoveObserver(this, id_); |
30 } | 31 } |
31 | 32 |
32 virtual void AddObserver(BluetoothAdapter::Observer* observer) { | 33 virtual void AddObserver(BluetoothAdapter::Observer* observer) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 BluetoothAdapter::~BluetoothAdapter() { | 126 BluetoothAdapter::~BluetoothAdapter() { |
126 } | 127 } |
127 | 128 |
128 // static | 129 // static |
129 BluetoothAdapter* BluetoothAdapter::Create(const std::string& id) { | 130 BluetoothAdapter* BluetoothAdapter::Create(const std::string& id) { |
130 return new BluetoothAdapterImpl(id); | 131 return new BluetoothAdapterImpl(id); |
131 } | 132 } |
132 | 133 |
133 } // namespace chromeos | 134 } // namespace chromeos |
OLD | NEW |