| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 struct EventResponseDelta; | 26 struct EventResponseDelta; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 class URLRequest; | 30 class URLRequest; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace extensions { | 33 namespace extensions { |
| 34 | 34 |
| 35 class RulesRegistryService; | 35 class RulesRegistryService; |
| 36 class WebRequestRule; | |
| 37 | 36 |
| 38 // The WebRequestRulesRegistry is responsible for managing | 37 // The WebRequestRulesRegistry is responsible for managing |
| 39 // the internal representation of rules for the Declarative Web Request API. | 38 // the internal representation of rules for the Declarative Web Request API. |
| 40 // | 39 // |
| 41 // Here is the high level overview of this functionality: | 40 // Here is the high level overview of this functionality: |
| 42 // | 41 // |
| 43 // RulesRegistry::Rule consists of Conditions and Actions, these are | 42 // RulesRegistry::Rule consists of Conditions and Actions, these are |
| 44 // represented as a WebRequestRule with WebRequestConditions and | 43 // represented as a WebRequestRule with WebRequestConditions and |
| 45 // WebRequestRuleActions. | 44 // WebRequestRuleActions. |
| 46 // | 45 // |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 // TODO(battre): This will become an implementation detail, because we need | 69 // TODO(battre): This will become an implementation detail, because we need |
| 71 // a way to also execute the actions of the rules. | 70 // a way to also execute the actions of the rules. |
| 72 std::set<WebRequestRule::GlobalRuleId> GetMatches( | 71 std::set<WebRequestRule::GlobalRuleId> GetMatches( |
| 73 net::URLRequest* request, | 72 net::URLRequest* request, |
| 74 RequestStages request_stage); | 73 RequestStages request_stage); |
| 75 | 74 |
| 76 // Returns which modifications should be executed on the network request | 75 // Returns which modifications should be executed on the network request |
| 77 // according to the rules registered in this registry. | 76 // according to the rules registered in this registry. |
| 78 std::list<LinkedPtrEventResponseDelta> CreateDeltas( | 77 std::list<LinkedPtrEventResponseDelta> CreateDeltas( |
| 79 net::URLRequest* request, RequestStages request_stage); | 78 net::URLRequest* request, |
| 79 RequestStages request_stage, |
| 80 const WebRequestRule::OptionalRequestData& optional_request_data); |
| 80 | 81 |
| 81 // Implementation of RulesRegistryWithCache: | 82 // Implementation of RulesRegistryWithCache: |
| 82 virtual std::string AddRulesImpl( | 83 virtual std::string AddRulesImpl( |
| 83 const std::string& extension_id, | 84 const std::string& extension_id, |
| 84 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; | 85 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; |
| 85 virtual std::string RemoveRulesImpl( | 86 virtual std::string RemoveRulesImpl( |
| 86 const std::string& extension_id, | 87 const std::string& extension_id, |
| 87 const std::vector<std::string>& rule_identifiers) OVERRIDE; | 88 const std::vector<std::string>& rule_identifiers) OVERRIDE; |
| 88 virtual std::string RemoveAllRulesImpl( | 89 virtual std::string RemoveAllRulesImpl( |
| 89 const std::string& extension_id) OVERRIDE; | 90 const std::string& extension_id) OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 109 RulesMap webrequest_rules_; | 110 RulesMap webrequest_rules_; |
| 110 | 111 |
| 111 URLMatcher url_matcher_; | 112 URLMatcher url_matcher_; |
| 112 | 113 |
| 113 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 114 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 } // namespace extensions | 117 } // namespace extensions |
| 117 | 118 |
| 118 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES
_REGISTRY_H_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES
_REGISTRY_H_ |
| OLD | NEW |