| Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h
|
| diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h
|
| index 91d0cdf8fe066282b878f66c8beec5f174b2be0e..99dbd3dfd6a43ca06b700e6f7e794132ed3e6caf 100644
|
| --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h
|
| +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h
|
| @@ -11,6 +11,7 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +#include "base/gtest_prod_util.h"
|
| #include "base/time.h"
|
| #include "base/memory/linked_ptr.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -107,19 +108,20 @@ class WebRequestRulesRegistry : public RulesRegistryWithCache {
|
| const std::string& extension_id) const;
|
| virtual void ClearCacheOnNavigation();
|
|
|
| + void SetExtensionInfoMapForTesting(
|
| + scoped_refptr<ExtensionInfoMap> extension_info_map) {
|
| + extension_info_map_ = extension_info_map;
|
| + }
|
| +
|
| const std::set<const WebRequestRule*>&
|
| rules_with_untriggered_conditions_for_test() const {
|
| return rules_with_untriggered_conditions_;
|
| }
|
|
|
| private:
|
| - // Checks whether the set of |conditions| and |actions| are consistent,
|
| - // meaning for example that we do not allow combining an |action| that needs
|
| - // to be executed before the |condition| can be fulfilled.
|
| - // Returns true in case of consistency and MUST set |error| otherwise.
|
| - static bool CheckConsistency(const WebRequestConditionSet* conditions,
|
| - const WebRequestActionSet* actions,
|
| - std::string* error);
|
| + FRIEND_TEST_ALL_PREFIXES(WebRequestRulesRegistrySimpleTest, StageChecker);
|
| + FRIEND_TEST_ALL_PREFIXES(WebRequestRulesRegistrySimpleTest,
|
| + HostPermissionsChecker);
|
|
|
| typedef std::map<URLMatcherConditionSet::ID, WebRequestRule*> RuleTriggers;
|
| typedef std::map<WebRequestRule::GlobalRuleId, linked_ptr<WebRequestRule> >
|
| @@ -127,6 +129,25 @@ class WebRequestRulesRegistry : public RulesRegistryWithCache {
|
| typedef std::set<URLMatcherConditionSet::ID> URLMatches;
|
| typedef std::set<const WebRequestRule*> RuleSet;
|
|
|
| + // This bundles all consistency checkers. Returns true in case of consistency
|
| + // and MUST set |error| otherwise.
|
| + static bool Checker(const Extension* extension,
|
| + const WebRequestConditionSet* conditions,
|
| + const WebRequestActionSet* actions,
|
| + std::string* error);
|
| +
|
| + // Check that the |extension| has host permissions for all URLs if actions
|
| + // requiring them are present.
|
| + static bool HostPermissionsChecker(const Extension* extension,
|
| + const WebRequestActionSet* actions,
|
| + std::string* error);
|
| +
|
| + // Check that every action is applicable in the same request stage as at
|
| + // least one condition.
|
| + static bool StageChecker(const WebRequestConditionSet* conditions,
|
| + const WebRequestActionSet* actions,
|
| + std::string* error);
|
| +
|
| // This is a helper function to GetMatches. Rules triggered by |url_matches|
|
| // get added to |result| if one of their conditions is fulfilled.
|
| // |request_data| gets passed to IsFulfilled of the rules' condition sets.
|
|
|