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

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

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with error messages Created 7 years, 8 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 virtual base::Time GetExtensionInstallationTime( 106 virtual base::Time GetExtensionInstallationTime(
107 const std::string& extension_id) const; 107 const std::string& extension_id) const;
108 virtual void ClearCacheOnNavigation(); 108 virtual void ClearCacheOnNavigation();
109 109
110 const std::set<const WebRequestRule*>& 110 const std::set<const WebRequestRule*>&
111 rules_with_untriggered_conditions_for_test() const { 111 rules_with_untriggered_conditions_for_test() const {
112 return rules_with_untriggered_conditions_; 112 return rules_with_untriggered_conditions_;
113 } 113 }
114 114
115 private: 115 private:
116 // Checks whether the set of |conditions| and |actions| are consistent,
117 // meaning for example that we do not allow combining an |action| that needs
118 // to be executed before the |condition| can be fulfilled.
119 // Returns true in case of consistency and MUST set |error| otherwise.
120 static bool CheckConsistency(const WebRequestConditionSet* conditions,
121 const WebRequestActionSet* actions,
122 std::string* error);
123
124 typedef std::map<URLMatcherConditionSet::ID, WebRequestRule*> RuleTriggers; 116 typedef std::map<URLMatcherConditionSet::ID, WebRequestRule*> RuleTriggers;
125 typedef std::map<WebRequestRule::GlobalRuleId, linked_ptr<WebRequestRule> > 117 typedef std::map<WebRequestRule::GlobalRuleId, linked_ptr<WebRequestRule> >
126 RulesMap; 118 RulesMap;
127 typedef std::set<URLMatcherConditionSet::ID> URLMatches; 119 typedef std::set<URLMatcherConditionSet::ID> URLMatches;
128 typedef std::set<const WebRequestRule*> RuleSet; 120 typedef std::set<const WebRequestRule*> RuleSet;
129 121
130 // This is a helper function to GetMatches. Rules triggered by |url_matches| 122 // This is a helper function to GetMatches. Rules triggered by |url_matches|
131 // get added to |result| if one of their conditions is fulfilled. 123 // get added to |result| if one of their conditions is fulfilled.
132 // |request_data| gets passed to IsFulfilled of the rules' condition sets. 124 // |request_data| gets passed to IsFulfilled of the rules' condition sets.
133 void AddTriggeredRules(const URLMatches& url_matches, 125 void AddTriggeredRules(const URLMatches& url_matches,
(...skipping 15 matching lines...) Expand all
149 141
150 void* profile_id_; 142 void* profile_id_;
151 scoped_refptr<ExtensionInfoMap> extension_info_map_; 143 scoped_refptr<ExtensionInfoMap> extension_info_map_;
152 144
153 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry); 145 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry);
154 }; 146 };
155 147
156 } // namespace extensions 148 } // namespace extensions
157 149
158 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_ 150 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698