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

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..44e1dd3bbc525d18471937a30c51cb55c51a7ba4 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:
@@ -64,9 +67,6 @@ class RuntimeAPI : public BrowserContextKeyedAPI,
friend class BrowserContextKeyedAPIFactory<RuntimeAPI>;
void OnExtensionsReady();
- void OnExtensionLoaded(const Extension* extension);
- void OnExtensionInstalled(const Extension* extension);
- void OnExtensionUninstalled(const Extension* extension);
// BrowserContextKeyedAPI implementation:
static const char* service_name() { return "RuntimeAPI"; }
@@ -74,6 +74,19 @@ class RuntimeAPI : public BrowserContextKeyedAPI,
static const bool kServiceIsNULLWhileTesting = true;
virtual void Shutdown() OVERRIDE;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
Devlin 2014/07/22 22:21:12 let's move this above the BCKAPI impl methods so t
rpaquay 2014/07/23 00:03:59 Done.
+ 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;
+
// extensions::UpdateObserver overrides:
virtual void OnAppUpdateAvailable(const Extension* extension) OVERRIDE;
virtual void OnChromeUpdateAvailable() OVERRIDE;
@@ -91,6 +104,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 +141,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