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 #include "extensions/browser/api/declarative/rules_registry.h" | 5 #include "extensions/browser/api/declarative/rules_registry.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 RulesDictionary::iterator entry = rules_.find(lookup_key); | 225 RulesDictionary::iterator entry = rules_.find(lookup_key); |
226 if (entry != rules_.end()) | 226 if (entry != rules_.end()) |
227 out->push_back(entry->second); | 227 out->push_back(entry->second); |
228 entry = manifest_rules_.find(lookup_key); | 228 entry = manifest_rules_.find(lookup_key); |
229 if (entry != manifest_rules_.end()) | 229 if (entry != manifest_rules_.end()) |
230 out->push_back(entry->second); | 230 out->push_back(entry->second); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 void RulesRegistry::GetRules(const std::string& extension_id, | 234 void RulesRegistry::GetRules(const std::string& extension_id, |
235 RulesDictionary& rules, | 235 const RulesDictionary& rules, |
236 std::vector<linked_ptr<api::events::Rule>>* out) { | 236 std::vector<linked_ptr<api::events::Rule>>* out) { |
237 for (const auto& i : rules) { | 237 for (const auto& i : rules) { |
238 const RulesDictionaryKey& key = i.first; | 238 const RulesDictionaryKey& key = i.first; |
239 if (key.first == extension_id) | 239 if (key.first == extension_id) |
240 out->push_back(i.second); | 240 out->push_back(i.second); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 void RulesRegistry::GetAllRules( | 244 void RulesRegistry::GetAllRules( |
245 const std::string& extension_id, | 245 const std::string& extension_id, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 for (i = identifiers.begin(); i != identifiers.end(); ++i) | 428 for (i = identifiers.begin(); i != identifiers.end(); ++i) |
429 used_rule_identifiers_[extension_id].erase(*i); | 429 used_rule_identifiers_[extension_id].erase(*i); |
430 } | 430 } |
431 | 431 |
432 void RulesRegistry::RemoveAllUsedRuleIdentifiers( | 432 void RulesRegistry::RemoveAllUsedRuleIdentifiers( |
433 const std::string& extension_id) { | 433 const std::string& extension_id) { |
434 used_rule_identifiers_.erase(extension_id); | 434 used_rule_identifiers_.erase(extension_id); |
435 } | 435 } |
436 | 436 |
437 } // namespace extensions | 437 } // namespace extensions |
OLD | NEW |