| 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 922dba7f111ffdc12352c2e06703c3fa828e3197..46c9e437d40df546833f84be0bbb396c409da532 100644
|
| --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h
|
| +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_H_
|
| #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_H_
|
|
|
| +#include <set>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -47,15 +48,17 @@ class WebRequestCondition {
|
| const base::Value& condition,
|
| std::string* error);
|
|
|
| - // Returns whether the request is a match, given that the URLMatcher found
|
| - // a match for |url_matcher_conditions_|.
|
| - bool IsFulfilled(const WebRequestRule::RequestData& request_data) const;
|
| + // 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 WebRequestRule::RequestData& request_data) const;
|
|
|
| // Returns a URLMatcherConditionSet::ID which is the canonical representation
|
| // for all URL patterns that need to be matched by this WebRequestCondition.
|
| // This ID is registered in a URLMatcher that can inform us in case of a
|
| // match.
|
| URLMatcherConditionSet::ID url_matcher_condition_set_id() const {
|
| + DCHECK(url_matcher_conditions_.get());
|
| return url_matcher_conditions_->id();
|
| }
|
|
|
| @@ -78,7 +81,11 @@ 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.
|
| scoped_refptr<URLMatcherConditionSet> url_matcher_conditions_;
|
| +
|
| + // All non-UrlFilter attributes of this condition.
|
| WebRequestConditionAttributes condition_attributes_;
|
|
|
| // Bit vector indicating all RequestStage during which all
|
| @@ -111,25 +118,25 @@ class WebRequestConditionSet {
|
| return conditions_;
|
| }
|
|
|
| - // Returns whether any condition in the condition set is fulfilled
|
| - // based on a match |url_match| and the value of |request_data.request|.
|
| - // This function should be called for each URLMatcherConditionSet::ID
|
| - // that was found by the URLMatcher to ensure that the each trigger in
|
| - // |match_triggers_| is found.
|
| + // Returns whether any condition in the condition set is fulfilled. Filters
|
| + // out conditions which have UrlFilter attributes but are not listed in
|
| + // |url_matches|, and tests the rest against |request_data.request|.
|
| bool IsFulfilled(
|
| - URLMatcherConditionSet::ID url_match,
|
| + const std::set<URLMatcherConditionSet::ID>& url_matches,
|
| const WebRequestRule::RequestData& request_data) const;
|
|
|
| // Appends the URLMatcherConditionSet from all conditions to |condition_sets|.
|
| void GetURLMatcherConditionSets(
|
| URLMatcherConditionSet::Vector* condition_sets) const;
|
|
|
| - private:
|
| - Conditions conditions_;
|
| + // Returns whether there are some conditions without UrlFilter attributes.
|
| + bool has_conditions_without_urls() const {
|
| + return has_conditions_without_urls_;
|
| + }
|
|
|
| - typedef std::map<URLMatcherConditionSet::ID, WebRequestCondition*>
|
| - MatchTriggers;
|
| - MatchTriggers match_triggers_;
|
| + private:
|
| + const Conditions conditions_;
|
| + const bool has_conditions_without_urls_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebRequestConditionSet);
|
| };
|
|
|