| 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 EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGISTRY_
H_ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGISTRY_
H_ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGISTRY_
H_ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGISTRY_
H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 typedef linked_ptr<extension_web_request_api_helpers::EventResponseDelta> | 45 typedef linked_ptr<extension_web_request_api_helpers::EventResponseDelta> |
| 46 LinkedPtrEventResponseDelta; | 46 LinkedPtrEventResponseDelta; |
| 47 typedef DeclarativeRule<WebRequestCondition, WebRequestAction> WebRequestRule; | 47 typedef DeclarativeRule<WebRequestCondition, WebRequestAction> WebRequestRule; |
| 48 | 48 |
| 49 // The WebRequestRulesRegistry is responsible for managing | 49 // The WebRequestRulesRegistry is responsible for managing |
| 50 // the internal representation of rules for the Declarative Web Request API. | 50 // the internal representation of rules for the Declarative Web Request API. |
| 51 // | 51 // |
| 52 // Here is the high level overview of this functionality: | 52 // Here is the high level overview of this functionality: |
| 53 // | 53 // |
| 54 // core_api::events::Rule consists of Conditions and Actions, these are | 54 // api::events::Rule consists of Conditions and Actions, these are |
| 55 // represented as a WebRequestRule with WebRequestConditions and | 55 // represented as a WebRequestRule with WebRequestConditions and |
| 56 // WebRequestRuleActions. | 56 // WebRequestRuleActions. |
| 57 // | 57 // |
| 58 // WebRequestConditions represent JSON dictionaries as the following: | 58 // WebRequestConditions represent JSON dictionaries as the following: |
| 59 // { | 59 // { |
| 60 // 'instanceType': 'URLMatcher', | 60 // 'instanceType': 'URLMatcher', |
| 61 // 'host_suffix': 'example.com', | 61 // 'host_suffix': 'example.com', |
| 62 // 'path_prefix': '/query', | 62 // 'path_prefix': '/query', |
| 63 // 'scheme': 'http' | 63 // 'scheme': 'http' |
| 64 // } | 64 // } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 90 // Returns which modifications should be executed on the network request | 90 // Returns which modifications should be executed on the network request |
| 91 // according to the rules registered in this registry. | 91 // according to the rules registered in this registry. |
| 92 std::list<LinkedPtrEventResponseDelta> CreateDeltas( | 92 std::list<LinkedPtrEventResponseDelta> CreateDeltas( |
| 93 const InfoMap* extension_info_map, | 93 const InfoMap* extension_info_map, |
| 94 const WebRequestData& request_data, | 94 const WebRequestData& request_data, |
| 95 bool crosses_incognito); | 95 bool crosses_incognito); |
| 96 | 96 |
| 97 // Implementation of RulesRegistry: | 97 // Implementation of RulesRegistry: |
| 98 std::string AddRulesImpl( | 98 std::string AddRulesImpl( |
| 99 const std::string& extension_id, | 99 const std::string& extension_id, |
| 100 const std::vector<linked_ptr<core_api::events::Rule>>& rules) override; | 100 const std::vector<linked_ptr<api::events::Rule>>& rules) override; |
| 101 std::string RemoveRulesImpl( | 101 std::string RemoveRulesImpl( |
| 102 const std::string& extension_id, | 102 const std::string& extension_id, |
| 103 const std::vector<std::string>& rule_identifiers) override; | 103 const std::vector<std::string>& rule_identifiers) override; |
| 104 std::string RemoveAllRulesImpl(const std::string& extension_id) override; | 104 std::string RemoveAllRulesImpl(const std::string& extension_id) override; |
| 105 | 105 |
| 106 // Returns true if this object retains no allocated data. Only for debugging. | 106 // Returns true if this object retains no allocated data. Only for debugging. |
| 107 bool IsEmpty() const; | 107 bool IsEmpty() const; |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 ~WebRequestRulesRegistry() override; | 110 ~WebRequestRulesRegistry() override; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 content::BrowserContext* browser_context_; | 188 content::BrowserContext* browser_context_; |
| 189 scoped_refptr<InfoMap> extension_info_map_; | 189 scoped_refptr<InfoMap> extension_info_map_; |
| 190 | 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry); | 191 DISALLOW_COPY_AND_ASSIGN(WebRequestRulesRegistry); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 } // namespace extensions | 194 } // namespace extensions |
| 195 | 195 |
| 196 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGIST
RY_H_ | 196 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_RULES_REGIST
RY_H_ |
| OLD | NEW |