| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 return web::Referrer(GURL(base::SysNSStringToUTF8(referrerString)), | 1303 return web::Referrer(GURL(base::SysNSStringToUTF8(referrerString)), |
| 1304 web::ReferrerPolicyAlways); | 1304 web::ReferrerPolicyAlways); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 - (void)pushStateWithPageURL:(const GURL&)pageURL | 1307 - (void)pushStateWithPageURL:(const GURL&)pageURL |
| 1308 stateObject:(NSString*)stateObject | 1308 stateObject:(NSString*)stateObject |
| 1309 transition:(ui::PageTransition)transition { | 1309 transition:(ui::PageTransition)transition { |
| 1310 [[self sessionController] pushNewItemWithURL:pageURL | 1310 [[self sessionController] pushNewItemWithURL:pageURL |
| 1311 stateObject:stateObject | 1311 stateObject:stateObject |
| 1312 transition:transition]; | 1312 transition:transition]; |
| 1313 _webStateImpl->OnSamePageNavigation(pageURL); | 1313 _webStateImpl->OnSameDocumentNavigation(pageURL); |
| 1314 self.userInteractionRegistered = NO; | 1314 self.userInteractionRegistered = NO; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 - (void)replaceStateWithPageURL:(const GURL&)pageURL | 1317 - (void)replaceStateWithPageURL:(const GURL&)pageURL |
| 1318 stateObject:(NSString*)stateObject { | 1318 stateObject:(NSString*)stateObject { |
| 1319 [[self sessionController] updateCurrentItemWithURL:pageURL | 1319 [[self sessionController] updateCurrentItemWithURL:pageURL |
| 1320 stateObject:stateObject]; | 1320 stateObject:stateObject]; |
| 1321 _webStateImpl->OnSamePageNavigation(pageURL); | 1321 _webStateImpl->OnSameDocumentNavigation(pageURL); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 - (void)setDocumentURL:(const GURL&)newURL { | 1324 - (void)setDocumentURL:(const GURL&)newURL { |
| 1325 if (newURL != _documentURL && newURL.is_valid()) { | 1325 if (newURL != _documentURL && newURL.is_valid()) { |
| 1326 _documentURL = newURL; | 1326 _documentURL = newURL; |
| 1327 _interactionRegisteredSinceLastURLChange = NO; | 1327 _interactionRegisteredSinceLastURLChange = NO; |
| 1328 } | 1328 } |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 - (void)setNavigationItemTitle:(NSString*)title { | 1331 - (void)setNavigationItemTitle:(NSString*)title { |
| (...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4725 | 4725 |
| 4726 if (!navigationWasCommitted && ![_pendingNavigationInfo cancelled]) { | 4726 if (!navigationWasCommitted && ![_pendingNavigationInfo cancelled]) { |
| 4727 // A fast back/forward within the same origin does not call | 4727 // A fast back/forward within the same origin does not call |
| 4728 // |didCommitNavigation:|, so signal page change explicitly. | 4728 // |didCommitNavigation:|, so signal page change explicitly. |
| 4729 DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin()); | 4729 DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin()); |
| 4730 BOOL isSameDocumentNavigation = | 4730 BOOL isSameDocumentNavigation = |
| 4731 [self isKVOChangePotentialSameDocumentNavigationToURL:webViewURL]; | 4731 [self isKVOChangePotentialSameDocumentNavigationToURL:webViewURL]; |
| 4732 [self setDocumentURL:webViewURL]; | 4732 [self setDocumentURL:webViewURL]; |
| 4733 [self webPageChanged]; | 4733 [self webPageChanged]; |
| 4734 if (isSameDocumentNavigation) { | 4734 if (isSameDocumentNavigation) { |
| 4735 _webStateImpl->OnSamePageNavigation(webViewURL); | 4735 _webStateImpl->OnSameDocumentNavigation(webViewURL); |
| 4736 } else { | 4736 } else { |
| 4737 _webStateImpl->OnNavigationCommitted(webViewURL); | 4737 _webStateImpl->OnNavigationCommitted(webViewURL); |
| 4738 } | 4738 } |
| 4739 } | 4739 } |
| 4740 | 4740 |
| 4741 [self updateSSLStatusForCurrentNavigationItem]; | 4741 [self updateSSLStatusForCurrentNavigationItem]; |
| 4742 | 4742 |
| 4743 // Fast back forward navigation may not call |didFinishNavigation:|, so | 4743 // Fast back forward navigation may not call |didFinishNavigation:|, so |
| 4744 // signal did finish navigation explicitly. | 4744 // signal did finish navigation explicitly. |
| 4745 if (_lastRegisteredRequestURL == _documentURL) { | 4745 if (_lastRegisteredRequestURL == _documentURL) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 // If this wasn't a previously-expected load (e.g., certain back/forward | 4881 // If this wasn't a previously-expected load (e.g., certain back/forward |
| 4882 // navigations), register the load request. | 4882 // navigations), register the load request. |
| 4883 if (![self isLoadRequestPendingForURL:newURL]) | 4883 if (![self isLoadRequestPendingForURL:newURL]) |
| 4884 [self registerLoadRequest:newURL]; | 4884 [self registerLoadRequest:newURL]; |
| 4885 } | 4885 } |
| 4886 | 4886 |
| 4887 [self setDocumentURL:newURL]; | 4887 [self setDocumentURL:newURL]; |
| 4888 | 4888 |
| 4889 if (!_changingHistoryState) { | 4889 if (!_changingHistoryState) { |
| 4890 [self didStartLoadingURL:_documentURL]; | 4890 [self didStartLoadingURL:_documentURL]; |
| 4891 _webStateImpl->OnSamePageNavigation(newURL); | 4891 _webStateImpl->OnSameDocumentNavigation(newURL); |
| 4892 [self updateSSLStatusForCurrentNavigationItem]; | 4892 [self updateSSLStatusForCurrentNavigationItem]; |
| 4893 [self didFinishNavigation]; | 4893 [self didFinishNavigation]; |
| 4894 } | 4894 } |
| 4895 } | 4895 } |
| 4896 | 4896 |
| 4897 - (BOOL)isLoadRequestPendingForURL:(const GURL&)targetURL { | 4897 - (BOOL)isLoadRequestPendingForURL:(const GURL&)targetURL { |
| 4898 if (self.loadPhase != web::LOAD_REQUESTED) | 4898 if (self.loadPhase != web::LOAD_REQUESTED) |
| 4899 return NO; | 4899 return NO; |
| 4900 | 4900 |
| 4901 web::NavigationItem* pendingItem = | 4901 web::NavigationItem* pendingItem = |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5071 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5071 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5072 _lastRegisteredRequestURL = URL; | 5072 _lastRegisteredRequestURL = URL; |
| 5073 _loadPhase = web::LOAD_REQUESTED; | 5073 _loadPhase = web::LOAD_REQUESTED; |
| 5074 } | 5074 } |
| 5075 | 5075 |
| 5076 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5076 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5077 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5077 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5078 } | 5078 } |
| 5079 | 5079 |
| 5080 @end | 5080 @end |
| OLD | NEW |