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..488bcf86e9d420487d2a70061ff0ece9ef6d4793 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 |
@@ -30,9 +36,12 @@ class ExtensionBluetoothEventRouter |
// GetMutableAdapter will return NULL if the bluetooth adapter is not |
// supported in the current platform. |
- device::BluetoothAdapter* GetMutableAdapter() { |
- return adapter_.get(); |
- } |
+ // This function will also add |this| as an observer to |adapter_|. |
+ device::BluetoothAdapter* GetMutableAdapter(); |
+ |
+ // 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 |
@@ -74,6 +83,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_; |