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

Unified Diff: chrome/browser/extensions/extension_webrequest_api.h

Issue 6698009: Add request_id to HttpRequestInfo and pass it to the NetworkDelegate for events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 9 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webrequest_api.cc » ('j') | net/base/network_delegate.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..710515a98144fa34bb7a21ef69c58e89999008de 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;
}
@@ -42,6 +43,16 @@ class ExtensionWebRequestEventRouter {
net::URLRequest* request,
net::CompletionCallback* callback);
+ // Same as above, but for HTTP(s) requests. This version includes the request
+ // headers about to be sent.
+ bool 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
void OnEventHandled(
@@ -77,10 +88,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 +111,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(
+ 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 +131,10 @@ class ExtensionWebRequestEventRouter {
// to respond.
BlockedRequestMap blocked_requests_;
+ // A map of HTTP(s) network requests. We don't dispatch onBeforeRequest for
+ // these requests until headers are available.
+ HttpRequestMap http_requests_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter);
};
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webrequest_api.cc » ('j') | net/base/network_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698