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

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_api.h

Issue 11360200: Decouple bluetooth_event_router from extension_system. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed socket checks from creating and removing adapters. Created 8 years, 1 month 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/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 {

Powered by Google App Engine
This is Rietveld 408576698