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 #include "content/browser/loader/resource_request_info_impl.h" | 5 #include "content/browser/loader/resource_request_info_impl.h" |
6 | 6 |
7 #include "content/browser/frame_host/frame_tree_node.h" | 7 #include "content/browser/frame_host/frame_tree_node.h" |
8 #include "content/browser/loader/global_routing_id.h" | 8 #include "content/browser/loader/global_routing_id.h" |
9 #include "content/browser/loader/resource_message_filter.h" | 9 #include "content/browser/loader/resource_message_filter.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void ResourceRequestInfo::AllocateForTesting(net::URLRequest* request, | 45 void ResourceRequestInfo::AllocateForTesting(net::URLRequest* request, |
46 ResourceType resource_type, | 46 ResourceType resource_type, |
47 ResourceContext* context, | 47 ResourceContext* context, |
48 int render_process_id, | 48 int render_process_id, |
49 int render_view_id, | 49 int render_view_id, |
50 int render_frame_id, | 50 int render_frame_id, |
51 bool is_main_frame, | 51 bool is_main_frame, |
52 bool parent_is_main_frame, | 52 bool parent_is_main_frame, |
53 bool allow_download, | 53 bool allow_download, |
54 bool is_async, | 54 bool is_async, |
55 bool is_using_lofi) { | 55 PreviewsState previews_state) { |
56 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the | 56 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the |
57 // same time. | 57 // same time. |
58 DCHECK(!(is_main_frame && parent_is_main_frame)); | 58 DCHECK(!(is_main_frame && parent_is_main_frame)); |
59 | 59 |
60 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of | 60 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of |
61 // the main frame. | 61 // the main frame. |
62 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); | 62 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); |
63 | 63 |
64 ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl( | 64 ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl( |
65 ResourceRequesterInfo::CreateForRendererTesting( | 65 ResourceRequesterInfo::CreateForRendererTesting( |
(...skipping 13 matching lines...) Expand all Loading... |
79 allow_download, // allow_download | 79 allow_download, // allow_download |
80 false, // has_user_gesture | 80 false, // has_user_gesture |
81 false, // enable load timing | 81 false, // enable load timing |
82 request->has_upload(), // enable upload progress | 82 request->has_upload(), // enable upload progress |
83 false, // do_not_prompt_for_login | 83 false, // do_not_prompt_for_login |
84 blink::WebReferrerPolicyDefault, // referrer_policy | 84 blink::WebReferrerPolicyDefault, // referrer_policy |
85 blink::WebPageVisibilityStateVisible, // visibility_state | 85 blink::WebPageVisibilityStateVisible, // visibility_state |
86 context, // context | 86 context, // context |
87 false, // report_raw_headers | 87 false, // report_raw_headers |
88 is_async, // is_async | 88 is_async, // is_async |
89 is_using_lofi, // is_using_lofi | 89 previews_state, // previews_state |
90 std::string(), // original_headers | 90 std::string(), // original_headers |
91 nullptr, // body | 91 nullptr, // body |
92 false); // initiated_in_secure_context | 92 false); // initiated_in_secure_context |
93 info->AssociateWithRequest(request); | 93 info->AssociateWithRequest(request); |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 bool ResourceRequestInfo::GetRenderFrameForRequest( | 97 bool ResourceRequestInfo::GetRenderFrameForRequest( |
98 const net::URLRequest* request, | 98 const net::URLRequest* request, |
99 int* render_process_id, | 99 int* render_process_id, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 bool allow_download, | 146 bool allow_download, |
147 bool has_user_gesture, | 147 bool has_user_gesture, |
148 bool enable_load_timing, | 148 bool enable_load_timing, |
149 bool enable_upload_progress, | 149 bool enable_upload_progress, |
150 bool do_not_prompt_for_login, | 150 bool do_not_prompt_for_login, |
151 blink::WebReferrerPolicy referrer_policy, | 151 blink::WebReferrerPolicy referrer_policy, |
152 blink::WebPageVisibilityState visibility_state, | 152 blink::WebPageVisibilityState visibility_state, |
153 ResourceContext* context, | 153 ResourceContext* context, |
154 bool report_raw_headers, | 154 bool report_raw_headers, |
155 bool is_async, | 155 bool is_async, |
156 bool is_using_lofi, | 156 PreviewsState previews_state, |
157 const std::string& original_headers, | 157 const std::string& original_headers, |
158 const scoped_refptr<ResourceRequestBodyImpl> body, | 158 const scoped_refptr<ResourceRequestBodyImpl> body, |
159 bool initiated_in_secure_context) | 159 bool initiated_in_secure_context) |
160 : detachable_handler_(NULL), | 160 : detachable_handler_(NULL), |
161 requester_info_(std::move(requester_info)), | 161 requester_info_(std::move(requester_info)), |
162 route_id_(route_id), | 162 route_id_(route_id), |
163 frame_tree_node_id_(frame_tree_node_id), | 163 frame_tree_node_id_(frame_tree_node_id), |
164 origin_pid_(origin_pid), | 164 origin_pid_(origin_pid), |
165 request_id_(request_id), | 165 request_id_(request_id), |
166 render_frame_id_(render_frame_id), | 166 render_frame_id_(render_frame_id), |
(...skipping 10 matching lines...) Expand all Loading... |
177 was_ignored_by_handler_(false), | 177 was_ignored_by_handler_(false), |
178 counted_as_in_flight_request_(false), | 178 counted_as_in_flight_request_(false), |
179 resource_type_(resource_type), | 179 resource_type_(resource_type), |
180 transition_type_(transition_type), | 180 transition_type_(transition_type), |
181 memory_cost_(0), | 181 memory_cost_(0), |
182 referrer_policy_(referrer_policy), | 182 referrer_policy_(referrer_policy), |
183 visibility_state_(visibility_state), | 183 visibility_state_(visibility_state), |
184 context_(context), | 184 context_(context), |
185 report_raw_headers_(report_raw_headers), | 185 report_raw_headers_(report_raw_headers), |
186 is_async_(is_async), | 186 is_async_(is_async), |
187 is_using_lofi_(is_using_lofi), | 187 previews_state_(previews_state), |
188 original_headers_(original_headers), | 188 original_headers_(original_headers), |
189 body_(body), | 189 body_(body), |
190 initiated_in_secure_context_(initiated_in_secure_context) {} | 190 initiated_in_secure_context_(initiated_in_secure_context) {} |
191 | 191 |
192 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { | 192 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { |
193 } | 193 } |
194 | 194 |
195 ResourceRequestInfo::WebContentsGetter | 195 ResourceRequestInfo::WebContentsGetter |
196 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const { | 196 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const { |
197 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID | 197 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 bool ResourceRequestInfoImpl::IsAsync() const { | 292 bool ResourceRequestInfoImpl::IsAsync() const { |
293 return is_async_; | 293 return is_async_; |
294 } | 294 } |
295 | 295 |
296 bool ResourceRequestInfoImpl::IsDownload() const { | 296 bool ResourceRequestInfoImpl::IsDownload() const { |
297 return is_download_; | 297 return is_download_; |
298 } | 298 } |
299 | 299 |
300 bool ResourceRequestInfoImpl::IsUsingLoFi() const { | 300 PreviewsState ResourceRequestInfoImpl::GetPreviewsState() const { |
301 return is_using_lofi_; | 301 return previews_state_; |
302 } | 302 } |
303 | 303 |
304 bool ResourceRequestInfoImpl::ShouldReportRawHeaders() const { | 304 bool ResourceRequestInfoImpl::ShouldReportRawHeaders() const { |
305 return report_raw_headers_; | 305 return report_raw_headers_; |
306 } | 306 } |
307 | 307 |
308 NavigationUIData* ResourceRequestInfoImpl::GetNavigationUIData() const { | 308 NavigationUIData* ResourceRequestInfoImpl::GetNavigationUIData() const { |
309 return navigation_ui_data_.get(); | 309 return navigation_ui_data_.get(); |
310 } | 310 } |
311 | 311 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 on_transfer_.Run(std::move(url_loader_request), | 347 on_transfer_.Run(std::move(url_loader_request), |
348 std::move(url_loader_client)); | 348 std::move(url_loader_client)); |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 void ResourceRequestInfoImpl::ResetBody() { | 352 void ResourceRequestInfoImpl::ResetBody() { |
353 body_ = nullptr; | 353 body_ = nullptr; |
354 } | 354 } |
355 | 355 |
356 } // namespace content | 356 } // namespace content |
OLD | NEW |