| Index: chrome/browser/extensions/api/declarative/rules_registry_service.h
|
| diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.h b/chrome/browser/extensions/api/declarative/rules_registry_service.h
|
| index aa51607d30611e8b999f67cdbe862c87a6db7960..461377d98c1b0a5479eb3b1b0733db985065a8a8 100644
|
| --- a/chrome/browser/extensions/api/declarative/rules_registry_service.h
|
| +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h
|
| @@ -38,6 +38,21 @@ namespace extensions {
|
| class RulesRegistryService : public ProfileKeyedAPI,
|
| public content::NotificationObserver {
|
| public:
|
| + typedef RulesRegistry::WebViewKey WebViewKey;
|
| + struct RulesRegistryKey {
|
| + std::string event_name;
|
| + WebViewKey webview_key;
|
| + RulesRegistryKey(const std::string event_name,
|
| + const WebViewKey& webview_key)
|
| + : event_name(event_name),
|
| + webview_key(webview_key) {}
|
| + bool operator<(const RulesRegistryKey& other) const {
|
| + return (event_name < other.event_name) ||
|
| + ((event_name == other.event_name) &&
|
| + (webview_key < other.webview_key));
|
| + }
|
| + };
|
| +
|
| explicit RulesRegistryService(Profile* profile);
|
| virtual ~RulesRegistryService();
|
|
|
| @@ -52,28 +67,36 @@ class RulesRegistryService : public ProfileKeyedAPI,
|
| static RulesRegistryService* Get(Profile* profile);
|
|
|
| // Registers the default RulesRegistries used in Chromium.
|
| - void RegisterDefaultRulesRegistries();
|
| + void EnsureDefaultRulesRegistriesRegistered(
|
| + const WebViewKey& webview_key);
|
|
|
| // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry.
|
| void RegisterRulesRegistry(scoped_refptr<RulesRegistry> rule_registry);
|
|
|
| - // Returns the RulesRegistry for |event_name| or NULL if no such registry
|
| - // has been registered.
|
| + // Returns the RulesRegistry for |event_name| and |webview_key| or NULL if no
|
| + // such registry has been registered. Default rules registries (such as the
|
| + // WebRequest rules registry) will be created on first access.
|
| scoped_refptr<RulesRegistry> GetRulesRegistry(
|
| - const std::string& event_name) const;
|
| + const WebViewKey& webview_key,
|
| + const std::string& event_name);
|
|
|
| // Accessors for each type of rules registry.
|
| ContentRulesRegistry* content_rules_registry() const {
|
| + CHECK(content_rules_registry_);
|
| return content_rules_registry_;
|
| }
|
|
|
| + // Removes all rules registries of a given webview embedder process ID.
|
| + void RemoveWebViewRulesRegistries(int process_id);
|
| +
|
| // For testing.
|
| void SimulateExtensionUnloaded(const std::string& extension_id);
|
| private:
|
| friend class ProfileKeyedAPIFactory<RulesRegistryService>;
|
|
|
| - // Maps event names to RuleRegistries that handle these events.
|
| - typedef std::map<std::string, scoped_refptr<RulesRegistry> >
|
| + // Maps <event name, webview key> to RuleRegistries that handle these
|
| + // events.
|
| + typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> >
|
| RulesRegistryMap;
|
|
|
| // Notifies all RulesRegistries that |extension_id| was unloaded.
|
|
|