| Index: chrome/browser/extensions/api/declarative/declarative_rule.h
|
| diff --git a/chrome/browser/extensions/api/declarative/declarative_rule.h b/chrome/browser/extensions/api/declarative/declarative_rule.h
|
| index b2dbcd2eac1cc4af6e828195fc842a78b683c63a..6eb8a007db072dbb006c5bf4a0446aa16aaf6641 100644
|
| --- a/chrome/browser/extensions/api/declarative/declarative_rule.h
|
| +++ b/chrome/browser/extensions/api/declarative/declarative_rule.h
|
| @@ -11,9 +11,13 @@
|
| #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_RULE_H__
|
|
|
| #include <limits>
|
| +#include <set>
|
| +#include <string>
|
| +#include <vector>
|
|
|
| #include "base/memory/linked_ptr.h"
|
| #include "base/memory/scoped_vector.h"
|
| +#include "base/stl_util.h"
|
| #include "base/time.h"
|
| #include "chrome/common/extensions/api/events.h"
|
| #include "chrome/common/extensions/matcher/url_matcher.h"
|
| @@ -32,22 +36,19 @@ namespace extensions {
|
| // ConditionT should be immutable after creation. It must define the following
|
| // members:
|
| //
|
| -// // Arguments passed through from ConditionSet::Create.
|
| +// // Arguments passed through from DeclarativeConditionSet::Create.
|
| // static scoped_ptr<ConditionT> Create(
|
| -// URLMatcherConditionFactory*,
|
| +// URLMatcherConditionFactory* url_matcher_condition_factory,
|
| // // Except this argument gets elements of the AnyVector.
|
| // const base::Value& definition,
|
| // std::string* error);
|
| -// // If the Condition needs to be filtered by some
|
| -// // URLMatcherConditionSets, append them to this argument.
|
| +// // If the Condition needs to be filtered by some URLMatcherConditionSets,
|
| +// // append them to |condition_sets|.
|
| // // DeclarativeConditionSet::GetURLMatcherConditionSets forwards here.
|
| // void GetURLMatcherConditionSets(
|
| -// URLMatcherConditionSet::Vector* condition_sets)
|
| -// // True if GetURLMatcherConditionSets would append anything to its
|
| -// // argument.
|
| -// bool has_url_matcher_condition_set();
|
| +// URLMatcherConditionSet::Vector* condition_sets);
|
| // // |url_matches| and |match_data| passed through from
|
| -// // ConditionSet::IsFulfilled.
|
| +// // DeclarativeConditionSet::IsFulfilled.
|
| // bool IsFulfilled(
|
| // const std::set<URLMatcherConditionSet::ID>& url_matches,
|
| // const ConditionT::MatchData&);
|
| @@ -58,9 +59,9 @@ class DeclarativeConditionSet {
|
| typedef std::vector<linked_ptr<const ConditionT> > Conditions;
|
| typedef typename Conditions::const_iterator const_iterator;
|
|
|
| - // Factory method that creates an WebRequestConditionSet according to the JSON
|
| - // array |conditions| passed by the extension API.
|
| - // Sets |error| and returns NULL in case of an error.
|
| + // Factory method that creates a WebRequestConditionSet according to the JSON
|
| + // array |conditions| passed by the extension API. Sets |error| and returns
|
| + // NULL in case of an error.
|
| static scoped_ptr<DeclarativeConditionSet> Create(
|
| URLMatcherConditionFactory* url_matcher_condition_factory,
|
| const AnyVector& conditions,
|
| @@ -73,23 +74,14 @@ class DeclarativeConditionSet {
|
| const_iterator begin() const { return conditions_.begin(); }
|
| const_iterator end() const { return conditions_.end(); }
|
|
|
| - // If |url_match_trigger| is a member of |url_matches|, then this
|
| - // returns whether the corresponding condition is fulfilled
|
| - // wrt. |request_data|. If |url_match_trigger| is -1, this function
|
| - // returns whether any of the conditions without URL attributes is
|
| - // satisfied.
|
| - //
|
| - // Conditions for which has_url_matcher_condition_set() is false are always
|
| - // checked (aside from short-circuiting when an earlier condition already
|
| - // matched.)
|
| - //
|
| - // Conditions for which has_url_matcher_condition_set() is true are only
|
| - // checked if one of the URLMatcherConditionSets returned by
|
| - // GetURLMatcherConditionSets() has an id listed in url_matches. That means
|
| - // that if |match_data| contains URL matches for two pieces of a request,
|
| - // their union should appear in |url_matches|. For kinds of MatchData that
|
| - // only have one type of URL, |url_matches| is forwarded on to
|
| + // If |url_match_trigger| is a member of |url_matches|, then this returns
|
| + // whether the corresponding condition is fulfilled wrt. |match_data|.
|
| + // Therefore, if |match_data| contains URL matches from multiple matchers, the
|
| + // union of the matches should appear in |url_matches|. For kinds of MatchData
|
| + // that only have one type of URL, |url_matches| is forwarded on to
|
| // ConditionT::IsFulfilled(), so it doesn't need to appear in |match_data|.
|
| + // If |url_match_trigger| is -1, this function returns whether any of the
|
| + // conditions without URL attributes is satisfied.
|
| bool IsFulfilled(URLMatcherConditionSet::ID url_match_trigger,
|
| const std::set<URLMatcherConditionSet::ID>& url_matches,
|
| const typename ConditionT::MatchData& match_data) const;
|
|
|