Index: chrome/browser/extensions/declarative_user_script_master.h |
diff --git a/chrome/browser/extensions/declarative_user_script_master.h b/chrome/browser/extensions/declarative_user_script_master.h |
index e9af244cbe43e0ea46607b438231ddaadc974f53..f41545df0bac4a5cfc8cf6c89def08dd7fa02b48 100644 |
--- a/chrome/browser/extensions/declarative_user_script_master.h |
+++ b/chrome/browser/extensions/declarative_user_script_master.h |
@@ -6,22 +6,26 @@ |
#define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
#include "base/scoped_observer.h" |
-#include "chrome/browser/extensions/extension_user_script_loader.h" |
+#include "chrome/browser/extensions/user_script_loader.h" |
+#include "extensions/browser/extension_registry_observer.h" |
+#include "extensions/common/extension.h" |
class Profile; |
namespace extensions { |
+class ExtensionRegistry; |
class UserScript; |
// Manages declarative user scripts for a single extension. Owns a |
// UserScriptLoader to which file loading and shared memory management |
// operations are delegated, and provides an interface for adding, removing, |
// and clearing scripts. |
-class DeclarativeUserScriptMaster { |
+class DeclarativeUserScriptMaster : public ExtensionRegistryObserver { |
public: |
- DeclarativeUserScriptMaster(Profile* profile, const HostID& host_id); |
- ~DeclarativeUserScriptMaster(); |
+ DeclarativeUserScriptMaster(Profile* profile, |
+ const ExtensionId& extension_id); |
+ ~DeclarativeUserScriptMaster() override; |
// Adds script to shared memory region. This may not happen right away if a |
// script load is in progress. |
@@ -35,15 +39,23 @@ class DeclarativeUserScriptMaster { |
// away if a script load is in progress. |
void ClearScripts(); |
- const HostID& host_id() const { return host_id_; } |
+ const ExtensionId& extension_id() const { return extension_id_; } |
private: |
- // ID of host that owns scripts that this component manages. |
- HostID host_id_; |
+ // ExtensionRegistryObserver implementation. |
+ void OnExtensionUnloaded(content::BrowserContext* browser_context, |
+ const Extension* extension, |
+ UnloadedExtensionInfo::Reason reason) override; |
+ |
+ // ID of extension that owns scripts that this component manages. |
+ ExtensionId extension_id_; |
// Script loader that handles loading contents of scripts into shared memory |
// and notifying renderers of script updates. |
- ExtensionUserScriptLoader loader_; |
+ UserScriptLoader loader_; |
+ |
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
+ extension_registry_observer_; |
DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); |
}; |