Index: chrome/browser/extensions/api/bluetooth/bluetooth_api.h |
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h |
index 02aea24fd931bff03483111ba7a5ce15b541f2f6..919b47775ac08082282c25bd6c310b2a8a8065af 100644 |
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h |
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h |
@@ -8,8 +8,11 @@ |
#include <string> |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "chrome/browser/extensions/api/api_function.h" |
+#include "chrome/browser/extensions/event_router.h" |
#include "chrome/browser/extensions/extension_function.h" |
+#include "chrome/browser/profiles/profile_keyed_service.h" |
#include "device/bluetooth/bluetooth_device.h" |
namespace device { |
@@ -20,6 +23,35 @@ struct BluetoothOutOfBandPairingData; |
} // namespace device |
namespace extensions { |
+ |
+class ExtensionBluetoothEventRouter; |
+ |
+// The profile-keyed service that manages the bluetooth extension API. |
+class BluetoothAPI : public ProfileKeyedService, |
+ public EventRouter::Observer { |
+ public: |
+ // Convenience method to get the BluetoothAPI for a profile. |
+ static BluetoothAPI* Get(Profile* profile); |
+ |
+ explicit BluetoothAPI(Profile* profile); |
+ virtual ~BluetoothAPI(); |
+ |
+ // ProfileKeyedService implementation. |
+ virtual void Shutdown() OVERRIDE; |
+ |
+ ExtensionBluetoothEventRouter* bluetooth_event_router(); |
bryeung
2012/11/13 16:16:15
also move this about Shutdown
youngki
2012/11/13 17:01:30
Done.
|
+ |
+ // EventRouter::Observer implementation. |
+ virtual void OnListenerAdded(const std::string& event_name) OVERRIDE; |
+ virtual void OnListenerRemoved(const std::string& event_name) OVERRIDE; |
+ |
+ private: |
+ Profile* profile_; |
+ |
+ // Created lazily on first access. |
+ scoped_ptr<ExtensionBluetoothEventRouter> bluetooth_event_router_; |
+}; |
+ |
namespace api { |
class BluetoothIsAvailableFunction : public SyncExtensionFunction { |