OLD | NEW |
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_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/public/browser/resource_request_info.h" | 16 #include "content/public/browser/resource_request_info.h" |
17 #include "content/public/common/referrer.h" | 17 #include "content/public/common/referrer.h" |
18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
19 #include "net/base/load_states.h" | 19 #include "net/base/load_states.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class CrossSiteResourceHandler; | 22 class CrossSiteResourceHandler; |
23 class DetachableResourceHandler; | 23 class DetachableResourceHandler; |
24 class ResourceContext; | 24 class ResourceContext; |
25 class ResourceMessageFilter; | 25 class ResourceMessageFilter; |
| 26 class WebContents; |
26 struct GlobalRequestID; | 27 struct GlobalRequestID; |
27 struct GlobalRoutingID; | 28 struct GlobalRoutingID; |
28 | 29 |
29 // Holds the data ResourceDispatcherHost associates with each request. | 30 // Holds the data ResourceDispatcherHost associates with each request. |
30 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. | 31 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. |
31 class ResourceRequestInfoImpl : public ResourceRequestInfo, | 32 class ResourceRequestInfoImpl : public ResourceRequestInfo, |
32 public base::SupportsUserData::Data { | 33 public base::SupportsUserData::Data { |
33 public: | 34 public: |
34 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. | 35 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. |
35 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( | 36 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 ui::PageTransition GetPageTransition() const override; | 87 ui::PageTransition GetPageTransition() const override; |
87 bool HasUserGesture() const override; | 88 bool HasUserGesture() const override; |
88 bool WasIgnoredByHandler() const override; | 89 bool WasIgnoredByHandler() const override; |
89 bool GetAssociatedRenderFrame(int* render_process_id, | 90 bool GetAssociatedRenderFrame(int* render_process_id, |
90 int* render_frame_id) const override; | 91 int* render_frame_id) const override; |
91 bool IsAsync() const override; | 92 bool IsAsync() const override; |
92 bool IsDownload() const override; | 93 bool IsDownload() const override; |
93 bool IsUsingLoFi() const override; | 94 bool IsUsingLoFi() const override; |
94 bool ShouldReportRawHeaders() const; | 95 bool ShouldReportRawHeaders() const; |
95 | 96 |
| 97 // Returns a callback that returns a pointer to the WebContents this request |
| 98 // is associated with, or nullptr if it no longer exists or the request is |
| 99 // not associated with a WebContents. The callback should only run on the UI |
| 100 // thread. |
| 101 // Note: Not all resource requests will be owned by a WebContents. For |
| 102 // example, requests made by a ServiceWorker. |
| 103 base::Callback<WebContents*(void)> GetWebContentsForRequest() const; |
| 104 |
96 CONTENT_EXPORT void AssociateWithRequest(net::URLRequest* request); | 105 CONTENT_EXPORT void AssociateWithRequest(net::URLRequest* request); |
97 | 106 |
98 CONTENT_EXPORT GlobalRequestID GetGlobalRequestID() const; | 107 CONTENT_EXPORT GlobalRequestID GetGlobalRequestID() const; |
99 GlobalRoutingID GetGlobalRoutingID() const; | 108 GlobalRoutingID GetGlobalRoutingID() const; |
100 | 109 |
101 // PlzNavigate | 110 // PlzNavigate |
102 // The id of the FrameTreeNode that initiated this request (for a navigation | 111 // The id of the FrameTreeNode that initiated this request (for a navigation |
103 // request). | 112 // request). |
104 int frame_tree_node_id() const { return frame_tree_node_id_; } | 113 int frame_tree_node_id() const { return frame_tree_node_id_; } |
105 | 114 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 bool report_raw_headers_; | 233 bool report_raw_headers_; |
225 bool is_async_; | 234 bool is_async_; |
226 bool is_using_lofi_; | 235 bool is_using_lofi_; |
227 | 236 |
228 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); | 237 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); |
229 }; | 238 }; |
230 | 239 |
231 } // namespace content | 240 } // namespace content |
232 | 241 |
233 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 242 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
OLD | NEW |