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

Unified Diff: chrome/browser/autocomplete/extension_app_provider.h

Issue 271393003: Use ExtensionRegistryObserver instead of deprecated extension notification from autocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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/autocomplete/extension_app_provider.h
diff --git a/chrome/browser/autocomplete/extension_app_provider.h b/chrome/browser/autocomplete/extension_app_provider.h
index 5dbcc2638bb9259664955149f35bbe8642d5b234..4e929f6a716157b3d4a944525c2eb93681a4641c 100644
--- a/chrome/browser/autocomplete/extension_app_provider.h
+++ b/chrome/browser/autocomplete/extension_app_provider.h
@@ -10,18 +10,25 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/autocomplete/autocomplete_provider.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/extension_registry_observer.h"
#include "ui/base/window_open_disposition.h"
+namespace extensions {
+class ExtensionRegistry;
+}
+
// This provider is responsible for keeping track of which Extension Apps are
// installed and their URLs. An instance of it gets created and managed by
// AutocompleteController.
class ExtensionAppProvider : public AutocompleteProvider,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public extensions::ExtensionRegistryObserver {
public:
ExtensionAppProvider(AutocompleteProviderListener* listener,
Profile* profile);
@@ -76,6 +83,11 @@ class ExtensionAppProvider : public AutocompleteProvider,
int target_length,
const GURL& url);
+ // Overridden from extensions::ExtensionRegistryObserver.
Peter Kasting 2014/05/12 19:46:55 Nit: It looks like file style is to say "extension
limasdf 2014/05/13 14:38:44 Done.
+ virtual void OnExtensionLoaded(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension) OVERRIDE;
+
// content::NotificationObserver implementation:
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -83,6 +95,11 @@ class ExtensionAppProvider : public AutocompleteProvider,
content::NotificationRegistrar registrar_;
+ // Listen to extension load notifications.
Peter Kasting 2014/05/12 19:46:55 Remove this comment; it's not useful.
limasdf 2014/05/13 14:38:44 Done.
+ ScopedObserver<extensions::ExtensionRegistry,
+ extensions::ExtensionRegistryObserver>
+ extension_registry_observer_;
+
// Our cache of ExtensionApp objects (name + url) representing the extension
// apps we know/care about.
ExtensionApps extension_apps_;

Powered by Google App Engine
This is Rietveld 408576698