OLD | NEW |
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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 } | 3372 } |
3373 | 3373 |
3374 std::unique_ptr<NavigationHandleImpl> | 3374 std::unique_ptr<NavigationHandleImpl> |
3375 RenderFrameHostImpl::TakeNavigationHandleForCommit( | 3375 RenderFrameHostImpl::TakeNavigationHandleForCommit( |
3376 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 3376 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
3377 bool is_browser_initiated = (params.nav_entry_id != 0); | 3377 bool is_browser_initiated = (params.nav_entry_id != 0); |
3378 | 3378 |
3379 if (params.was_within_same_page) { | 3379 if (params.was_within_same_page) { |
3380 if (IsBrowserSideNavigationEnabled()) { | 3380 if (IsBrowserSideNavigationEnabled()) { |
3381 // When browser-side navigation is enabled, a NavigationHandle is created | 3381 // When browser-side navigation is enabled, a NavigationHandle is created |
3382 // for browser-initiated same-page navigation. Try to take it if it's | 3382 // for browser-initiated same-document navigation. Try to take it if it's |
3383 // still available and matches the current navigation. | 3383 // still available and matches the current navigation. |
3384 if (is_browser_initiated && navigation_handle_ && | 3384 if (is_browser_initiated && navigation_handle_ && |
3385 navigation_handle_->IsSamePage() && | 3385 navigation_handle_->IsSameDocument() && |
3386 navigation_handle_->GetURL() == params.url) { | 3386 navigation_handle_->GetURL() == params.url) { |
3387 return std::move(navigation_handle_); | 3387 return std::move(navigation_handle_); |
3388 } | 3388 } |
3389 } else { | 3389 } else { |
3390 // When browser-side navigation is disabled, there is never any existing | 3390 // When browser-side navigation is disabled, there is never any existing |
3391 // NavigationHandle to use for the navigation. We don't ever expect | 3391 // NavigationHandle to use for the navigation. We don't ever expect |
3392 // navigation_handle_ to match. | 3392 // navigation_handle_ to match. |
3393 DCHECK(!navigation_handle_ || !navigation_handle_->IsSamePage()); | 3393 DCHECK(!navigation_handle_ || !navigation_handle_->IsSameDocument()); |
3394 } | 3394 } |
3395 // No existing NavigationHandle has been found. Create a new one, but don't | 3395 // No existing NavigationHandle has been found. Create a new one, but don't |
3396 // reset any NavigationHandle tracking an ongoing navigation, since this may | 3396 // reset any NavigationHandle tracking an ongoing navigation, since this may |
3397 // lead to the cancellation of the navigation. | 3397 // lead to the cancellation of the navigation. |
3398 // First, determine if the navigation corresponds to the pending navigation | 3398 // First, determine if the navigation corresponds to the pending navigation |
3399 // entry. This is the case for a browser-initiated same-page navigation, | 3399 // entry. This is the case for a browser-initiated same-page navigation, |
3400 // which does not cause a NavigationHandle to be created because it does not | 3400 // which does not cause a NavigationHandle to be created because it does not |
3401 // go through DidStartProvisionalLoad. | 3401 // go through DidStartProvisionalLoad. |
3402 bool is_renderer_initiated = true; | 3402 bool is_renderer_initiated = true; |
3403 int pending_nav_entry_id = 0; | 3403 int pending_nav_entry_id = 0; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3461 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3461 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3462 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3462 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3463 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3463 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3464 return NavigationHandleImpl::Create( | 3464 return NavigationHandleImpl::Create( |
3465 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3465 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
3466 params.was_within_same_page, base::TimeTicks::Now(), | 3466 params.was_within_same_page, base::TimeTicks::Now(), |
3467 entry_id_for_data_nav, false); // started_from_context_menu | 3467 entry_id_for_data_nav, false); // started_from_context_menu |
3468 } | 3468 } |
3469 | 3469 |
3470 } // namespace content | 3470 } // namespace content |
OLD | NEW |