Chromium Code Reviews| 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..9d65500914ee5effe67d631012d22fda23fd7701 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,14 +53,33 @@ class ResourceRequestInfo { |
| int* render_process_id, |
| int* render_frame_id); |
| + // A callback that returns a pointer to a WebContents. The callback can |
| + // always be used, but it may return nullptr : if the info used to |
|
asanka
2015/11/25 19:33:02
Nit: stray ':'
clamy
2015/11/27 13:29:06
Done.
|
| + // instantiate the callback can no longer be used to return a WebContents, |
| + // nullptr will be returned instead. |
| + // The callback should only run on the UI thread and it should always be |
| + // non-null. |
| + using WebContentsGetterOnUIThread = base::Callback<WebContents*(void)>; |
|
asanka
2015/11/25 19:33:02
Nit: WebContentsGetter should also be sufficient s
clamy
2015/11/27 13:29:06
Done.
|
| + |
| + // 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 WebContentsGetterOnUIThread GetWebContentsGetterForRequest() |
|
asanka
2015/11/25 19:33:02
Nit: GetWebContentsGetter is also sufficient.
clamy
2015/11/27 13:29:06
Done.
|
| + const = 0; |
| + |
| // Returns the associated ResourceContext. |
| virtual ResourceContext* GetContext() const = 0; |
| // The child process unique ID of the requestor. |
| + // Use GetWebContentsGetterForRequest instead. |
|
asanka
2015/11/25 19:33:02
Nit: These comments assume that the respective met
clamy
2015/11/27 13:29:06
Done.
|
| 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 GetWebContentsGetterForRequest instead. |
| virtual int GetRouteID() const = 0; |
| // The pid of the originating process, if the request is sent on behalf of a |
| @@ -66,6 +87,7 @@ class ResourceRequestInfo { |
| virtual int GetOriginPID() const = 0; |
| // The IPC route identifier of the RenderFrame. |
| + // Use GetWebContentsGetterForRequest 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. |