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

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

Issue 2465813002: Fix content script injection for cancelled loads with PlzNavigate. (Closed)
Patch Set: Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/dump_without_crashing.h" 9 #include "base/debug/dump_without_crashing.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 state_ = READY_TO_COMMIT; 493 state_ = READY_TO_COMMIT;
494 494
495 GetDelegate()->ReadyToCommitNavigation(this); 495 GetDelegate()->ReadyToCommitNavigation(this);
496 } 496 }
497 497
498 void NavigationHandleImpl::DidCommitNavigation( 498 void NavigationHandleImpl::DidCommitNavigation(
499 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 499 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
500 bool same_page, 500 bool same_page,
501 RenderFrameHostImpl* render_frame_host) { 501 RenderFrameHostImpl* render_frame_host) {
502 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); 502 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host);
503 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); 503 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node());
Charlie Reis 2016/10/31 17:05:28 We should probably have these first two DCHECKs in
504 CHECK_EQ(url_, params.url); 504 CHECK_EQ(url_, params.url);
505 505
506 method_ = params.method; 506 method_ = params.method;
507 has_user_gesture_ = (params.gesture == NavigationGestureUser); 507 has_user_gesture_ = (params.gesture == NavigationGestureUser);
508 transition_ = params.transition; 508 transition_ = params.transition;
509 render_frame_host_ = render_frame_host; 509 render_frame_host_ = render_frame_host;
510 is_same_page_ = same_page; 510 is_same_page_ = same_page;
511 511
512 // If an error page reloads, net_error_code might be 200 but we still want to 512 // If an error page reloads, net_error_code might be 200 but we still want to
513 // count it as an error page. 513 // count it as an error page.
514 if (params.base_url.spec() == kUnreachableWebDataURL || 514 if (params.base_url.spec() == kUnreachableWebDataURL ||
515 net_error_code_ != net::OK) { 515 net_error_code_ != net::OK) {
516 state_ = DID_COMMIT_ERROR_PAGE; 516 state_ = DID_COMMIT_ERROR_PAGE;
517 } else { 517 } else {
518 state_ = DID_COMMIT; 518 state_ = DID_COMMIT;
519 } 519 }
520 } 520 }
521 521
522 void NavigationHandleImpl::AbortCommit(
523 RenderFrameHostImpl* render_frame_host,
524 scoped_refptr<net::HttpResponseHeaders> response_headers) {
525 state_ = DID_ABORT_COMMIT;
526 render_frame_host_ = render_frame_host;
527 response_headers_ = response_headers;
528 }
529
522 void NavigationHandleImpl::Transfer() { 530 void NavigationHandleImpl::Transfer() {
523 DCHECK(!IsBrowserSideNavigationEnabled()); 531 DCHECK(!IsBrowserSideNavigationEnabled());
524 // This is an actual transfer. Inform the NavigationResourceThrottle. This 532 // This is an actual transfer. Inform the NavigationResourceThrottle. This
525 // will allow to mark the URLRequest as transferring. When it is marked as 533 // will allow to mark the URLRequest as transferring. When it is marked as
526 // transferring, the URLRequest can no longer be cancelled by its original 534 // transferring, the URLRequest can no longer be cancelled by its original
527 // RenderFrame. Instead it will persist until being picked up by the transfer 535 // RenderFrame. Instead it will persist until being picked up by the transfer
528 // RenderFrame, even if the original RenderFrame is destroyed. 536 // RenderFrame, even if the original RenderFrame is destroyed.
529 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); 537 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_);
530 transfer_callback_.Reset(); 538 transfer_callback_.Reset();
531 } 539 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 throttles_to_register.end()); 760 throttles_to_register.end());
753 throttles_to_register.weak_clear(); 761 throttles_to_register.weak_clear();
754 } 762 }
755 } 763 }
756 764
757 bool NavigationHandleImpl::WasStartedFromContextMenu() const { 765 bool NavigationHandleImpl::WasStartedFromContextMenu() const {
758 return started_from_context_menu_; 766 return started_from_context_menu_;
759 } 767 }
760 768
761 } // namespace content 769 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698