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..1865385c5697489f59e2309105346e95cb5741a7 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> |
@@ -51,11 +52,17 @@ class WebRequestCondition { |
// a match for |url_matcher_conditions_|. |
bool IsFulfilled(const WebRequestRule::RequestData& request_data) const; |
+ // Returns true iff the request is a match and no condition attribute of this |
+ // condition is a UrlFilter. |
+ bool IsFulfilledIndependentlyOfURL( |
+ 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 +85,11 @@ class WebRequestCondition { |
int stages() const { return applicable_request_stages_; } |
private: |
+ // The 'url' attribute of this condition. If NULL then there was no 'url' |
Jeffrey Yasskin
2012/12/18 21:56:02
I'd say "Represents the 'url' attribute ..."
vabr (Chromium)
2012/12/19 08:38:19
Done.
|
+ // 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 +122,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; |
vabr (Chromium)
2012/12/18 18:26:42
With refactoring the IsFulfilled() method, trigger
|
- MatchTriggers match_triggers_; |
+ private: |
+ const Conditions conditions_; |
+ const bool has_conditions_without_urls_; |
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionSet); |
}; |