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

Unified Diff: extensions/browser/api/runtime/runtime_api.h

Issue 406063002: Hook up runtime API to implement ExtensionRegistryObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback. Created 6 years, 5 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
« no previous file with comments | « no previous file | extensions/browser/api/runtime/runtime_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/runtime/runtime_api.h
diff --git a/extensions/browser/api/runtime/runtime_api.h b/extensions/browser/api/runtime/runtime_api.h
index e34139814d40f287a923f81baa21aa1faf0c7204..8c346d6af11e440cd9975964d956e7e27baa63df 100644
--- a/extensions/browser/api/runtime/runtime_api.h
+++ b/extensions/browser/api/runtime/runtime_api.h
@@ -7,11 +7,13 @@
#include <string>
+#include "base/scoped_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
+#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/process_manager_observer.h"
#include "extensions/browser/update_observer.h"
#include "extensions/common/api/runtime.h"
@@ -40,6 +42,7 @@ class ExtensionHost;
// its related incognito instance.
class RuntimeAPI : public BrowserContextKeyedAPI,
public content::NotificationObserver,
+ public ExtensionRegistryObserver,
public UpdateObserver,
public ProcessManagerObserver {
public:
@@ -63,10 +66,18 @@ class RuntimeAPI : public BrowserContextKeyedAPI,
private:
friend class BrowserContextKeyedAPIFactory<RuntimeAPI>;
- void OnExtensionsReady();
- void OnExtensionLoaded(const Extension* extension);
- void OnExtensionInstalled(const Extension* extension);
- void OnExtensionUninstalled(const Extension* extension);
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ bool is_update,
+ bool from_ephemeral,
+ const std::string& old_name) OVERRIDE;
+ virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
+ const Extension* extension,
+ UninstallReason reason) OVERRIDE;
// BrowserContextKeyedAPI implementation:
static const char* service_name() { return "RuntimeAPI"; }
@@ -91,6 +102,10 @@ class RuntimeAPI : public BrowserContextKeyedAPI,
content::NotificationRegistrar registrar_;
+ // Listen to extension notifications.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
DISALLOW_COPY_AND_ASSIGN(RuntimeAPI);
};
@@ -124,7 +139,8 @@ class RuntimeEventRouter {
// Does any work needed at extension uninstall (e.g. load uninstall url).
static void OnExtensionUninstalled(content::BrowserContext* context,
- const std::string& extension_id);
+ const std::string& extension_id,
+ UninstallReason reason);
};
class RuntimeGetBackgroundPageFunction : public UIThreadExtensionFunction {
« no previous file with comments | « no previous file | extensions/browser/api/runtime/runtime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698