| Index: chrome/browser/extensions/bluetooth_event_router.h
|
| diff --git a/chrome/browser/extensions/bluetooth_event_router.h b/chrome/browser/extensions/bluetooth_event_router.h
|
| index 657053879190b2520ae6f936a4d4e8c665fa1105..3844a733f25bc12bd8c25e1e21ca1ffa7255fb3a 100644
|
| --- a/chrome/browser/extensions/bluetooth_event_router.h
|
| +++ b/chrome/browser/extensions/bluetooth_event_router.h
|
| @@ -6,6 +6,7 @@
|
| #define CHROME_BROWSER_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_
|
|
|
| #include <map>
|
| +#include <string>
|
|
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_vector.h"
|
| @@ -20,6 +21,11 @@ class ExtensionBluetoothEventRouter
|
| : public device::BluetoothAdapter::Observer {
|
| public:
|
| explicit ExtensionBluetoothEventRouter(Profile* profile);
|
| +
|
| + // Constructor for testing.
|
| + ExtensionBluetoothEventRouter(
|
| + Profile* profile, device::BluetoothAdapter* adapter);
|
| +
|
| virtual ~ExtensionBluetoothEventRouter();
|
|
|
| // adapter() will return NULL if the bluetooth adapter is not supported in the
|
| @@ -34,6 +40,10 @@ class ExtensionBluetoothEventRouter
|
| return adapter_.get();
|
| }
|
|
|
| + // Add |this| as an observer to |adapter_| if the added event is a bluetooth
|
| + // event.
|
| + void OnEventListenerAdded(const std::string& event_name);
|
| +
|
| // Register the BluetoothSocket |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.
|
| @@ -74,6 +84,8 @@ class ExtensionBluetoothEventRouter
|
| adapter_ = adapter;
|
| }
|
| private:
|
| + static bool IsBluetoothEvent(const std::string& event_name);
|
| +
|
| void DispatchBooleanValueEvent(const char* event_name, bool value);
|
|
|
| bool send_discovery_events_;
|
| @@ -82,6 +94,9 @@ class ExtensionBluetoothEventRouter
|
| Profile* profile_;
|
| scoped_refptr<device::BluetoothAdapter> adapter_;
|
|
|
| + // true if ExtensionBluetoothEventRouter is observing adapter_.
|
| + bool observing_;
|
| +
|
| // The next id to use for referring to a BluetoothSocket. We avoid using
|
| // the fd of the socket because we don't want to leak that information to
|
| // the extension javascript.
|
|
|