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

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

Issue 1459473003: Add a WebContents getter callback in ResourceRequestInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed davidben's comments 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 b6edad7236c8eb2b76693c22c1bb0ef4fbb8c5ef..f25bd7ff327b3ccfa40ac2b0d1aec045fc6ba6c0 100644
--- a/content/public/browser/resource_request_info.h
+++ b/content/public/browser/resource_request_info.h
@@ -6,7 +6,9 @@
#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/browser/web_contents.h"
davidben 2015/11/20 22:19:53 I think you can just forward-declare this.
clamy 2015/11/23 16:44:09 Done.
#include "content/public/common/resource_type.h"
#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
@@ -51,14 +53,23 @@ 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 does not exist. 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() = 0;
+
// Returns the associated ResourceContext.
virtual ResourceContext* GetContext() const = 0;
// The child process unique ID of the requestor.
+ // Use GetWebContentsForRequest() instead.
virtual int GetChildID() const = 0;
// The IPC route identifier for this request (this identifies the RenderView
// or like-thing in the renderer that the request gets routed to).
+ // Use GetWebContentsForRequest() instead.
virtual int GetRouteID() const = 0;
// The pid of the originating process, if the request is sent on behalf of a
@@ -69,6 +80,7 @@ class ResourceRequestInfo {
virtual int GetRequestID() const = 0;
// The IPC route identifier of the RenderFrame.
+ // Use GetWebContentsForRequest() instead.
// TODO(jam): once all navigation and resource requests are sent between
// frames and RenderView/RenderViewHost aren't involved we can remove this and
// just use GetRouteID above.

Powered by Google App Engine
This is Rietveld 408576698