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

Unified Diff: chrome/browser/extensions/api/streams_private/streams_private_api.h

Issue 244473002: Remove NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED from c/b/e/api (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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/extensions/api/streams_private/streams_private_api.h
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.h b/chrome/browser/extensions/api/streams_private/streams_private_api.h
index c266de32e88b8dc346ac4fb1aeb0d551286656fc..0f6f7e96870e1a2e1a8ba389785514b25ce4be4c 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.h
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.h
@@ -7,17 +7,11 @@
#include <map>
#include <string>
-#include <vector>
-#include "base/values.h"
-#include "components/keyed_service/core/keyed_service.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
+#include "base/scoped_observer.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
-#include "extensions/common/extension.h"
-
-class Profile;
+#include "extensions/browser/extension_registry_observer.h"
namespace content {
class BrowserContext;
@@ -25,11 +19,12 @@ class StreamHandle;
}
namespace extensions {
+class ExtensionRegistry;
class StreamsPrivateAPI : public BrowserContextKeyedAPI,
- public content::NotificationObserver {
+ public ExtensionRegistryObserver {
public:
- // Convenience method to get the StreamsPrivateAPI for a profile.
+ // Convenience method to get the StreamsPrivateAPI for a BrowserContext.
static StreamsPrivateAPI* Get(content::BrowserContext* context);
explicit StreamsPrivateAPI(content::BrowserContext* context);
@@ -43,17 +38,18 @@ class StreamsPrivateAPI : public BrowserContextKeyedAPI,
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
private:
friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
typedef std::map<std::string,
std::map<GURL,
linked_ptr<content::StreamHandle> > > StreamMap;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
+
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
return "StreamsPrivateAPI";
@@ -61,10 +57,13 @@ class StreamsPrivateAPI : public BrowserContextKeyedAPI,
static const bool kServiceIsNULLWhileTesting = true;
static const bool kServiceRedirectedInIncognito = true;
- Profile* const profile_;
- content::NotificationRegistrar registrar_;
+ content::BrowserContext* const browser_context_;
StreamMap streams_;
base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
+
+ // Listen to extension unloaded notifications.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ scoped_extension_registry_observer_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698