| 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_webrequest/webrequest_rules_registr
y.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_rules_registr
y.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 // Skip rule if a previous rule of this extension instructed to ignore | 124 // Skip rule if a previous rule of this extension instructed to ignore |
| 125 // all rules with a lower priority than min_priorities[extension_id]. | 125 // all rules with a lower priority than min_priorities[extension_id]. |
| 126 int current_min_priority = min_priorities[extension_id]; | 126 int current_min_priority = min_priorities[extension_id]; |
| 127 if (priority_of_rule < current_min_priority) | 127 if (priority_of_rule < current_min_priority) |
| 128 continue; | 128 continue; |
| 129 | 129 |
| 130 if (!rule->tags().empty() && !ignore_tags[extension_id].empty()) { | 130 if (!rule->tags().empty() && !ignore_tags[extension_id].empty()) { |
| 131 bool ignore_rule = false; | 131 bool ignore_rule = false; |
| 132 for (const std::string& tag : rule->tags()) | 132 for (const std::string& tag : rule->tags()) |
| 133 ignore_rule |= ContainsKey(ignore_tags[extension_id], tag); | 133 ignore_rule |= base::ContainsKey(ignore_tags[extension_id], tag); |
| 134 if (ignore_rule) | 134 if (ignore_rule) |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 | 137 |
| 138 std::list<LinkedPtrEventResponseDelta> rule_result; | 138 std::list<LinkedPtrEventResponseDelta> rule_result; |
| 139 WebRequestAction::ApplyInfo apply_info = { | 139 WebRequestAction::ApplyInfo apply_info = { |
| 140 extension_info_map, request_data, crosses_incognito, &rule_result, | 140 extension_info_map, request_data, crosses_incognito, &rule_result, |
| 141 &ignore_tags[extension_id] | 141 &ignore_tags[extension_id] |
| 142 }; | 142 }; |
| 143 rule->Apply(&apply_info); | 143 rule->Apply(&apply_info); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 374 } |
| 375 return true; | 375 return true; |
| 376 } | 376 } |
| 377 void WebRequestRulesRegistry::AddTriggeredRules( | 377 void WebRequestRulesRegistry::AddTriggeredRules( |
| 378 const URLMatches& url_matches, | 378 const URLMatches& url_matches, |
| 379 const WebRequestCondition::MatchData& request_data, | 379 const WebRequestCondition::MatchData& request_data, |
| 380 RuleSet* result) const { | 380 RuleSet* result) const { |
| 381 for (url_matcher::URLMatcherConditionSet::ID url_match : url_matches) { | 381 for (url_matcher::URLMatcherConditionSet::ID url_match : url_matches) { |
| 382 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(url_match); | 382 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(url_match); |
| 383 CHECK(rule_trigger != rule_triggers_.end()); | 383 CHECK(rule_trigger != rule_triggers_.end()); |
| 384 if (!ContainsKey(*result, rule_trigger->second) && | 384 if (!base::ContainsKey(*result, rule_trigger->second) && |
| 385 rule_trigger->second->conditions().IsFulfilled(url_match, request_data)) | 385 rule_trigger->second->conditions().IsFulfilled(url_match, request_data)) |
| 386 result->insert(rule_trigger->second); | 386 result->insert(rule_trigger->second); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace extensions | 390 } // namespace extensions |
| OLD | NEW |