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..2bd4fdb1ed14c50261963658db19184c10660b10 100644 |
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h |
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h |
@@ -50,12 +50,17 @@ class WebRequestCondition { |
// 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; |
battre
2012/12/18 08:20:44
nit: can you add a new line here, please?
vabr (Chromium)
2012/12/18 18:26:42
Done.
|
+ // 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 { |
+ CHECK(url_matcher_conditions_.get()); |
vabr (Chromium)
2012/12/13 12:18:06
This check is needed because now it is possible to
Jeffrey Yasskin
2012/12/18 02:24:32
I believe Chrome convention is to DCHECK in this c
vabr (Chromium)
2012/12/18 18:26:42
TIL, thanks! Done.
|
return url_matcher_conditions_->id(); |
} |
@@ -120,17 +125,35 @@ class WebRequestConditionSet { |
URLMatcherConditionSet::ID url_match, |
const WebRequestRule::RequestData& request_data) const; |
+ // Returns whether any condition in the condition set is fulfilled even when |
+ // no URL match has been triggered. Same as |IsFulfilled|, but only |
+ // considering conditions which don't have UrlFilter attributes. |
+ bool IsFulfilledWithoutURLMatcher( |
+ 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_untriggered_conditions() const { |
Jeffrey Yasskin
2012/12/18 02:24:32
"untriggered" isn't a great word for this. Perhaps
vabr (Chromium)
2012/12/18 18:26:42
Done.
|
+ return has_untriggered_conditions_; |
+ } |
+ private: |
typedef std::map<URLMatcherConditionSet::ID, WebRequestCondition*> |
vabr (Chromium)
2012/12/13 12:18:06
Typedefs should be before variables, so I reshuffl
|
MatchTriggers; |
+ |
+ // Returns whether there is a condition among |conditions| which has no |
+ // URLMatcherConditionSet assigned. |
+ static bool IsSomeConditionWithoutUrlMatcher( |
battre
2012/12/18 08:20:44
nit: ContainsConditionWithoutUrlMatcher?
vabr (Chromium)
2012/12/18 18:26:42
Already changed due to Jeffrey's comment (HasCondi
|
+ const WebRequestConditionSet::Conditions& conditions); |
+ |
MatchTriggers match_triggers_; |
+ const Conditions conditions_; |
+ const bool has_untriggered_conditions_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionSet); |
}; |