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

Unified Diff: content/public/browser/resource_request_info.h

Issue 1467563002: Use ResourceRequestInfo::GetWebContents in DownloadRequestLimiter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-contents-callback
Patch Set: Created 5 years, 1 month 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
Index: content/public/browser/resource_request_info.h
diff --git a/content/public/browser/resource_request_info.h b/content/public/browser/resource_request_info.h
index 50b04bf7c0bb1f55147d05033ea0d67151a58820..9e8c86057cb5ce28d41e7619edcf6f29d66321ab 100644
--- a/content/public/browser/resource_request_info.h
+++ b/content/public/browser/resource_request_info.h
@@ -6,6 +6,7 @@
#define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "content/common/content_export.h"
#include "content/public/common/resource_type.h"
#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
@@ -18,6 +19,7 @@ class URLRequest;
namespace content {
class ResourceContext;
+class WebContents;
// Each URLRequest allocated by the ResourceDispatcherHost has a
// ResourceRequestInfo instance associated with it.
@@ -51,6 +53,15 @@ class ResourceRequestInfo {
int* render_process_id,
int* render_frame_id);
+ // Returns a callback that returns a pointer to the WebContents this request
+ // is associated with, or nullptr if it no longer exists or the request is
+ // not associated with a WebContents. The callback should only run on the UI
+ // thread.
+ // Note: Not all resource requests will be owned by a WebContents. For
+ // example, requests made by a ServiceWorker.
+ virtual base::Callback<WebContents*(void)> GetWebContentsForRequest()
+ const = 0;
+
// Returns the associated ResourceContext.
virtual ResourceContext* GetContext() const = 0;

Powered by Google App Engine
This is Rietveld 408576698