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 CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
7 | 7 |
8 #include "chrome/browser/extensions/api/declarative/rules_registry.h" | 8 #include "chrome/browser/extensions/api/declarative/rules_registry.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // | 113 // |
114 // The returned rules are stored in |out|. Ownership is passed to the caller. | 114 // The returned rules are stored in |out|. Ownership is passed to the caller. |
115 void GetRules(const std::string& extension_id, | 115 void GetRules(const std::string& extension_id, |
116 const std::vector<std::string>& rule_identifiers, | 116 const std::vector<std::string>& rule_identifiers, |
117 std::vector<linked_ptr<RulesRegistry::Rule> >* out); | 117 std::vector<linked_ptr<RulesRegistry::Rule> >* out); |
118 | 118 |
119 // Same as GetRules but returns all rules owned by |extension_id|. | 119 // Same as GetRules but returns all rules owned by |extension_id|. |
120 void GetAllRules(const std::string& extension_id, | 120 void GetAllRules(const std::string& extension_id, |
121 std::vector<linked_ptr<RulesRegistry::Rule> >* out); | 121 std::vector<linked_ptr<RulesRegistry::Rule> >* out); |
122 | 122 |
123 // Called to notify the RulesRegistry that an extension has been unloaded | 123 // Called to notify the RulesRegistry that the extension availability has |
124 // and all rules of this extension need to be removed. | 124 // changed, so that the registry can update which rules are active. |
125 void OnExtensionUnloaded(const std::string& extension_id); | 125 void OnExtensionUnloaded(const std::string& extension_id); |
| 126 void OnExtensionUninstalled(const std::string& extension_id); |
| 127 void OnExtensionLoaded(const std::string& extension_id); |
126 | 128 |
127 // Returns the number of entries in used_rule_identifiers_ for leak detection. | 129 // Returns the number of entries in used_rule_identifiers_ for leak detection. |
128 // Every ExtensionId counts as one entry, even if it contains no rules. | 130 // Every ExtensionId counts as one entry, even if it contains no rules. |
129 size_t GetNumberOfUsedRuleIdentifiersForTesting() const; | 131 size_t GetNumberOfUsedRuleIdentifiersForTesting() const; |
130 | 132 |
131 // Returns the RulesCacheDelegate. This is used for testing. | 133 // Returns the RulesCacheDelegate. This is used for testing. |
132 RulesCacheDelegate* rules_cache_delegate_for_testing() const { | 134 RulesCacheDelegate* rules_cache_delegate_for_testing() const { |
133 return cache_delegate_.get(); | 135 return cache_delegate_.get(); |
134 } | 136 } |
135 | 137 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; | 279 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; |
278 RuleIdentifiersMap used_rule_identifiers_; | 280 RuleIdentifiersMap used_rule_identifiers_; |
279 int last_generated_rule_identifier_id_; | 281 int last_generated_rule_identifier_id_; |
280 | 282 |
281 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); | 283 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); |
282 }; | 284 }; |
283 | 285 |
284 } // namespace extensions | 286 } // namespace extensions |
285 | 287 |
286 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 288 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
OLD | NEW |