Index: chrome/browser/extensions/extension_webrequest_api.h |
diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h |
index 5d64fdc35c0919f55b972c700ab81dc7ff32fcc7..92c4ce1ae70d48b99a8571c766067bca42566fdb 100644 |
--- a/chrome/browser/extensions/extension_webrequest_api.h |
+++ b/chrome/browser/extensions/extension_webrequest_api.h |
@@ -22,6 +22,7 @@ class ExtensionEventRouterForwarder; |
class GURL; |
namespace net { |
+class HttpRequestHeaders; |
class URLRequest; |
} |
@@ -36,11 +37,24 @@ class ExtensionWebRequestEventRouter { |
static ExtensionWebRequestEventRouter* GetInstance(); |
// Dispatches the OnBeforeRequest event to any extensions whose filters match |
- // the given request. Returns true if an extension wants to pause the request. |
- bool OnBeforeRequest(ProfileId profile_id, |
- ExtensionEventRouterForwarder* event_router, |
- net::URLRequest* request, |
- net::CompletionCallback* callback); |
+ // the given request. Returns net::ERR_IO_PENDING if an extension is |
+ // intercepting the request, OK otherwise. |
+ int OnBeforeRequest(ProfileId profile_id, |
+ ExtensionEventRouterForwarder* event_router, |
+ net::URLRequest* request, |
+ net::CompletionCallback* callback); |
+ |
+ // Dispatches the onBeforeSendHeaders event. This is fired for HTTP(s) |
+ // requests only, and allows modification of the outgoing request headers. |
+ // Returns net::ERR_IO_PENDING if an extension is intercepting the request, OK |
+ // otherwise. |
+ int OnBeforeSendHeaders(ProfileId profile_id, |
+ ExtensionEventRouterForwarder* event_router, |
+ uint64 request_id, |
+ net::HttpRequestHeaders* headers, |
+ net::CompletionCallback* callback); |
+ |
+ void OnURLRequestDestroyed(ProfileId profile_id, net::URLRequest* request); |
// Called when an event listener handles a blocking event and responds. |
// TODO(mpcomplete): modify request |
@@ -77,10 +91,19 @@ class ExtensionWebRequestEventRouter { |
typedef std::map<std::string, std::set<EventListener> > ListenerMapForProfile; |
typedef std::map<ProfileId, ListenerMapForProfile> ListenerMap; |
typedef std::map<uint64, BlockedRequest> BlockedRequestMap; |
+ typedef std::map<uint64, net::URLRequest*> HttpRequestMap; |
ExtensionWebRequestEventRouter(); |
~ExtensionWebRequestEventRouter(); |
+ bool DispatchEvent( |
+ ProfileId profile_id, |
+ ExtensionEventRouterForwarder* event_router, |
+ net::URLRequest* request, |
+ net::CompletionCallback* callback, |
+ const std::vector<const EventListener*>& listeners, |
+ const ListValue& args); |
+ |
// Returns a list of event listeners that care about the given event, based |
// on their filter parameters. |
std::vector<const EventListener*> GetMatchingListeners( |
@@ -91,11 +114,18 @@ class ExtensionWebRequestEventRouter { |
int window_id, |
ResourceType::Type resource_type); |
+ // Same as above, but retrieves the filter parameters from the request. |
+ std::vector<const EventListener*> GetMatchingListeners( |
willchan no longer on Chromium
2011/03/26 01:46:49
Nit: Make sure you follow the rules on overloading
Matt Perry
2011/03/28 22:51:01
The guide has changed slightly since I last looked
|
+ ProfileId profile_id, |
+ const std::string& event_name, |
+ net::URLRequest* request); |
// Decrements the count of event handlers blocking the given request. When the |
// count reaches 0 (or immediately if the request is being cancelled), we |
// stop blocking the request and either resume or cancel it. |
void DecrementBlockCount(uint64 request_id, bool cancel); |
+ void OnRequestDeleted(net::URLRequest* request); |
+ |
// A map for each profile that maps an event name to a set of extensions that |
// are listening to that event. |
ListenerMap listeners_; |
@@ -104,6 +134,10 @@ class ExtensionWebRequestEventRouter { |
// to respond. |
BlockedRequestMap blocked_requests_; |
+ // A map of HTTP(s) network requests. We don't dispatch onBeforeRequest for |
willchan no longer on Chromium
2011/03/26 01:46:49
Is this comment still true? Aren't we going to dis
Matt Perry
2011/03/28 22:51:01
Oops, fixed.
|
+ // these requests until headers are available. |
+ HttpRequestMap http_requests_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); |
}; |