Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2698413004: Implemented WebStateObserver::DidFinishNavigation(NavigationHandle*). (Closed)
Patch Set: Self review Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index aff3c438794cd324c3227074480020cf417b8fca..f07392547737b7124edf114cf4cb32668a24ef00 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1815,6 +1815,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
const GURL currentURL([self currentURL]);
[self didStartLoadingURL:currentURL updateHistory:loadSuccess];
_loadPhase = web::PAGE_LOADED;
+ if (!loadSuccess) {
+ _webStateImpl->OnErrorPageNavigation(currentURL);
+ } else {
+ _webStateImpl->OnNavigationCommitted(currentURL);
+ }
// Perform post-load-finished updates.
[self didFinishWithURL:currentURL loadSuccess:loadSuccess];
@@ -4108,6 +4113,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (void)didUpdateHistoryStateWithPageURL:(const GURL&)url {
+ _webStateImpl->OnSamePageNavigation(url);
[_delegate webDidUpdateHistoryStateWithPageURL:url];
}
@@ -4980,7 +4986,14 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// A fast back/forward within the same origin does not call
// |didCommitNavigation:|, so signal page change explicitly.
DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin());
+ BOOL isSameDocumentNavigaiton =
+ [self isKVOChangePotentialSameDocumentNavigationToURL:webViewURL];
[self setDocumentURL:webViewURL];
+ if (!isSameDocumentNavigaiton) {
kkhorimoto 2017/02/22 01:42:38 Let's reverse the ordering of these conditions so
Eugene But (OOO till 7-30) 2017/02/22 17:54:33 Done.
+ _webStateImpl->OnNavigationCommitted(webViewURL);
+ } else {
+ _webStateImpl->OnSamePageNavigation(webViewURL);
+ }
[self webPageChanged];
}
@@ -5087,7 +5100,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (BOOL)isKVOChangePotentialSameDocumentNavigationToURL:(const GURL&)newURL {
- DCHECK([_webView isLoading]);
// If the origin changes, it can't be same-document.
if (_documentURL.GetOrigin().is_empty() ||
_documentURL.GetOrigin() != newURL.GetOrigin()) {
@@ -5135,6 +5147,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
if (!_changingHistoryState) {
[self didStartLoadingURL:_documentURL updateHistory:YES];
+ _webStateImpl->OnSamePageNavigation(newURL);
[self updateSSLStatusForCurrentNavigationItem];
[self didFinishNavigation];
}

Powered by Google App Engine
This is Rietveld 408576698