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 28 matching lines...) Expand all Loading... |
39 #include "content/public/browser/page_navigator.h" | 39 #include "content/public/browser/page_navigator.h" |
40 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/stream_handle.h" | 41 #include "content/public/browser/stream_handle.h" |
42 #include "content/public/browser/user_metrics.h" | 42 #include "content/public/browser/user_metrics.h" |
43 #include "content/public/common/bindings_policy.h" | 43 #include "content/public/common/bindings_policy.h" |
44 #include "content/public/common/browser_side_navigation_policy.h" | 44 #include "content/public/common/browser_side_navigation_policy.h" |
45 #include "content/public/common/content_client.h" | 45 #include "content/public/common/content_client.h" |
46 #include "content/public/common/content_constants.h" | 46 #include "content/public/common/content_constants.h" |
47 #include "content/public/common/resource_response.h" | 47 #include "content/public/common/resource_response.h" |
48 #include "net/base/net_errors.h" | 48 #include "net/base/net_errors.h" |
| 49 #include "net/base/url_util.h" |
49 #include "url/gurl.h" | 50 #include "url/gurl.h" |
50 | 51 |
51 namespace content { | 52 namespace content { |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 FrameMsg_Navigate_Type::Value GetNavigationType( | 56 FrameMsg_Navigate_Type::Value GetNavigationType( |
56 BrowserContext* browser_context, | 57 BrowserContext* browser_context, |
57 const NavigationEntryImpl& entry, | 58 const NavigationEntryImpl& entry, |
58 ReloadType reload_type) { | 59 ReloadType reload_type) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 dest_render_frame_host->set_is_loading(true); | 396 dest_render_frame_host->set_is_loading(true); |
396 | 397 |
397 // A session history navigation should have been accompanied by state. | 398 // A session history navigation should have been accompanied by state. |
398 // TODO(creis): This is known to be failing in UseSubframeNavigationEntries | 399 // TODO(creis): This is known to be failing in UseSubframeNavigationEntries |
399 // in https://crbug.com/568703, when the PageState on a FrameNavigationEntry | 400 // in https://crbug.com/568703, when the PageState on a FrameNavigationEntry |
400 // is unexpectedly empty. Until the cause is found, keep this as a DCHECK | 401 // is unexpectedly empty. Until the cause is found, keep this as a DCHECK |
401 // and load the URL without PageState. | 402 // and load the URL without PageState. |
402 if (is_pending_entry && controller_->GetPendingEntryIndex() != -1) | 403 if (is_pending_entry && controller_->GetPendingEntryIndex() != -1) |
403 DCHECK(frame_entry.page_state().IsValid()); | 404 DCHECK(frame_entry.page_state().IsValid()); |
404 | 405 |
| 406 bool is_history_navigation = frame_entry.page_state().IsValid(); |
| 407 bool is_same_document_fragment_change = |
| 408 net::IsFragmentAddedOrUpdated(frame_tree_node->current_url(), |
| 409 dest_url) && |
| 410 !is_history_navigation; |
| 411 |
405 // Navigate in the desired RenderFrameHost. | 412 // Navigate in the desired RenderFrameHost. |
406 // We can skip this step in the rare case that this is a transfer navigation | 413 // We can skip this step in the rare case that this is a transfer navigation |
407 // which began in the chosen RenderFrameHost, since the request has already | 414 // which began in the chosen RenderFrameHost, since the request has already |
408 // been issued. In that case, simply resume the response. | 415 // been issued. In that case, simply resume the response. |
409 bool is_transfer_to_same = | 416 bool is_transfer_to_same = |
410 is_transfer && | 417 is_transfer && |
411 entry.transferred_global_request_id().child_id == | 418 entry.transferred_global_request_id().child_id == |
412 dest_render_frame_host->GetProcess()->GetID(); | 419 dest_render_frame_host->GetProcess()->GetID(); |
413 if (!is_transfer_to_same) { | 420 if (!is_transfer_to_same) { |
414 navigation_data_.reset(new NavigationMetricsData( | 421 navigation_data_.reset(new NavigationMetricsData( |
415 navigation_start, dest_url, entry.restore_type())); | 422 navigation_start, dest_url, entry.restore_type())); |
416 // Create the navigation parameters. | 423 // Create the navigation parameters. |
417 FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType( | 424 FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType( |
418 controller_->GetBrowserContext(), entry, reload_type); | 425 controller_->GetBrowserContext(), entry, reload_type); |
419 dest_render_frame_host->Navigate( | 426 dest_render_frame_host->Navigate( |
420 entry.ConstructCommonNavigationParams( | 427 entry.ConstructCommonNavigationParams( |
421 frame_entry, post_body, dest_url, dest_referrer, navigation_type, | 428 frame_entry, post_body, dest_url, dest_referrer, navigation_type, |
422 previews_state, navigation_start), | 429 previews_state, navigation_start), |
423 entry.ConstructStartNavigationParams(), | 430 entry.ConstructStartNavigationParams(), |
424 entry.ConstructRequestNavigationParams( | 431 entry.ConstructRequestNavigationParams( |
425 frame_entry, is_same_document_history_load, | 432 frame_entry, is_same_document_fragment_change, |
426 is_history_navigation_in_new_child, | 433 is_same_document_history_load, is_history_navigation_in_new_child, |
427 entry.GetSubframeUniqueNames(frame_tree_node), | 434 entry.GetSubframeUniqueNames(frame_tree_node), |
428 frame_tree_node->has_committed_real_load(), | 435 frame_tree_node->has_committed_real_load(), |
429 controller_->GetPendingEntryIndex() == -1, | 436 controller_->GetPendingEntryIndex() == -1, |
430 controller_->GetIndexOfEntry(&entry), | 437 controller_->GetIndexOfEntry(&entry), |
431 controller_->GetLastCommittedEntryIndex(), | 438 controller_->GetLastCommittedEntryIndex(), |
432 controller_->GetEntryCount())); | 439 controller_->GetEntryCount())); |
433 } else { | 440 } else { |
434 dest_render_frame_host->navigation_handle()->set_is_transferring(false); | 441 dest_render_frame_host->navigation_handle()->set_is_transferring(false); |
435 } | 442 } |
436 } | 443 } |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 if (navigation_handle) | 1272 if (navigation_handle) |
1266 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1273 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1267 | 1274 |
1268 controller_->SetPendingEntry(std::move(entry)); | 1275 controller_->SetPendingEntry(std::move(entry)); |
1269 if (delegate_) | 1276 if (delegate_) |
1270 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1277 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1271 } | 1278 } |
1272 } | 1279 } |
1273 | 1280 |
1274 } // namespace content | 1281 } // namespace content |
OLD | NEW |