Commit 11761c9c authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fix NativeContent navigation item commit if StorePendingItemInContext is enabled.

Commit placeholder navigation item if one is available. This CL fixes
NativeContentVirtualURL if StorePendingItemInContext is enabled for
slim-nav.

Bug: 899827
Change-Id: I4f563d67bea1a5aa89e69d6cc3b2bff9415d254e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538555
Auto-Submit: Eugene But <eugenebut@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644426}
parent 47a48894
...@@ -2554,6 +2554,7 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*); ...@@ -2554,6 +2554,7 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
[self removeWebView]; [self removeWebView];
[self presentNativeContentForNavigationItem:self.currentNavItem]; [self presentNativeContentForNavigationItem:self.currentNavItem];
[self didLoadNativeContentForNavigationItem:self.currentNavItem [self didLoadNativeContentForNavigationItem:self.currentNavItem
placeholderContext:nullptr
rendererInitiated:rendererInitiated]; rendererInitiated:rendererInitiated];
} else { } else {
// Just present the native view now. Leave the rest of native content load // Just present the native view now. Leave the rest of native content load
...@@ -2592,7 +2593,10 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*); ...@@ -2592,7 +2593,10 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
// Notifies WebStateObservers the completion of this navigation. // Notifies WebStateObservers the completion of this navigation.
- (void)didLoadNativeContentForNavigationItem:(web::NavigationItemImpl*)item - (void)didLoadNativeContentForNavigationItem:(web::NavigationItemImpl*)item
placeholderContext:
(web::NavigationContextImpl*)placeholderContext
rendererInitiated:(BOOL)rendererInitiated { rendererInitiated:(BOOL)rendererInitiated {
DCHECK(!placeholderContext || placeholderContext->IsPlaceholderNavigation());
const GURL targetURL = item ? item->GetURL() : GURL::EmptyGURL(); const GURL targetURL = item ? item->GetURL() : GURL::EmptyGURL();
const web::Referrer referrer; const web::Referrer referrer;
std::unique_ptr<web::NavigationContextImpl> context = std::unique_ptr<web::NavigationContextImpl> context =
...@@ -2606,7 +2610,13 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*); ...@@ -2606,7 +2610,13 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
self.webStateImpl->OnNavigationStarted(context.get()); self.webStateImpl->OnNavigationStarted(context.get());
[self didStartLoading]; [self didStartLoading];
self.navigationManagerImpl->CommitPendingItem(); if (placeholderContext && placeholderContext->GetItem()) {
DCHECK_EQ(placeholderContext->GetItem(), item);
self.navigationManagerImpl->CommitPendingItem(
placeholderContext->ReleaseItem());
} else {
self.navigationManagerImpl->CommitPendingItem();
}
context->SetHasCommitted(true); context->SetHasCommitted(true);
self.webStateImpl->OnNavigationFinished(context.get()); self.webStateImpl->OnNavigationFinished(context.get());
...@@ -4880,6 +4890,7 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*); ...@@ -4880,6 +4890,7 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
} }
bool rendererInitiated = context->IsRendererInitiated(); bool rendererInitiated = context->IsRendererInitiated();
[self didLoadNativeContentForNavigationItem:item [self didLoadNativeContentForNavigationItem:item
placeholderContext:context
rendererInitiated:rendererInitiated]; rendererInitiated:rendererInitiated];
} else if (_webUIManager) { } else if (_webUIManager) {
[_webUIManager loadWebUIForURL:item->GetURL()]; [_webUIManager loadWebUIForURL:item->GetURL()];
......
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