| 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_manager.h" | 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 10 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| 11 #include "chrome/browser/chromeos/dbus/bluetooth_manager_client.h" | 11 #include "chrome/browser/chromeos/dbus/bluetooth_manager_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 static BluetoothManager* g_bluetooth_manager = NULL; | 16 static BluetoothManager* g_bluetooth_manager = NULL; |
| 17 | 17 |
| 18 class BluetoothManagerImpl : public BluetoothManager, | 18 class BluetoothManagerImpl : public BluetoothManager, |
| 19 public BluetoothManagerClient::Observer { | 19 public BluetoothManagerClient::Observer { |
| 20 public: | 20 public: |
| 21 BluetoothManagerImpl() : weak_ptr_factory_(this) { | 21 BluetoothManagerImpl() : weak_ptr_factory_(this) { |
| 22 DBusThreadManager* dbus_thread_manager = DBusThreadManager::Get(); | 22 DBusThreadManager* dbus_thread_manager = DBusThreadManager::Get(); |
| 23 DCHECK(dbus_thread_manager); | 23 DCHECK(dbus_thread_manager); |
| 24 bluetooth_manager_client_ = dbus_thread_manager->bluetooth_manager_client(); | 24 bluetooth_manager_client_ = |
| 25 dbus_thread_manager->GetBluetoothManagerClient(); |
| 25 DCHECK(bluetooth_manager_client_); | 26 DCHECK(bluetooth_manager_client_); |
| 26 | 27 |
| 27 bluetooth_manager_client_->AddObserver(this); | 28 bluetooth_manager_client_->AddObserver(this); |
| 28 | 29 |
| 29 bluetooth_manager_client_->DefaultAdapter( | 30 bluetooth_manager_client_->DefaultAdapter( |
| 30 base::Bind(&BluetoothManagerImpl::OnDefaultAdapter, | 31 base::Bind(&BluetoothManagerImpl::OnDefaultAdapter, |
| 31 weak_ptr_factory_.GetWeakPtr())); | 32 weak_ptr_factory_.GetWeakPtr())); |
| 32 } | 33 } |
| 33 | 34 |
| 34 virtual void AddObserver(BluetoothManager::Observer* observer) { | 35 virtual void AddObserver(BluetoothManager::Observer* observer) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 g_bluetooth_manager = NULL; | 131 g_bluetooth_manager = NULL; |
| 131 } | 132 } |
| 132 } | 133 } |
| 133 | 134 |
| 134 // static | 135 // static |
| 135 BluetoothManager* BluetoothManager::GetInstance() { | 136 BluetoothManager* BluetoothManager::GetInstance() { |
| 136 return g_bluetooth_manager; | 137 return g_bluetooth_manager; |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace chromeos | 140 } // namespace chromeos |
| OLD | NEW |