| Index: chrome/browser/extensions/declarative_user_script_manager.h
|
| diff --git a/chrome/browser/extensions/declarative_user_script_manager.h b/chrome/browser/extensions/declarative_user_script_manager.h
|
| index ba50ce2014ab063d19ebe888a507b05424561e56..c89698a2900106333cb12c231d02e11cb2a840fc 100644
|
| --- a/chrome/browser/extensions/declarative_user_script_manager.h
|
| +++ b/chrome/browser/extensions/declarative_user_script_manager.h
|
| @@ -9,6 +9,9 @@
|
|
|
| #include "base/macros.h"
|
| #include "base/memory/linked_ptr.h"
|
| +#include "base/scoped_observer.h"
|
| +#include "extensions/browser/extension_registry_observer.h"
|
| +#include "extensions/common/host_id.h"
|
|
|
| class Profile;
|
|
|
| @@ -16,29 +19,41 @@ namespace extensions {
|
| class DeclarativeUserScriptMaster;
|
|
|
| // Manages a set of DeclarativeUserScriptMaster objects for script injections.
|
| -class DeclarativeUserScriptManager {
|
| +class DeclarativeUserScriptManager : public ExtensionRegistryObserver {
|
| public:
|
| explicit DeclarativeUserScriptManager(Profile* profile);
|
| - ~DeclarativeUserScriptManager();
|
| + ~DeclarativeUserScriptManager() override;
|
|
|
| - // Get the user script master for declarative scripts; if one does not exist,
|
| - // a new object will be created.
|
| + // Gets the user script master for declarative scripts by the given
|
| + // HostID; if one does not exist, a new object will be created.
|
| DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID(
|
| - const std::string& id);
|
| + const HostID& host_id);
|
|
|
| private:
|
| using UserScriptMasterMap =
|
| - std::map<std::string, linked_ptr<DeclarativeUserScriptMaster>>;
|
| + std::map<HostID, linked_ptr<DeclarativeUserScriptMaster>>;
|
|
|
| - // A map of DeclarativeUserScriptMasters for ids; each master is lazily
|
| - // initialized.
|
| + // ExtensionRegistryObserver:
|
| + void OnExtensionUnloaded(content::BrowserContext* browser_context,
|
| + const Extension* extension,
|
| + UnloadedExtensionInfo::Reason reason) override;
|
| +
|
| + // Creates a DeclarativeUserScriptMaster object.
|
| + DeclarativeUserScriptMaster* CreateDeclarativeUserScriptMaster(
|
| + const HostID& host_id);
|
| +
|
| + // A map of DeclarativeUserScriptMasters for each host; each master
|
| + // is lazily initialized.
|
| UserScriptMasterMap declarative_user_script_masters_;
|
|
|
| Profile* profile_;
|
|
|
| + ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
|
| + extension_registry_observer_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager);
|
| };
|
|
|
| -} // extensions
|
| +} // namespace extensions
|
|
|
| #endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_
|
|
|