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

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

Issue 1446253002: PlzNavigate: inform the WebFrameClient that a form will be submitted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 NavigationRequest* ongoing_navigation_request = 669 NavigationRequest* ongoing_navigation_request =
670 frame_tree_node->navigation_request(); 670 frame_tree_node->navigation_request();
671 671
672 // The renderer-initiated navigation request is ignored iff a) there is an 672 // The renderer-initiated navigation request is ignored iff a) there is an
673 // ongoing request b) which is browser or user-initiated and c) the renderer 673 // ongoing request b) which is browser or user-initiated and c) the renderer
674 // request is not user-initiated. 674 // request is not user-initiated.
675 if (ongoing_navigation_request && 675 if (ongoing_navigation_request &&
676 (ongoing_navigation_request->browser_initiated() || 676 (ongoing_navigation_request->browser_initiated() ||
677 ongoing_navigation_request->begin_params().has_user_gesture) && 677 ongoing_navigation_request->begin_params().has_user_gesture) &&
678 !begin_params.has_user_gesture) { 678 !begin_params.has_user_gesture) {
679 // Inform the renderer that its request will not be treated.
680 frame_tree_node->current_frame_host()->Stop();
679 return; 681 return;
680 } 682 }
681 683
682 // In all other cases the current navigation, if any, is canceled and a new 684 // In all other cases the current navigation, if any, is canceled and a new
683 // NavigationRequest is created for the node. 685 // NavigationRequest is created for the node.
684 frame_tree_node->CreatedNavigationRequest( 686 frame_tree_node->CreatedNavigationRequest(
685 NavigationRequest::CreateRendererInitiated( 687 NavigationRequest::CreateRendererInitiated(
686 frame_tree_node, common_params, begin_params, body, 688 frame_tree_node, common_params, begin_params, body,
687 controller_->GetLastCommittedEntryIndex(), 689 controller_->GetLastCommittedEntryIndex(),
688 controller_->GetEntryCount())); 690 controller_->GetEntryCount()));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 navigation_request->TransferNavigationHandleOwnership(render_frame_host); 782 navigation_request->TransferNavigationHandleOwnership(render_frame_host);
781 render_frame_host->FailedNavigation(navigation_request->common_params(), 783 render_frame_host->FailedNavigation(navigation_request->common_params(),
782 navigation_request->request_params(), 784 navigation_request->request_params(),
783 has_stale_copy_in_cache, error_code); 785 has_stale_copy_in_cache, error_code);
784 } 786 }
785 787
786 // PlzNavigate 788 // PlzNavigate
787 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 789 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
788 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 790 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
789 switches::kEnableBrowserSideNavigation)); 791 switches::kEnableBrowserSideNavigation));
792 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
793
794 // If the navigation was renderer-initiated, the renderer expects the browser
795 // to be treating it. Inform the renderer that the navigation is no longer
796 // ongoing.
797 if (navigation_request && !navigation_request->browser_initiated())
798 frame_tree_node->current_frame_host()->Stop();
799
790 frame_tree_node->ResetNavigationRequest(false); 800 frame_tree_node->ResetNavigationRequest(false);
791 if (frame_tree_node->IsMainFrame()) 801 if (frame_tree_node->IsMainFrame())
792 navigation_data_.reset(); 802 navigation_data_.reset();
793 } 803 }
794 804
795 void NavigatorImpl::LogResourceRequestTime( 805 void NavigatorImpl::LogResourceRequestTime(
796 base::TimeTicks timestamp, const GURL& url) { 806 base::TimeTicks timestamp, const GURL& url) {
797 if (navigation_data_ && navigation_data_->url_ == url) { 807 if (navigation_data_ && navigation_data_->url_ == url) {
798 navigation_data_->url_job_start_time_ = timestamp; 808 navigation_data_->url_job_start_time_ = timestamp;
799 UMA_HISTOGRAM_TIMES( 809 UMA_HISTOGRAM_TIMES(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 963 entry->set_should_replace_entry(pending_entry->should_replace_entry());
954 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 964 entry->SetRedirectChain(pending_entry->GetRedirectChain());
955 } 965 }
956 controller_->SetPendingEntry(entry.Pass()); 966 controller_->SetPendingEntry(entry.Pass());
957 if (delegate_) 967 if (delegate_)
958 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 968 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
959 } 969 }
960 } 970 }
961 971
962 } // namespace content 972 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698