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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
9 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
10 #include "content/public/common/resource_type.h" 11 #include "content/public/common/resource_type.h"
11 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" 12 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 13 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
13 #include "ui/base/page_transition_types.h" 14 #include "ui/base/page_transition_types.h"
14 15
15 namespace net { 16 namespace net {
16 class URLRequest; 17 class URLRequest;
17 } 18 }
18 19
19 namespace content { 20 namespace content {
20 class ResourceContext; 21 class ResourceContext;
22 class WebContents;
21 23
22 // Each URLRequest allocated by the ResourceDispatcherHost has a 24 // Each URLRequest allocated by the ResourceDispatcherHost has a
23 // ResourceRequestInfo instance associated with it. 25 // ResourceRequestInfo instance associated with it.
24 class ResourceRequestInfo { 26 class ResourceRequestInfo {
25 public: 27 public:
26 // Returns the ResourceRequestInfo associated with the given URLRequest. 28 // Returns the ResourceRequestInfo associated with the given URLRequest.
27 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( 29 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest(
28 const net::URLRequest* request); 30 const net::URLRequest* request);
29 31
30 // Allocates a new, dummy ResourceRequestInfo and associates it with the 32 // Allocates a new, dummy ResourceRequestInfo and associates it with the
(...skipping 13 matching lines...) Expand all
44 46
45 // Returns the associated RenderFrame for a given process. Returns false, if 47 // Returns the associated RenderFrame for a given process. Returns false, if
46 // there is no associated RenderFrame. This method does not rely on the 48 // there is no associated RenderFrame. This method does not rely on the
47 // request being allocated by the ResourceDispatcherHost, but works for all 49 // request being allocated by the ResourceDispatcherHost, but works for all
48 // URLRequests that are associated with a RenderFrame. 50 // URLRequests that are associated with a RenderFrame.
49 CONTENT_EXPORT static bool GetRenderFrameForRequest( 51 CONTENT_EXPORT static bool GetRenderFrameForRequest(
50 const net::URLRequest* request, 52 const net::URLRequest* request,
51 int* render_process_id, 53 int* render_process_id,
52 int* render_frame_id); 54 int* render_frame_id);
53 55
56 // Returns a callback that returns a pointer to the WebContents this request
57 // is associated with, or nullptr if it no longer exists or the request is
58 // not associated with a WebContents. The callback should only run on the UI
59 // thread.
60 // Note: Not all resource requests will be owned by a WebContents. For
61 // example, requests made by a ServiceWorker.
62 virtual base::Callback<WebContents*(void)> GetWebContentsForRequest()
63 const = 0;
64
54 // Returns the associated ResourceContext. 65 // Returns the associated ResourceContext.
55 virtual ResourceContext* GetContext() const = 0; 66 virtual ResourceContext* GetContext() const = 0;
56 67
57 // The child process unique ID of the requestor. 68 // The child process unique ID of the requestor.
davidben 2015/11/24 15:51:16 Restore the "Use GetWebContentsForRequest instead.
clamy 2015/11/25 14:02:02 Done.
58 virtual int GetChildID() const = 0; 69 virtual int GetChildID() const = 0;
59 70
60 // The IPC route identifier for this request (this identifies the RenderView 71 // The IPC route identifier for this request (this identifies the RenderView
61 // or like-thing in the renderer that the request gets routed to). 72 // or like-thing in the renderer that the request gets routed to).
62 virtual int GetRouteID() const = 0; 73 virtual int GetRouteID() const = 0;
63 74
64 // The pid of the originating process, if the request is sent on behalf of a 75 // The pid of the originating process, if the request is sent on behalf of a
65 // another process. Otherwise it is 0. 76 // another process. Otherwise it is 0.
66 virtual int GetOriginPID() const = 0; 77 virtual int GetOriginPID() const = 0;
67 78
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Whether this request if using Lo-Fi mode. 136 // Whether this request if using Lo-Fi mode.
126 virtual bool IsUsingLoFi() const = 0; 137 virtual bool IsUsingLoFi() const = 0;
127 138
128 protected: 139 protected:
129 virtual ~ResourceRequestInfo() {} 140 virtual ~ResourceRequestInfo() {}
130 }; 141 };
131 142
132 } // namespace content 143 } // namespace content
133 144
134 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ 145 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698