Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h

Issue 11414230: Declarative Web Request: firstPartyForCookiesUrl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync with trunk Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_RE GISTRY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_RE GISTRY_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_RE GISTRY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_RE GISTRY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // "http://www.example.com/query/" has any matches, and the URLMatcher 68 // "http://www.example.com/query/" has any matches, and the URLMatcher
69 // will respond with the URLMatcherConditionSet::ID. We can map this 69 // will respond with the URLMatcherConditionSet::ID. We can map this
70 // to the WebRequestRule and check whether also the other conditions (in this 70 // to the WebRequestRule and check whether also the other conditions (in this
71 // example 'scheme': 'http') are fulfilled. 71 // example 'scheme': 'http') are fulfilled.
72 class WebRequestRulesRegistry : public RulesRegistryWithCache { 72 class WebRequestRulesRegistry : public RulesRegistryWithCache {
73 public: 73 public:
74 WebRequestRulesRegistry(Profile* profile, Delegate* delegate); 74 WebRequestRulesRegistry(Profile* profile, Delegate* delegate);
75 75
76 // TODO(battre): This will become an implementation detail, because we need 76 // TODO(battre): This will become an implementation detail, because we need
77 // a way to also execute the actions of the rules. 77 // a way to also execute the actions of the rules.
78 std::set<const WebRequestRule*> GetMatches( 78 std::set<const WebRequestRule*> GetMatches(
Jeffrey Yasskin 2013/01/24 00:39:17 Dominic told me to make ContentRulesRegistery::Get
vabr (Chromium) 2013/01/24 18:24:08 Yay, hooray to const URLMatcher::MatchURL()! :) Do
79 const DeclarativeWebRequestData& request_data); 79 DeclarativeWebRequestData* request_data);
80 80
81 // Returns which modifications should be executed on the network request 81 // Returns which modifications should be executed on the network request
82 // according to the rules registered in this registry. 82 // according to the rules registered in this registry.
83 std::list<LinkedPtrEventResponseDelta> CreateDeltas( 83 std::list<LinkedPtrEventResponseDelta> CreateDeltas(
84 const ExtensionInfoMap* extension_info_map, 84 const ExtensionInfoMap* extension_info_map,
85 const DeclarativeWebRequestData& request_data, 85 DeclarativeWebRequestData* request_data,
86 bool crosses_incognito); 86 bool crosses_incognito);
87 87
88 // Implementation of RulesRegistryWithCache: 88 // Implementation of RulesRegistryWithCache:
89 virtual std::string AddRulesImpl( 89 virtual std::string AddRulesImpl(
90 const std::string& extension_id, 90 const std::string& extension_id,
91 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; 91 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE;
92 virtual std::string RemoveRulesImpl( 92 virtual std::string RemoveRulesImpl(
93 const std::string& extension_id, 93 const std::string& extension_id,
94 const std::vector<std::string>& rule_identifiers) OVERRIDE; 94 const std::vector<std::string>& rule_identifiers) OVERRIDE;
95 virtual std::string RemoveAllRulesImpl( 95 virtual std::string RemoveAllRulesImpl(
(...skipping 21 matching lines...) Expand all
117 // meaning for example that we do not allow combining an |action| that needs 117 // meaning for example that we do not allow combining an |action| that needs
118 // to be executed before the |condition| can be fulfilled. 118 // to be executed before the |condition| can be fulfilled.
119 // Returns true in case of consistency and MUST set |error| otherwise. 119 // Returns true in case of consistency and MUST set |error| otherwise.
120 static bool CheckConsistency(const WebRequestConditionSet* conditions, 120 static bool CheckConsistency(const WebRequestConditionSet* conditions,
121 const WebRequestActionSet* actions, 121 const WebRequestActionSet* actions,
122 std::string* error); 122 std::string* error);
123 123
124 typedef std::map<URLMatcherConditionSet::ID, WebRequestRule*> RuleTriggers; 124 typedef std::map<URLMatcherConditionSet::ID, WebRequestRule*> RuleTriggers;
125 typedef std::map<WebRequestRule::GlobalRuleId, linked_ptr<WebRequestRule> > 125 typedef std::map<WebRequestRule::GlobalRuleId, linked_ptr<WebRequestRule> >
126 RulesMap; 126 RulesMap;
127 typedef std::set<URLMatcherConditionSet::ID> URLMatches;
128 typedef std::set<const WebRequestRule*> RuleSet;
129
130 // This is a helper function to GetMatches. Rules triggered by |url_matches|
131 // get added to |result| if one of their conditions fires. |request_data| get
Jeffrey Yasskin 2013/01/24 00:39:17 s/fires/is fulfilled/?
vabr (Chromium) 2013/01/24 18:24:08 Done.
132 // just passed to IsFulfilled of the rules' condition sets.
133 void AddTriggeredRules(const URLMatches& url_matches,
134 const DeclarativeWebRequestData& request_data,
135 RuleSet* result);
127 136
128 // Map that tells us which WebRequestRule may match under the condition that 137 // Map that tells us which WebRequestRule may match under the condition that
129 // the URLMatcherConditionSet::ID was returned by the |url_matcher_|. 138 // the URLMatcherConditionSet::ID was returned by the |url_matcher_|.
130 RuleTriggers rule_triggers_; 139 RuleTriggers rule_triggers_;
131 140
132 // These rules contain condition sets with conditions without URL attributes. 141 // These rules contain condition sets with conditions without URL attributes.
133 // Such conditions are not triggered by URL matcher, so we need to test them 142 // Such conditions are not triggered by URL matcher, so we need to test them
134 // separately. 143 // separately.
135 std::set<const WebRequestRule*> rules_with_untriggered_conditions_; 144 std::set<const WebRequestRule*> rules_with_untriggered_conditions_;
136 145
137 RulesMap webrequest_rules_; 146 RulesMap webrequest_rules_;
138 147
139 URLMatcher url_matcher_; 148 URLMatcher url_matcher_;
140 149
141 scoped_refptr<ExtensionInfoMap> extension_info_map_; 150 scoped_refptr<ExtensionInfoMap> extension_info_map_;
142 }; 151 };
143 152
144 } // namespace extensions 153 } // namespace extensions
145 154
146 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_ 155 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698