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

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

Issue 63933003: Moved ExtensionInfoMap and ExtensionsQuotaService to extensions/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 7 years, 1 month 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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "chrome/browser/extensions/api/declarative/declarative_rule.h" 19 #include "chrome/browser/extensions/api/declarative/declarative_rule.h"
20 #include "chrome/browser/extensions/api/declarative/rules_registry.h" 20 #include "chrome/browser/extensions/api/declarative/rules_registry.h"
21 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" 21 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h"
22 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_action .h" 22 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_action .h"
23 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h" 23 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h"
24 #include "chrome/browser/extensions/extension_info_map.h" 24 #include "extensions/browser/info_map.h"
25 #include "extensions/common/matcher/url_matcher.h" 25 #include "extensions/common/matcher/url_matcher.h"
26 26
27 class Profile; 27 class Profile;
28 class WebRequestPermissions; 28 class WebRequestPermissions;
29 29
30 namespace extension_web_request_api_helpers { 30 namespace extension_web_request_api_helpers {
31 struct EventResponseDelta; 31 struct EventResponseDelta;
32 } 32 }
33 33
34 namespace net { 34 namespace net {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 RulesCacheDelegate* cache_delegate); 79 RulesCacheDelegate* cache_delegate);
80 80
81 // TODO(battre): This will become an implementation detail, because we need 81 // TODO(battre): This will become an implementation detail, because we need
82 // a way to also execute the actions of the rules. 82 // a way to also execute the actions of the rules.
83 std::set<const WebRequestRule*> GetMatches( 83 std::set<const WebRequestRule*> GetMatches(
84 const WebRequestData& request_data_without_ids) const; 84 const WebRequestData& request_data_without_ids) const;
85 85
86 // Returns which modifications should be executed on the network request 86 // Returns which modifications should be executed on the network request
87 // according to the rules registered in this registry. 87 // according to the rules registered in this registry.
88 std::list<LinkedPtrEventResponseDelta> CreateDeltas( 88 std::list<LinkedPtrEventResponseDelta> CreateDeltas(
89 const ExtensionInfoMap* extension_info_map, 89 const InfoMap* extension_info_map,
90 const WebRequestData& request_data, 90 const WebRequestData& request_data,
91 bool crosses_incognito); 91 bool crosses_incognito);
92 92
93 // Implementation of RulesRegistry: 93 // Implementation of RulesRegistry:
94 virtual std::string AddRulesImpl( 94 virtual std::string AddRulesImpl(
95 const std::string& extension_id, 95 const std::string& extension_id,
96 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; 96 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE;
97 virtual std::string RemoveRulesImpl( 97 virtual std::string RemoveRulesImpl(
98 const std::string& extension_id, 98 const std::string& extension_id,
99 const std::vector<std::string>& rule_identifiers) OVERRIDE; 99 const std::vector<std::string>& rule_identifiers) OVERRIDE;
100 virtual std::string RemoveAllRulesImpl( 100 virtual std::string RemoveAllRulesImpl(
101 const std::string& extension_id) OVERRIDE; 101 const std::string& extension_id) OVERRIDE;
102 102
103 // Returns true if this object retains no allocated data. Only for debugging. 103 // Returns true if this object retains no allocated data. Only for debugging.
104 bool IsEmpty() const; 104 bool IsEmpty() const;
105 105
106 protected: 106 protected:
107 virtual ~WebRequestRulesRegistry(); 107 virtual ~WebRequestRulesRegistry();
108 108
109 // Virtual for testing: 109 // Virtual for testing:
110 virtual base::Time GetExtensionInstallationTime( 110 virtual base::Time GetExtensionInstallationTime(
111 const std::string& extension_id) const; 111 const std::string& extension_id) const;
112 virtual void ClearCacheOnNavigation(); 112 virtual void ClearCacheOnNavigation();
113 113
114 void SetExtensionInfoMapForTesting( 114 void SetExtensionInfoMapForTesting(
115 scoped_refptr<ExtensionInfoMap> extension_info_map) { 115 scoped_refptr<InfoMap> extension_info_map) {
116 extension_info_map_ = extension_info_map; 116 extension_info_map_ = extension_info_map;
117 } 117 }
118 118
119 const std::set<const WebRequestRule*>& 119 const std::set<const WebRequestRule*>&
120 rules_with_untriggered_conditions_for_test() const { 120 rules_with_untriggered_conditions_for_test() const {
121 return rules_with_untriggered_conditions_; 121 return rules_with_untriggered_conditions_;
122 } 122 }
123 123
124 private: 124 private:
125 FRIEND_TEST_ALL_PREFIXES(WebRequestRulesRegistrySimpleTest, StageChecker); 125 FRIEND_TEST_ALL_PREFIXES(WebRequestRulesRegistrySimpleTest, StageChecker);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // These rules contain condition sets with conditions without URL attributes. 175 // These rules contain condition sets with conditions without URL attributes.
176 // Such conditions are not triggered by URL matcher, so we need to test them 176 // Such conditions are not triggered by URL matcher, so we need to test them
177 // separately. 177 // separately.
178 std::set<const WebRequestRule*> rules_with_untriggered_conditions_; 178 std::set<const WebRequestRule*> rules_with_untriggered_conditions_;
179 179
180 std::map<WebRequestRule::ExtensionId, RulesMap> webrequest_rules_; 180 std::map<WebRequestRule::ExtensionId, RulesMap> webrequest_rules_;
181 181
182 URLMatcher url_matcher_; 182 URLMatcher url_matcher_;
183 183
184 void* profile_id_; 184 void* profile_id_;
185 scoped_refptr<ExtensionInfoMap> extension_info_map_; 185 scoped_refptr<InfoMap> extension_info_map_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry); 187 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry);
188 }; 188 };
189 189
190 } // namespace extensions 190 } // namespace extensions
191 191
192 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_ 192 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES _REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698