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

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: better fix to send this data from the renderer initially 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 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 base::TimeDelta::FromMilliseconds(10), 1113 base::TimeDelta::FromMilliseconds(10),
1114 base::TimeDelta::FromMinutes(10), 100); 1114 base::TimeDelta::FromMinutes(10), 100);
1115 } 1115 }
1116 // This message is only sent for top-level frames. TODO(avi): when frame tree 1116 // This message is only sent for top-level frames. TODO(avi): when frame tree
1117 // mirroring works correctly, add a check here to enforce it. 1117 // mirroring works correctly, add a check here to enforce it.
1118 delegate_->DocumentOnLoadCompleted(this); 1118 delegate_->DocumentOnLoadCompleted(this);
1119 } 1119 }
1120 1120
1121 void RenderFrameHostImpl::OnDidStartProvisionalLoad( 1121 void RenderFrameHostImpl::OnDidStartProvisionalLoad(
1122 const GURL& url, 1122 const GURL& url,
1123 const std::vector<GURL>& redirect_chain,
1123 const base::TimeTicks& navigation_start) { 1124 const base::TimeTicks& navigation_start) {
1124 // TODO(clamy): Check if other navigation methods (OpenURL, 1125 // TODO(clamy): Check if other navigation methods (OpenURL,
1125 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer 1126 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer
1126 // active. 1127 // active.
1127 if (!is_active()) 1128 if (!is_active())
1128 return; 1129 return;
1129 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, 1130 frame_tree_node_->navigator()->DidStartProvisionalLoad(
1130 navigation_start); 1131 this, url, redirect_chain, navigation_start);
1131 } 1132 }
1132 1133
1133 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( 1134 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
1134 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 1135 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
1135 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and 1136 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and
1136 // return early if navigation_handle_ is null, once we prevent that case from 1137 // return early if navigation_handle_ is null, once we prevent that case from
1137 // happening in practice. 1138 // happening in practice.
1138 1139
1139 // Update the error code in the NavigationHandle of the navigation. 1140 // Update the error code in the NavigationHandle of the navigation.
1140 if (navigation_handle_) { 1141 if (navigation_handle_) {
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 int pending_nav_entry_id = 0; 3349 int pending_nav_entry_id = 0;
3349 NavigationEntryImpl* pending_entry = 3350 NavigationEntryImpl* pending_entry =
3350 NavigationEntryImpl::FromNavigationEntry( 3351 NavigationEntryImpl::FromNavigationEntry(
3351 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); 3352 frame_tree_node()->navigator()->GetController()->GetPendingEntry());
3352 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { 3353 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) {
3353 pending_nav_entry_id = params.nav_entry_id; 3354 pending_nav_entry_id = params.nav_entry_id;
3354 is_renderer_initiated = pending_entry->is_renderer_initiated(); 3355 is_renderer_initiated = pending_entry->is_renderer_initiated();
3355 } 3356 }
3356 3357
3357 return NavigationHandleImpl::Create( 3358 return NavigationHandleImpl::Create(
3358 params.url, frame_tree_node_, is_renderer_initiated, 3359 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3359 params.was_within_same_page, base::TimeTicks::Now(), 3360 params.was_within_same_page, base::TimeTicks::Now(),
3360 pending_nav_entry_id, false); // started_from_context_menu 3361 pending_nav_entry_id, false); // started_from_context_menu
3361 } 3362 }
3362 3363
3363 // Determine if the current NavigationHandle can be used. 3364 // Determine if the current NavigationHandle can be used.
3364 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { 3365 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) {
3365 return std::move(navigation_handle_); 3366 return std::move(navigation_handle_);
3366 } 3367 }
3367 3368
3368 // If the URL does not match what the NavigationHandle expects, treat the 3369 // If the URL does not match what the NavigationHandle expects, treat the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 } 3401 }
3401 3402
3402 // Reset any existing NavigationHandle. 3403 // Reset any existing NavigationHandle.
3403 navigation_handle_.reset(); 3404 navigation_handle_.reset();
3404 } 3405 }
3405 3406
3406 // There is no pending NavigationEntry in these cases, so pass 0 as the 3407 // There is no pending NavigationEntry in these cases, so pass 0 as the
3407 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3408 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3408 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3409 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3409 return NavigationHandleImpl::Create( 3410 return NavigationHandleImpl::Create(
3410 params.url, frame_tree_node_, is_renderer_initiated, 3411 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3411 params.was_within_same_page, base::TimeTicks::Now(), 3412 params.was_within_same_page, base::TimeTicks::Now(),
3412 entry_id_for_data_nav, false); // started_from_context_menu 3413 entry_id_for_data_nav, false); // started_from_context_menu
3413 } 3414 }
3414 3415
3415 } // namespace content 3416 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698