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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NavigationData final draft before adding tests Created 4 years, 8 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/frame_tree_node.h" 11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_handle_impl.h" 13 #include "content/browser/frame_host/navigation_handle_impl.h"
14 #include "content/browser/frame_host/navigation_request_info.h" 14 #include "content/browser/frame_host/navigation_request_info.h"
15 #include "content/browser/frame_host/navigator.h" 15 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/navigator_impl.h" 16 #include "content/browser/frame_host/navigator_impl.h"
17 #include "content/browser/loader/navigation_url_loader.h" 17 #include "content/browser/loader/navigation_url_loader.h"
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" 18 #include "content/browser/service_worker/service_worker_context_wrapper.h"
19 #include "content/browser/service_worker/service_worker_navigation_handle.h" 19 #include "content/browser/service_worker/service_worker_navigation_handle.h"
20 #include "content/browser/site_instance_impl.h" 20 #include "content/browser/site_instance_impl.h"
21 #include "content/common/resource_request_body.h" 21 #include "content/common/resource_request_body.h"
22 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
24 #include "content/public/browser/navigation_data.h"
24 #include "content/public/browser/storage_partition.h" 25 #include "content/public/browser/storage_partition.h"
25 #include "content/public/browser/stream_handle.h" 26 #include "content/public/browser/stream_handle.h"
26 #include "content/public/common/content_client.h" 27 #include "content/public/common/content_client.h"
27 #include "content/public/common/resource_response.h" 28 #include "content/public/common/resource_response.h"
28 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
29 #include "net/http/http_request_headers.h" 30 #include "net/http/http_request_headers.h"
30 #include "net/url_request/redirect_info.h" 31 #include "net/url_request/redirect_info.h"
31 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 32 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
32 33
33 namespace content { 34 namespace content {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // TODO(clamy): pass the real value for |is_external_protocol| if needed. 268 // TODO(clamy): pass the real value for |is_external_protocol| if needed.
268 navigation_handle_->WillRedirectRequest( 269 navigation_handle_->WillRedirectRequest(
269 common_params_.url, common_params_.method == "POST", 270 common_params_.url, common_params_.method == "POST",
270 common_params_.referrer.url, false, response->head.headers, 271 common_params_.referrer.url, false, response->head.headers,
271 base::Bind(&NavigationRequest::OnRedirectChecksComplete, 272 base::Bind(&NavigationRequest::OnRedirectChecksComplete,
272 base::Unretained(this))); 273 base::Unretained(this)));
273 } 274 }
274 275
275 void NavigationRequest::OnResponseStarted( 276 void NavigationRequest::OnResponseStarted(
276 const scoped_refptr<ResourceResponse>& response, 277 const scoped_refptr<ResourceResponse>& response,
277 std::unique_ptr<StreamHandle> body) { 278 std::unique_ptr<StreamHandle> body,
279 std::unique_ptr<NavigationData> navigation_data) {
278 DCHECK(state_ == STARTED); 280 DCHECK(state_ == STARTED);
279 state_ = RESPONSE_STARTED; 281 state_ = RESPONSE_STARTED;
280 282
281 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not 283 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
282 // commit; they leave the frame showing the previous page. 284 // commit; they leave the frame showing the previous page.
283 DCHECK(response); 285 DCHECK(response);
284 if (response->head.headers.get() && 286 if (response->head.headers.get() &&
285 (response->head.headers->response_code() == 204 || 287 (response->head.headers->response_code() == 204 ||
286 response->head.headers->response_code() == 205)) { 288 response->head.headers->response_code() == 205)) {
287 frame_tree_node_->ResetNavigationRequest(false); 289 frame_tree_node_->ResetNavigationRequest(false);
(...skipping 26 matching lines...) Expand all
314 // renderer, allow the embedder to cancel the transfer. 316 // renderer, allow the embedder to cancel the transfer.
315 if (!browser_initiated_ && 317 if (!browser_initiated_ &&
316 render_frame_host != frame_tree_node_->current_frame_host() && 318 render_frame_host != frame_tree_node_->current_frame_host() &&
317 !frame_tree_node_->navigator() 319 !frame_tree_node_->navigator()
318 ->GetDelegate() 320 ->GetDelegate()
319 ->ShouldTransferNavigation()) { 321 ->ShouldTransferNavigation()) {
320 frame_tree_node_->ResetNavigationRequest(false); 322 frame_tree_node_->ResetNavigationRequest(false);
321 return; 323 return;
322 } 324 }
323 325
326 if (navigation_data.get()) {
nasko 2016/04/26 20:18:39 nit: No need for {} on one line if statements.
RyanSturm 2016/04/27 23:27:47 Done.
327 navigation_handle_->SetNavigationData(std::move(navigation_data));
328 }
329
324 // Store the response and the StreamHandle until checks have been processed. 330 // Store the response and the StreamHandle until checks have been processed.
325 response_ = response; 331 response_ = response;
326 body_ = std::move(body); 332 body_ = std::move(body);
327 333
328 // Check if the navigation should be allowed to proceed. 334 // Check if the navigation should be allowed to proceed.
329 navigation_handle_->WillProcessResponse( 335 navigation_handle_->WillProcessResponse(
330 render_frame_host, response->head.headers.get(), 336 render_frame_host, response->head.headers.get(),
331 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, 337 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete,
332 base::Unretained(this))); 338 base::Unretained(this)));
333 } 339 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 browser_context, navigating_frame_host->GetSiteInstance()); 459 browser_context, navigating_frame_host->GetSiteInstance());
454 DCHECK(partition); 460 DCHECK(partition);
455 461
456 ServiceWorkerContextWrapper* service_worker_context = 462 ServiceWorkerContextWrapper* service_worker_context =
457 static_cast<ServiceWorkerContextWrapper*>( 463 static_cast<ServiceWorkerContextWrapper*>(
458 partition->GetServiceWorkerContext()); 464 partition->GetServiceWorkerContext());
459 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 465 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
460 } 466 }
461 467
462 } // namespace content 468 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698