Commit 8ed28acc authored by Danyao Wang's avatar Danyao Wang Committed by Commit Bot

[Nav Experiment] Set virtual URL for restore session URL.

This removes flicker in Omnibox that briefly exposes the internal URL
when restoring session history. Virtual URL must be set on the pending
item before calling |loadCurrentURLInWebView| because
WebStateObserver::DidStartLoading event fires during this call, which
triggers ToolbarModelDelegateIOS to update itself using the virtual
URL of the pending item.

Bug: 815248
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I260e251d90ad832120b908a61843fe30df261be3
Reviewed-on: https://chromium-review.googlesource.com/1003252
Commit-Queue: Danyao Wang <danyao@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550184}
parent 48bc72d1
...@@ -267,6 +267,9 @@ void NavigationManagerImpl::LoadURLWithParams( ...@@ -267,6 +267,9 @@ void NavigationManagerImpl::LoadURLWithParams(
last_committed_url.EqualsIgnoringRef(pending_url)) { last_committed_url.EqualsIgnoringRef(pending_url)) {
pending_item->SetIsCreatedFromHashChange(true); pending_item->SetIsCreatedFromHashChange(true);
} }
if (params.virtual_url.is_valid())
pending_item->SetVirtualURL(params.virtual_url);
} }
// Add additional headers to the NavigationItem before loading it in the web // Add additional headers to the NavigationItem before loading it in the web
......
...@@ -446,10 +446,11 @@ void WKBasedNavigationManagerImpl::Restore( ...@@ -446,10 +446,11 @@ void WKBasedNavigationManagerImpl::Restore(
// For now, use RELOAD because restoring history is kind of like a reload of // For now, use RELOAD because restoring history is kind of like a reload of
// the current page. // the current page.
params.transition_type = ui::PAGE_TRANSITION_RELOAD; params.transition_type = ui::PAGE_TRANSITION_RELOAD;
LoadURLWithParams(params);
// This pending item will become the first item in the restored history. // This pending item will become the first item in the restored history.
GetPendingItemImpl()->SetVirtualURL(items[0]->GetVirtualURL()); params.virtual_url = items[0]->GetVirtualURL();
LoadURLWithParams(params);
} }
void WKBasedNavigationManagerImpl::LoadIfNecessary() { void WKBasedNavigationManagerImpl::LoadIfNecessary() {
......
...@@ -51,6 +51,9 @@ class NavigationManager { ...@@ -51,6 +51,9 @@ class NavigationManager {
// The URL to load. Must be set. // The URL to load. Must be set.
GURL url; GURL url;
// The URL to display in Omnibox. If empty, |url| will be displayed.
GURL virtual_url;
// The referrer for the load. May be empty. // The referrer for the load. May be empty.
Referrer referrer; Referrer referrer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment