| 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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 const BeginNavigationParams& begin_params) { | 972 const BeginNavigationParams& begin_params) { |
| 973 // TODO(clamy): the url sent by the renderer should be validated with | 973 // TODO(clamy): the url sent by the renderer should be validated with |
| 974 // FilterURL. | 974 // FilterURL. |
| 975 // This is a renderer-initiated navigation. | 975 // This is a renderer-initiated navigation. |
| 976 CHECK(IsBrowserSideNavigationEnabled()); | 976 CHECK(IsBrowserSideNavigationEnabled()); |
| 977 DCHECK(frame_tree_node); | 977 DCHECK(frame_tree_node); |
| 978 | 978 |
| 979 NavigationRequest* ongoing_navigation_request = | 979 NavigationRequest* ongoing_navigation_request = |
| 980 frame_tree_node->navigation_request(); | 980 frame_tree_node->navigation_request(); |
| 981 | 981 |
| 982 // Client redirects during the initial history navigation of a child frame | |
| 983 // should take precedence over the history navigation (despite being renderer- | |
| 984 // initiated). See https://crbug.com/348447 and https://crbug.com/691168. | |
| 985 if (ongoing_navigation_request && | |
| 986 ongoing_navigation_request->request_params() | |
| 987 .is_history_navigation_in_new_child) { | |
| 988 // Preemptively clear this local pointer before deleting the request. | |
| 989 ongoing_navigation_request = nullptr; | |
| 990 frame_tree_node->ResetNavigationRequest(false, true); | |
| 991 } | |
| 992 | |
| 993 // The renderer-initiated navigation request is ignored iff a) there is an | 982 // The renderer-initiated navigation request is ignored iff a) there is an |
| 994 // ongoing request b) which is browser or user-initiated and c) the renderer | 983 // ongoing request b) which is browser or user-initiated and c) the renderer |
| 995 // request is not user-initiated. | 984 // request is not user-initiated. |
| 996 if (ongoing_navigation_request && | 985 if (ongoing_navigation_request && |
| 997 (ongoing_navigation_request->browser_initiated() || | 986 (ongoing_navigation_request->browser_initiated() || |
| 998 ongoing_navigation_request->begin_params().has_user_gesture) && | 987 ongoing_navigation_request->begin_params().has_user_gesture) && |
| 999 !begin_params.has_user_gesture) { | 988 !begin_params.has_user_gesture) { |
| 1000 RenderFrameHost* current_frame_host = | 989 RenderFrameHost* current_frame_host = |
| 1001 frame_tree_node->render_manager()->current_frame_host(); | 990 frame_tree_node->render_manager()->current_frame_host(); |
| 1002 current_frame_host->Send( | 991 current_frame_host->Send( |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 if (navigation_handle) | 1285 if (navigation_handle) |
| 1297 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1286 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1298 | 1287 |
| 1299 controller_->SetPendingEntry(std::move(entry)); | 1288 controller_->SetPendingEntry(std::move(entry)); |
| 1300 if (delegate_) | 1289 if (delegate_) |
| 1301 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1290 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1302 } | 1291 } |
| 1303 } | 1292 } |
| 1304 | 1293 |
| 1305 } // namespace content | 1294 } // namespace content |
| OLD | NEW |