Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5163)

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc

Issue 11414230: Declarative Web Request: firstPartyForCookiesUrl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Back to one matcher Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
index 0e90c2d22ddd6a2d92a6302d2a31009b4f48be5d..b30d43d917164a14654612aeaa048085a68ea6e6 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
@@ -30,31 +30,37 @@ WebRequestRulesRegistry::WebRequestRulesRegistry(Profile* profile,
extension_info_map_ = ExtensionSystem::Get(profile)->info_map();
}
-std::set<const WebRequestRule*>
-WebRequestRulesRegistry::GetMatches(
- const DeclarativeWebRequestData& request_data) {
+std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches(
+ DeclarativeWebRequestData* request_data) {
typedef std::set<const WebRequestRule*> RuleSet;
typedef std::set<URLMatcherConditionSet::ID> URLMatches;
RuleSet result;
- URLMatches url_matches = url_matcher_.MatchURL(request_data.request->url());
+
+ request_data->url_match_ids =
+ url_matcher_.MatchURL(request_data->request->url());
+ request_data->first_party_url_match_ids =
+ url_matcher_.MatchURL(request_data->request->first_party_for_cookies());
+ URLMatches all_url_matches = request_data->url_match_ids;
vabr (Chromium) 2013/01/22 14:54:30 This would go away if we got rid of the now-unused
+ all_url_matches.insert(request_data->first_party_url_match_ids.begin(),
+ request_data->first_party_url_match_ids.end());
// 1st phase -- add all rules with some conditions without UrlFilter
// attributes.
for (RuleSet::const_iterator it = rules_with_untriggered_conditions_.begin();
it != rules_with_untriggered_conditions_.end(); ++it) {
- if ((*it)->conditions().IsFulfilled(-1, url_matches, request_data))
+ if ((*it)->conditions().IsFulfilled(-1, all_url_matches, *request_data))
result.insert(*it);
}
// 2nd phase -- add all rules with some conditions triggered by URL matches.
- for (URLMatches::const_iterator url_match = url_matches.begin();
- url_match != url_matches.end(); ++url_match) {
+ for (URLMatches::const_iterator url_match = all_url_matches.begin();
+ url_match != all_url_matches.end(); ++url_match) {
RuleTriggers::const_iterator rule_trigger = rule_triggers_.find(*url_match);
CHECK(rule_trigger != rule_triggers_.end());
if (!ContainsKey(result, rule_trigger->second) &&
- rule_trigger->second->conditions().IsFulfilled(*url_match, url_matches,
- request_data))
+ rule_trigger->second->conditions().IsFulfilled(
+ *url_match, all_url_matches, *request_data))
result.insert(rule_trigger->second);
}
@@ -63,7 +69,7 @@ WebRequestRulesRegistry::GetMatches(
std::list<LinkedPtrEventResponseDelta> WebRequestRulesRegistry::CreateDeltas(
const ExtensionInfoMap* extension_info_map,
- const DeclarativeWebRequestData& request_data,
+ DeclarativeWebRequestData* request_data,
bool crosses_incognito) {
if (webrequest_rules_.empty())
return std::list<LinkedPtrEventResponseDelta>();
@@ -116,7 +122,7 @@ std::list<LinkedPtrEventResponseDelta> WebRequestRulesRegistry::CreateDeltas(
std::list<LinkedPtrEventResponseDelta> rule_result;
WebRequestAction::ApplyInfo apply_info = {
- extension_info_map, request_data, crosses_incognito, &rule_result
+ extension_info_map, *request_data, crosses_incognito, &rule_result
};
rule->Apply(&apply_info);
result.splice(result.begin(), rule_result);

Powered by Google App Engine
This is Rietveld 408576698