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

Unified Diff: chrome/browser/chromeos/extensions/bluetooth_event_router.h

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added #include <string> into bluetooth_adapter_dbus.cc. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/bluetooth_event_router.h
diff --git a/chrome/browser/chromeos/extensions/bluetooth_event_router.h b/chrome/browser/chromeos/extensions/bluetooth_event_router.h
index c10b9736012dcf76e26a3f94b22a41e3b29d8096..af91df9bdf0b9b915583f3204759c7c2141b053d 100644
--- a/chrome/browser/chromeos/extensions/bluetooth_event_router.h
+++ b/chrome/browser/chromeos/extensions/bluetooth_event_router.h
@@ -9,35 +9,40 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
-#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
-#include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/experimental_bluetooth.h"
namespace chromeos {
class ExtensionBluetoothEventRouter
- : public chromeos::BluetoothAdapter::Observer {
+ : public chromeos::BluetoothAdapterDBus::Observer {
public:
explicit ExtensionBluetoothEventRouter(Profile* profile);
virtual ~ExtensionBluetoothEventRouter();
- const chromeos::BluetoothAdapter& adapter() const { return *adapter_.get(); }
+ const chromeos::BluetoothAdapterDBus& adapter() const {
bryeung 2012/09/07 18:35:57 this should be using the generic interface instead
youngki 2012/09/13 18:05:02 Done.
+ return *adapter_.get();
+ }
// GetMutableAdapter will never return NULL.
- chromeos::BluetoothAdapter* GetMutableAdapter() { return adapter_.get(); }
+ chromeos::BluetoothAdapterDBus* GetMutableAdapter() {
+ return adapter_.get();
+ }
- // Register the BluetoothSocket |socket| for use by the extensions system.
+ // Register the BluetoothSocketPosix |socket| for use by the extensions
+ // system.
// This class will hold onto the socket for its lifetime, or until
// ReleaseSocket is called for the socket. Returns an id for the socket.
- int RegisterSocket(scoped_refptr<BluetoothSocket> socket);
+ int RegisterSocket(scoped_refptr<BluetoothSocketPosix> socket);
- // Release the BluetoothSocket corresponding to |id|. Returns true if
+ // Release the BluetoothSocketPosix corresponding to |id|. Returns true if
// the socket was found and released, false otherwise.
bool ReleaseSocket(int id);
- // Get the BluetoothSocket corresponding to |id|.
- scoped_refptr<BluetoothSocket> GetSocket(int id);
+ // Get the BluetoothSocketPosix corresponding to |id|.
+ scoped_refptr<BluetoothSocketPosix> GetSocket(int id);
// Sets whether this Profile is responsible for the discovering state of the
// adapter.
@@ -47,18 +52,19 @@ class ExtensionBluetoothEventRouter
// Sets whether or not DeviceAdded events will be dispatched to extensions.
void SetSendDiscoveryEvents(bool should_send);
- // Override from chromeos::BluetoothAdapter::Observer
- virtual void AdapterPresentChanged(chromeos::BluetoothAdapter* adapter,
+ // Override from chromeos::BluetoothAdapterDBus::Observer
+ virtual void AdapterPresentChanged(chromeos::BluetoothAdapterDBus* adapter,
bool present) OVERRIDE;
- virtual void AdapterPoweredChanged(chromeos::BluetoothAdapter* adapter,
+ virtual void AdapterPoweredChanged(chromeos::BluetoothAdapterDBus* adapter,
bool has_power) OVERRIDE;
- virtual void AdapterDiscoveringChanged(chromeos::BluetoothAdapter* adapter,
- bool discovering) OVERRIDE;
- virtual void DeviceAdded(chromeos::BluetoothAdapter* adapter,
- chromeos::BluetoothDevice* device) OVERRIDE;
+ virtual void AdapterDiscoveringChanged(
+ chromeos::BluetoothAdapterDBus* adapter,
+ bool discovering) OVERRIDE;
+ virtual void DeviceAdded(chromeos::BluetoothAdapterDBus* adapter,
+ chromeos::BluetoothDeviceDBus* device) OVERRIDE;
// Exposed for testing.
- void SetAdapterForTest(chromeos::BluetoothAdapter* adapter) {
+ void SetAdapterForTest(chromeos::BluetoothAdapterDBus* adapter) {
adapter_ = adapter;
}
private:
@@ -70,14 +76,14 @@ class ExtensionBluetoothEventRouter
bool responsible_for_discovery_;
Profile* profile_;
- scoped_refptr<chromeos::BluetoothAdapter> adapter_;
+ scoped_refptr<chromeos::BluetoothAdapterDBus> adapter_;
- // The next id to use for referring to a BluetoothSocket. We avoid using
+ // The next id to use for referring to a BluetoothSocketPosix. We avoid using
// the fd of the socket because we don't want to leak that information to
// the extension javascript.
int next_socket_id_;
- typedef std::map<int, scoped_refptr<BluetoothSocket> > SocketMap;
+ typedef std::map<int, scoped_refptr<BluetoothSocketPosix> > SocketMap;
SocketMap socket_map_;
typedef ScopedVector<extensions::api::experimental_bluetooth::Device>

Powered by Google App Engine
This is Rietveld 408576698