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

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

Issue 2657323003: Convert HistoryTabHelper to use the new navigation callbacks. (Closed)
Patch Set: nit Created 3 years, 10 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 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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 base::TimeDelta::FromMilliseconds(10), 1124 base::TimeDelta::FromMilliseconds(10),
1125 base::TimeDelta::FromMinutes(10), 100); 1125 base::TimeDelta::FromMinutes(10), 100);
1126 } 1126 }
1127 // This message is only sent for top-level frames. TODO(avi): when frame tree 1127 // This message is only sent for top-level frames. TODO(avi): when frame tree
1128 // mirroring works correctly, add a check here to enforce it. 1128 // mirroring works correctly, add a check here to enforce it.
1129 delegate_->DocumentOnLoadCompleted(this); 1129 delegate_->DocumentOnLoadCompleted(this);
1130 } 1130 }
1131 1131
1132 void RenderFrameHostImpl::OnDidStartProvisionalLoad( 1132 void RenderFrameHostImpl::OnDidStartProvisionalLoad(
1133 const GURL& url, 1133 const GURL& url,
1134 const std::vector<GURL>& redirect_chain,
1134 const base::TimeTicks& navigation_start) { 1135 const base::TimeTicks& navigation_start) {
1135 // TODO(clamy): Check if other navigation methods (OpenURL, 1136 // TODO(clamy): Check if other navigation methods (OpenURL,
1136 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer 1137 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer
1137 // active. 1138 // active.
1138 if (!is_active()) 1139 if (!is_active())
1139 return; 1140 return;
1140 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, 1141 frame_tree_node_->navigator()->DidStartProvisionalLoad(
1141 navigation_start); 1142 this, url, redirect_chain, navigation_start);
1142 } 1143 }
1143 1144
1144 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( 1145 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
1145 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 1146 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
1146 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and 1147 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and
1147 // return early if navigation_handle_ is null, once we prevent that case from 1148 // return early if navigation_handle_ is null, once we prevent that case from
1148 // happening in practice. 1149 // happening in practice.
1149 1150
1150 // Update the error code in the NavigationHandle of the navigation. 1151 // Update the error code in the NavigationHandle of the navigation.
1151 if (navigation_handle_) { 1152 if (navigation_handle_) {
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 int pending_nav_entry_id = 0; 3398 int pending_nav_entry_id = 0;
3398 NavigationEntryImpl* pending_entry = 3399 NavigationEntryImpl* pending_entry =
3399 NavigationEntryImpl::FromNavigationEntry( 3400 NavigationEntryImpl::FromNavigationEntry(
3400 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); 3401 frame_tree_node()->navigator()->GetController()->GetPendingEntry());
3401 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { 3402 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) {
3402 pending_nav_entry_id = params.nav_entry_id; 3403 pending_nav_entry_id = params.nav_entry_id;
3403 is_renderer_initiated = pending_entry->is_renderer_initiated(); 3404 is_renderer_initiated = pending_entry->is_renderer_initiated();
3404 } 3405 }
3405 3406
3406 return NavigationHandleImpl::Create( 3407 return NavigationHandleImpl::Create(
3407 params.url, frame_tree_node_, is_renderer_initiated, 3408 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3408 params.was_within_same_page, base::TimeTicks::Now(), 3409 params.was_within_same_page, base::TimeTicks::Now(),
3409 pending_nav_entry_id, false); // started_from_context_menu 3410 pending_nav_entry_id, false); // started_from_context_menu
3410 } 3411 }
3411 3412
3412 // Determine if the current NavigationHandle can be used. 3413 // Determine if the current NavigationHandle can be used.
3413 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { 3414 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) {
3414 return std::move(navigation_handle_); 3415 return std::move(navigation_handle_);
3415 } 3416 }
3416 3417
3417 // If the URL does not match what the NavigationHandle expects, treat the 3418 // If the URL does not match what the NavigationHandle expects, treat the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 } 3450 }
3450 3451
3451 // Reset any existing NavigationHandle. 3452 // Reset any existing NavigationHandle.
3452 navigation_handle_.reset(); 3453 navigation_handle_.reset();
3453 } 3454 }
3454 3455
3455 // There is no pending NavigationEntry in these cases, so pass 0 as the 3456 // There is no pending NavigationEntry in these cases, so pass 0 as the
3456 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3457 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3457 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3458 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3458 return NavigationHandleImpl::Create( 3459 return NavigationHandleImpl::Create(
3459 params.url, frame_tree_node_, is_renderer_initiated, 3460 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3460 params.was_within_same_page, base::TimeTicks::Now(), 3461 params.was_within_same_page, base::TimeTicks::Now(),
3461 entry_id_for_data_nav, false); // started_from_context_menu 3462 entry_id_for_data_nav, false); // started_from_context_menu
3462 } 3463 }
3463 3464
3464 } // namespace content 3465 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698