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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ~RulesRegistryService() override; | 54 ~RulesRegistryService() override; |
55 | 55 |
56 // Unregisters refptrs to concrete RulesRegistries at other objects that were | 56 // Unregisters refptrs to concrete RulesRegistries at other objects that were |
57 // created by us so that the RulesRegistries can be released. | 57 // created by us so that the RulesRegistries can be released. |
58 void Shutdown() override; | 58 void Shutdown() override; |
59 | 59 |
60 // BrowserContextKeyedAPI implementation. | 60 // BrowserContextKeyedAPI implementation. |
61 static BrowserContextKeyedAPIFactory<RulesRegistryService>* | 61 static BrowserContextKeyedAPIFactory<RulesRegistryService>* |
62 GetFactoryInstance(); | 62 GetFactoryInstance(); |
63 | 63 |
64 // Convenience method to get the RulesRegistryService for a context. | 64 // Convenience method to get the RulesRegistryService for a context. If a |
| 65 // RulesRegistryService does not already exist for |context|, one will be |
| 66 // created and returned. |
65 static RulesRegistryService* Get(content::BrowserContext* context); | 67 static RulesRegistryService* Get(content::BrowserContext* context); |
66 | 68 |
| 69 // The same as Get(), except that if a RulesRegistryService does not already |
| 70 // exist for |context|, nullptr is returned. |
| 71 static RulesRegistryService* GetIfExists(content::BrowserContext* context); |
| 72 |
67 int GetNextRulesRegistryID(); | 73 int GetNextRulesRegistryID(); |
68 | 74 |
69 // Registers the default RulesRegistries used in Chromium. | 75 // Registers the default RulesRegistries used in Chromium. |
70 void EnsureDefaultRulesRegistriesRegistered(int rules_registry_id); | 76 void EnsureDefaultRulesRegistriesRegistered(int rules_registry_id); |
71 | 77 |
72 // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry. | 78 // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry. |
73 void RegisterRulesRegistry(scoped_refptr<RulesRegistry> rule_registry); | 79 void RegisterRulesRegistry(scoped_refptr<RulesRegistry> rule_registry); |
74 | 80 |
75 // Returns the RulesRegistry for |event_name| and |rules_registry_id| or | 81 // Returns the RulesRegistry for |event_name| and |rules_registry_id| or |
76 // NULL if no such registry has been registered. Default rules registries | 82 // NULL if no such registry has been registered. Default rules registries |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 extension_registry_observer_; | 145 extension_registry_observer_; |
140 | 146 |
141 content::BrowserContext* browser_context_; | 147 content::BrowserContext* browser_context_; |
142 | 148 |
143 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); | 149 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); |
144 }; | 150 }; |
145 | 151 |
146 } // namespace extensions | 152 } // namespace extensions |
147 | 153 |
148 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 154 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
OLD | NEW |