Chromium Code Reviews| 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 ee8833e3d49c85290740a4eb7b6de5484dc3de50..295bb1b120588cc58b70e864640baf7348880746 100644 |
| --- a/chrome/browser/extensions/api/declarative/rules_registry_service.h |
| +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h |
| @@ -38,6 +38,9 @@ namespace extensions { |
| class RulesRegistryService : public ProfileKeyedAPI, |
| public content::NotificationObserver { |
| public: |
| + typedef RulesRegistry::WebViewKey WebViewKey; |
| + typedef std::pair<std::string, WebViewKey> RulesRegistryKey; |
| + |
| explicit RulesRegistryService(Profile* profile); |
| virtual ~RulesRegistryService(); |
| @@ -52,7 +55,8 @@ class RulesRegistryService : public ProfileKeyedAPI, |
| static RulesRegistryService* Get(Profile* profile); |
| // Registers the default RulesRegistries used in Chromium. |
| - void RegisterDefaultRulesRegistries(); |
| + void RegisterDefaultRulesRegistriesIfNotAvailable( |
| + const WebViewKey& webview_key); |
| // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry. |
| void RegisterRulesRegistry(scoped_refptr<RulesRegistry> rule_registry); |
| @@ -60,26 +64,37 @@ class RulesRegistryService : public ProfileKeyedAPI, |
| // Returns the RulesRegistry for |event_name| or NULL if no such registry |
| // has been registered. |
|
vabr (Chromium)
2013/10/25 20:40:24
Is this comment still up-to-date? It looks like it
Fady Samuel
2013/10/25 22:48:08
Done.
vabr (Chromium)
2013/10/28 14:46:09
It's more precise now, but it still does not say t
|
| 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 { |
| - return content_rules_registry_; |
| - } |
| + ContentRulesRegistry* GetContentRulesRegistry( |
| + const WebViewKey& webview_key); |
| + |
| + // 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> > RulesRegistryMap; |
| + // Maps <event name, webview key> to RuleRegistries that handle these |
| + // events. |
| + typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> > |
| + RulesRegistryMap; |
| + |
| + typedef std::set<WebViewKey> WebViewKeySet; |
| + typedef std::set<RulesRegistryKey> RulesRegistryKeySet; |
| // Notifies all RulesRegistries that |extension_id| was unloaded. |
| // It is not guaranteed that this notification is processed synchronously. |
| // If extensions live on another thread, the notification is posted. |
| void OnExtensionUnloaded(const std::string& extension_id); |
| + // Removes a rules registry associated with a given |key|. |
| + void RemoveRulesRegistry(const RulesRegistryKey& key); |
| + |
| // Implementation of content::NotificationObserver. |
| virtual void Observe(int type, |
| const content::NotificationSource& source, |
| @@ -94,6 +109,10 @@ class RulesRegistryService : public ProfileKeyedAPI, |
| RulesRegistryMap rule_registries_; |
| + // Indicates the set of <webview>s that have default rule registries |
| + // installed. |
| + WebViewKeySet installed_rules_registries_; |
| + |
| // We own the parts of the registries which need to run on the UI thread. |
| ScopedVector<RulesRegistryWithCache::RuleStorageOnUI> ui_parts_of_registries_; |