| 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 "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_
registry.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_
registry.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // 2nd phase -- add all rules with some conditions triggered by URL matches. | 67 // 2nd phase -- add all rules with some conditions triggered by URL matches. |
| 68 AddTriggeredRules(request_data.url_match_ids, request_data, &result); | 68 AddTriggeredRules(request_data.url_match_ids, request_data, &result); |
| 69 AddTriggeredRules(request_data.first_party_url_match_ids, | 69 AddTriggeredRules(request_data.first_party_url_match_ids, |
| 70 request_data, &result); | 70 request_data, &result); |
| 71 | 71 |
| 72 return result; | 72 return result; |
| 73 } | 73 } |
| 74 | 74 |
| 75 std::list<LinkedPtrEventResponseDelta> WebRequestRulesRegistry::CreateDeltas( | 75 std::list<LinkedPtrEventResponseDelta> WebRequestRulesRegistry::CreateDeltas( |
| 76 const ExtensionInfoMap* extension_info_map, | 76 const InfoMap* extension_info_map, |
| 77 const WebRequestData& request_data, | 77 const WebRequestData& request_data, |
| 78 bool crosses_incognito) { | 78 bool crosses_incognito) { |
| 79 if (webrequest_rules_.empty()) | 79 if (webrequest_rules_.empty()) |
| 80 return std::list<LinkedPtrEventResponseDelta>(); | 80 return std::list<LinkedPtrEventResponseDelta>(); |
| 81 | 81 |
| 82 std::set<const WebRequestRule*> matches = GetMatches(request_data); | 82 std::set<const WebRequestRule*> matches = GetMatches(request_data); |
| 83 | 83 |
| 84 // Sort all matching rules by their priority so that they can be processed | 84 // Sort all matching rules by their priority so that they can be processed |
| 85 // in decreasing order. | 85 // in decreasing order. |
| 86 typedef std::pair<WebRequestRule::Priority, WebRequestRule::GlobalRuleId> | 86 typedef std::pair<WebRequestRule::Priority, WebRequestRule::GlobalRuleId> |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); | 399 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match); |
| 400 CHECK(rule_trigger != rule_triggers_.end()); | 400 CHECK(rule_trigger != rule_triggers_.end()); |
| 401 if (!ContainsKey(*result, rule_trigger->second) && | 401 if (!ContainsKey(*result, rule_trigger->second) && |
| 402 rule_trigger->second->conditions().IsFulfilled(*url_match, | 402 rule_trigger->second->conditions().IsFulfilled(*url_match, |
| 403 request_data)) | 403 request_data)) |
| 404 result->insert(rule_trigger->second); | 404 result->insert(rule_trigger->second); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace extensions | 408 } // namespace extensions |
| OLD | NEW |