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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 if (old_entry_count != controller_->GetEntryCount() || | 633 if (old_entry_count != controller_->GetEntryCount() || |
634 details.previous_entry_index != | 634 details.previous_entry_index != |
635 controller_->GetLastCommittedEntryIndex()) { | 635 controller_->GetLastCommittedEntryIndex()) { |
636 frame_tree->root()->render_manager()->SendPageMessage( | 636 frame_tree->root()->render_manager()->SendPageMessage( |
637 new PageMsg_SetHistoryOffsetAndLength( | 637 new PageMsg_SetHistoryOffsetAndLength( |
638 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), | 638 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), |
639 controller_->GetEntryCount()), | 639 controller_->GetEntryCount()), |
640 site_instance); | 640 site_instance); |
641 } | 641 } |
642 | 642 |
643 // Keep track of each frame's URL in its FrameTreeNode, whether it's for a net | 643 // Keep track of the last committed URL and origin in the RenderFrameHost |
644 // error or not. | 644 // itself. These allow GetLastCommittedURL and GetLastCommittedOrigin to |
645 // TODO(creis): Move the last committed URL to RenderFrameHostImpl. | 645 // stay correct even if the render_frame_host later becomes pending deletion. |
646 // The URL is set regardless of whether it's for a net error or not. | |
646 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); | 647 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); |
648 render_frame_host->set_last_committed_origin(params.origin); | |
alexmos
2016/12/06 17:22:40
I originally tried to do this inside SetCurrentOri
Charlie Reis
2016/12/08 19:51:47
Interesting. Yes, I agree with your decisions.
| |
647 | 649 |
648 // Separately, update the frame's last successful URL except for net error | 650 // Separately, update the frame's last successful URL except for net error |
649 // pages, since those do not end up in the correct process after transfers | 651 // pages, since those do not end up in the correct process after transfers |
650 // (see https://crbug.com/560511). Instead, the next cross-process navigation | 652 // (see https://crbug.com/560511). Instead, the next cross-process navigation |
651 // or transfer should decide whether to swap as if the net error had not | 653 // or transfer should decide whether to swap as if the net error had not |
652 // occurred. | 654 // occurred. |
653 // TODO(creis): Remove this block and always set the URL once transfers handle | 655 // TODO(creis): Remove this block and always set the URL once transfers handle |
654 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. | 656 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. |
655 if (!params.url_is_unreachable) | 657 if (!params.url_is_unreachable) |
656 render_frame_host->set_last_successful_url(params.url); | 658 render_frame_host->set_last_successful_url(params.url); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1271 if (navigation_handle) | 1273 if (navigation_handle) |
1272 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1274 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1273 | 1275 |
1274 controller_->SetPendingEntry(std::move(entry)); | 1276 controller_->SetPendingEntry(std::move(entry)); |
1275 if (delegate_) | 1277 if (delegate_) |
1276 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1278 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1277 } | 1279 } |
1278 } | 1280 } |
1279 | 1281 |
1280 } // namespace content | 1282 } // namespace content |
OLD | NEW |