| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 for (const IdRulePair& id_rule_pair : new_webrequest_rules) { | 211 for (const IdRulePair& id_rule_pair : new_webrequest_rules) { |
| 212 const linked_ptr<const WebRequestRule>& rule = id_rule_pair.second; | 212 const linked_ptr<const WebRequestRule>& rule = id_rule_pair.second; |
| 213 rule->conditions().GetURLMatcherConditionSets(&all_new_condition_sets); | 213 rule->conditions().GetURLMatcherConditionSets(&all_new_condition_sets); |
| 214 if (rule->conditions().HasConditionsWithoutUrls()) | 214 if (rule->conditions().HasConditionsWithoutUrls()) |
| 215 rules_with_untriggered_conditions_.insert(rule.get()); | 215 rules_with_untriggered_conditions_.insert(rule.get()); |
| 216 } | 216 } |
| 217 url_matcher_.AddConditionSets(all_new_condition_sets); | 217 url_matcher_.AddConditionSets(all_new_condition_sets); |
| 218 | 218 |
| 219 ClearCacheOnNavigation(); | 219 ClearCacheOnNavigation(); |
| 220 | 220 |
| 221 if (browser_context_ && !registered_rules.empty()) { | |
| 222 content::BrowserThread::PostTask( | |
| 223 content::BrowserThread::UI, FROM_HERE, | |
| 224 base::Bind(&extension_web_request_api_helpers::NotifyWebRequestAPIUsed, | |
| 225 browser_context_, extension->id())); | |
| 226 } | |
| 227 | |
| 228 return std::string(); | 221 return std::string(); |
| 229 } | 222 } |
| 230 | 223 |
| 231 std::string WebRequestRulesRegistry::RemoveRulesImpl( | 224 std::string WebRequestRulesRegistry::RemoveRulesImpl( |
| 232 const std::string& extension_id, | 225 const std::string& extension_id, |
| 233 const std::vector<std::string>& rule_identifiers) { | 226 const std::vector<std::string>& rule_identifiers) { |
| 234 // URLMatcherConditionSet IDs that can be removed from URLMatcher. | 227 // URLMatcherConditionSet IDs that can be removed from URLMatcher. |
| 235 std::vector<URLMatcherConditionSet::ID> remove_from_url_matcher; | 228 std::vector<URLMatcherConditionSet::ID> remove_from_url_matcher; |
| 236 RulesMap& registered_rules = webrequest_rules_[extension_id]; | 229 RulesMap& registered_rules = webrequest_rules_[extension_id]; |
| 237 | 230 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 for (url_matcher::URLMatcherConditionSet::ID url_match : url_matches) { | 374 for (url_matcher::URLMatcherConditionSet::ID url_match : url_matches) { |
| 382 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(url_match); | 375 RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(url_match); |
| 383 CHECK(rule_trigger != rule_triggers_.end()); | 376 CHECK(rule_trigger != rule_triggers_.end()); |
| 384 if (!base::ContainsKey(*result, rule_trigger->second) && | 377 if (!base::ContainsKey(*result, rule_trigger->second) && |
| 385 rule_trigger->second->conditions().IsFulfilled(url_match, request_data)) | 378 rule_trigger->second->conditions().IsFulfilled(url_match, request_data)) |
| 386 result->insert(rule_trigger->second); | 379 result->insert(rule_trigger->second); |
| 387 } | 380 } |
| 388 } | 381 } |
| 389 | 382 |
| 390 } // namespace extensions | 383 } // namespace extensions |
| OLD | NEW |