| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ((event_name == other.event_name) && | 51 ((event_name == other.event_name) && |
| 52 (webview_key < other.webview_key)); | 52 (webview_key < other.webview_key)); |
| 53 } | 53 } |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 explicit RulesRegistryService(content::BrowserContext* context); | 56 explicit RulesRegistryService(content::BrowserContext* context); |
| 57 virtual ~RulesRegistryService(); | 57 virtual ~RulesRegistryService(); |
| 58 | 58 |
| 59 // Unregisters refptrs to concrete RulesRegistries at other objects that were | 59 // Unregisters refptrs to concrete RulesRegistries at other objects that were |
| 60 // created by us so that the RulesRegistries can be released. | 60 // created by us so that the RulesRegistries can be released. |
| 61 virtual void Shutdown() OVERRIDE; | 61 virtual void Shutdown() override; |
| 62 | 62 |
| 63 // BrowserContextKeyedAPI implementation. | 63 // BrowserContextKeyedAPI implementation. |
| 64 static BrowserContextKeyedAPIFactory<RulesRegistryService>* | 64 static BrowserContextKeyedAPIFactory<RulesRegistryService>* |
| 65 GetFactoryInstance(); | 65 GetFactoryInstance(); |
| 66 | 66 |
| 67 // Convenience method to get the RulesRegistryService for a context. | 67 // Convenience method to get the RulesRegistryService for a context. |
| 68 static RulesRegistryService* Get(content::BrowserContext* context); | 68 static RulesRegistryService* Get(content::BrowserContext* context); |
| 69 | 69 |
| 70 // Registers the default RulesRegistries used in Chromium. | 70 // Registers the default RulesRegistries used in Chromium. |
| 71 void EnsureDefaultRulesRegistriesRegistered(const WebViewKey& webview_key); | 71 void EnsureDefaultRulesRegistriesRegistered(const WebViewKey& webview_key); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 friend class BrowserContextKeyedAPIFactory<RulesRegistryService>; | 95 friend class BrowserContextKeyedAPIFactory<RulesRegistryService>; |
| 96 | 96 |
| 97 // Maps <event name, webview key> to RuleRegistries that handle these | 97 // Maps <event name, webview key> to RuleRegistries that handle these |
| 98 // events. | 98 // events. |
| 99 typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> > | 99 typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> > |
| 100 RulesRegistryMap; | 100 RulesRegistryMap; |
| 101 | 101 |
| 102 // Implementation of content::NotificationObserver. | 102 // Implementation of content::NotificationObserver. |
| 103 virtual void Observe(int type, | 103 virtual void Observe(int type, |
| 104 const content::NotificationSource& source, | 104 const content::NotificationSource& source, |
| 105 const content::NotificationDetails& details) OVERRIDE; | 105 const content::NotificationDetails& details) override; |
| 106 | 106 |
| 107 // ExtensionRegistryObserver implementation. | 107 // ExtensionRegistryObserver implementation. |
| 108 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 108 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 109 const Extension* extension) OVERRIDE; | 109 const Extension* extension) override; |
| 110 virtual void OnExtensionUnloaded( | 110 virtual void OnExtensionUnloaded( |
| 111 content::BrowserContext* browser_context, | 111 content::BrowserContext* browser_context, |
| 112 const Extension* extension, | 112 const Extension* extension, |
| 113 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 113 UnloadedExtensionInfo::Reason reason) override; |
| 114 virtual void OnExtensionUninstalled( | 114 virtual void OnExtensionUninstalled( |
| 115 content::BrowserContext* browser_context, | 115 content::BrowserContext* browser_context, |
| 116 const Extension* extension, | 116 const Extension* extension, |
| 117 extensions::UninstallReason reason) OVERRIDE; | 117 extensions::UninstallReason reason) override; |
| 118 | 118 |
| 119 // Iterates over all registries, and calls |notification_callback| on them | 119 // Iterates over all registries, and calls |notification_callback| on them |
| 120 // with |extension_id| as the argument. If a registry lives on a different | 120 // with |extension_id| as the argument. If a registry lives on a different |
| 121 // thread, the call is posted to that thread, so no guarantee of synchronous | 121 // thread, the call is posted to that thread, so no guarantee of synchronous |
| 122 // processing. | 122 // processing. |
| 123 void NotifyRegistriesHelper( | 123 void NotifyRegistriesHelper( |
| 124 void (RulesRegistry::*notification_callback)(const std::string&), | 124 void (RulesRegistry::*notification_callback)(const std::string&), |
| 125 const std::string& extension_id); | 125 const std::string& extension_id); |
| 126 | 126 |
| 127 // BrowserContextKeyedAPI implementation. | 127 // BrowserContextKeyedAPI implementation. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 147 extension_registry_observer_; | 147 extension_registry_observer_; |
| 148 | 148 |
| 149 content::BrowserContext* browser_context_; | 149 content::BrowserContext* browser_context_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); | 151 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace extensions | 154 } // namespace extensions |
| 155 | 155 |
| 156 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 156 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
| OLD | NEW |