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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h

Issue 11414230: Declarative Web Request: firstPartyForCookiesUrl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Easy comments addressed. :) 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_condition.h
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h
index fd8c4c1ac57e523fbe81e82fbdd7bb99588e8d4c..d572f868ebb5c53d4ba09ea72436c5302f3678fb 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h
@@ -60,32 +60,35 @@ class WebRequestCondition {
WebRequestCondition(
scoped_refptr<URLMatcherConditionSet> url_matcher_conditions,
+ scoped_refptr<URLMatcherConditionSet> first_party_url_matcher_conditions,
const WebRequestConditionAttributes& condition_attributes);
~WebRequestCondition();
// Factory method that instantiates a WebRequestCondition according to
- // the description |condition| passed by the extension API.
+ // the description |condition| passed by the extension API. Two factories
+ // should be passed. The first factory should be from the matcher for the URL
+ // of a request, the second factory should be from the matcher for the first
+ // party for cookies URL.
static scoped_ptr<WebRequestCondition> Create(
- URLMatcherConditionFactory* url_matcher_condition_factory,
+ const std::vector<URLMatcherConditionFactory*>&
+ url_matcher_condition_factories,
const base::Value& condition,
std::string* error);
// Returns whether the request matches this condition. |url_matches| lists
- // the IDs that match the request's URL.
- bool IsFulfilled(const std::set<URLMatcherConditionSet::ID> &url_matches,
- const DeclarativeWebRequestData& request_data) const;
-
- // True if this condition has a url filter.
- bool has_url_matcher_condition_set() const {
- return url_matcher_conditions_ != NULL;
- }
-
- // If this Condition has a url filter, appends it to |condition_sets|.
- void GetURLMatcherConditionSets(
- URLMatcherConditionSet::Vector* condition_sets) const {
- if (url_matcher_conditions_)
- condition_sets->push_back(url_matcher_conditions_);
- }
+ // the IDs that match their corresponding URLs.
+ bool IsFulfilled(
+ const std::set<URLMatcherConditionSet::ID>& url_matches,
+ const DeclarativeWebRequestData& request_data) const;
+
+ // If the Condition needs to be filtered by some URLMatcherConditionSets,
+ // append them to this argument. With |index| 0 this returns the condition
Jeffrey Yasskin 2013/01/22 08:21:06 Don't use magic numbers to identify kinds of URLs.
+ // set for the request's URL, and returns 1. With |index| 1 this returns the
+ // set for the "1st party for cookies" URL and returns -1. For all other
+ // values of |index| does nothing and returns -1.
+ int GetURLMatcherConditionSets(
+ URLMatcherConditionSet::Vector* condition_sets,
+ int index) const;
// Returns the condition attributes checked by this condition.
const WebRequestConditionAttributes condition_attributes() const {
@@ -98,9 +101,9 @@ class WebRequestCondition {
int stages() const { return applicable_request_stages_; }
private:
- // Represents the 'url' attribute of this condition. If NULL, then there was
- // no 'url' attribute in this condition.
+ // URL attributes of this condition.
scoped_refptr<URLMatcherConditionSet> url_matcher_conditions_;
+ scoped_refptr<URLMatcherConditionSet> first_party_url_matcher_conditions_;
// All non-UrlFilter attributes of this condition.
WebRequestConditionAttributes condition_attributes_;

Powered by Google App Engine
This is Rietveld 408576698