| 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_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(EventResponse); | 167 DISALLOW_COPY_AND_ASSIGN(EventResponse); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 static ExtensionWebRequestEventRouter* GetInstance(); | 170 static ExtensionWebRequestEventRouter* GetInstance(); |
| 171 | 171 |
| 172 // Registers a rule registry. Pass null for |rules_registry| to unregister | 172 // Registers a rule registry. Pass null for |rules_registry| to unregister |
| 173 // the rule registry for |browser_context|. | 173 // the rule registry for |browser_context|. |
| 174 void RegisterRulesRegistry( | 174 void RegisterRulesRegistry( |
| 175 void* browser_context, | 175 void* browser_context, |
| 176 const extensions::RulesRegistry::WebViewKey& webview_key, | 176 int rules_registry_id, |
| 177 scoped_refptr<extensions::WebRequestRulesRegistry> rules_registry); | 177 scoped_refptr<extensions::WebRequestRulesRegistry> rules_registry); |
| 178 | 178 |
| 179 // Dispatches the OnBeforeRequest event to any extensions whose filters match | 179 // Dispatches the OnBeforeRequest event to any extensions whose filters match |
| 180 // the given request. Returns net::ERR_IO_PENDING if an extension is | 180 // the given request. Returns net::ERR_IO_PENDING if an extension is |
| 181 // intercepting the request, OK otherwise. | 181 // intercepting the request, OK otherwise. |
| 182 int OnBeforeRequest(void* browser_context, | 182 int OnBeforeRequest(void* browser_context, |
| 183 extensions::InfoMap* extension_info_map, | 183 extensions::InfoMap* extension_info_map, |
| 184 net::URLRequest* request, | 184 net::URLRequest* request, |
| 185 const net::CompletionCallback& callback, | 185 const net::CompletionCallback& callback, |
| 186 GURL* new_url); | 186 GURL* new_url); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // A map of original browser_context -> corresponding incognito | 469 // A map of original browser_context -> corresponding incognito |
| 470 // browser_context (and vice versa). | 470 // browser_context (and vice versa). |
| 471 CrossBrowserContextMap cross_browser_context_map_; | 471 CrossBrowserContextMap cross_browser_context_map_; |
| 472 | 472 |
| 473 // Keeps track of time spent waiting on extensions using the blocking | 473 // Keeps track of time spent waiting on extensions using the blocking |
| 474 // webRequest API. | 474 // webRequest API. |
| 475 scoped_ptr<ExtensionWebRequestTimeTracker> request_time_tracker_; | 475 scoped_ptr<ExtensionWebRequestTimeTracker> request_time_tracker_; |
| 476 | 476 |
| 477 CallbacksForPageLoad callbacks_for_page_load_; | 477 CallbacksForPageLoad callbacks_for_page_load_; |
| 478 | 478 |
| 479 typedef std::pair<void*, extensions::RulesRegistry::WebViewKey> | 479 typedef std::pair<void*, int> RulesRegistryKey; |
| 480 RulesRegistryKey; | |
| 481 // Maps each browser_context (and OTRBrowserContext) and a webview key to its | 480 // Maps each browser_context (and OTRBrowserContext) and a webview key to its |
| 482 // respective rules registry. | 481 // respective rules registry. |
| 483 std::map<RulesRegistryKey, | 482 std::map<RulesRegistryKey, |
| 484 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_; | 483 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_; |
| 485 | 484 |
| 486 scoped_ptr<extensions::WebRequestEventRouterDelegate> | 485 scoped_ptr<extensions::WebRequestEventRouterDelegate> |
| 487 web_request_event_router_delegate_; | 486 web_request_event_router_delegate_; |
| 488 | 487 |
| 489 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); | 488 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); |
| 490 }; | 489 }; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 // ExtensionFunction: | 549 // ExtensionFunction: |
| 551 void GetQuotaLimitHeuristics( | 550 void GetQuotaLimitHeuristics( |
| 552 extensions::QuotaLimitHeuristics* heuristics) const override; | 551 extensions::QuotaLimitHeuristics* heuristics) const override; |
| 553 // Handle quota exceeded gracefully: Only warn the user but still execute the | 552 // Handle quota exceeded gracefully: Only warn the user but still execute the |
| 554 // function. | 553 // function. |
| 555 void OnQuotaExceeded(const std::string& error) override; | 554 void OnQuotaExceeded(const std::string& error) override; |
| 556 bool RunSync() override; | 555 bool RunSync() override; |
| 557 }; | 556 }; |
| 558 | 557 |
| 559 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 558 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| OLD | NEW |