| 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 4770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4781 // A fast back navigation caused by pushState does not call | 4781 // A fast back navigation caused by pushState does not call |
| 4782 // |didCommitNavigation:|, so signal page change explicitly. | 4782 // |didCommitNavigation:|, so signal page change explicitly. |
| 4783 // TODO(crbug.com/659816): Because back-forward navigation is disabled for | 4783 // TODO(crbug.com/659816): Because back-forward navigation is disabled for |
| 4784 // pages that used push/replace State API, this code will not be executed. | 4784 // pages that used push/replace State API, this code will not be executed. |
| 4785 DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin()); | 4785 DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin()); |
| 4786 BOOL isSameDocumentNavigation = | 4786 BOOL isSameDocumentNavigation = |
| 4787 [self isKVOChangePotentialSameDocumentNavigationToURL:webViewURL]; | 4787 [self isKVOChangePotentialSameDocumentNavigationToURL:webViewURL]; |
| 4788 [self setDocumentURL:webViewURL]; | 4788 [self setDocumentURL:webViewURL]; |
| 4789 [self webPageChanged]; | 4789 [self webPageChanged]; |
| 4790 | 4790 |
| 4791 web::NavigationContextImpl* context = | 4791 web::NavigationContextImpl* existingContext = |
| 4792 [self contextForPendingNavigationWithURL:webViewURL]; | 4792 [self contextForPendingNavigationWithURL:webViewURL]; |
| 4793 // Same document navigation does not contain response headers. | 4793 if (!existingContext && isSameDocumentNavigation) { |
| 4794 net::HttpResponseHeaders* headers = | 4794 // This is a renderer-initiated same-document navigation, which needs to |
| 4795 isSameDocumentNavigation ? nullptr | 4795 // be registered. |
| 4796 : _webStateImpl->GetHttpResponseHeaders(); | 4796 std::unique_ptr<web::NavigationContextImpl> newContext = |
| 4797 context->SetResponseHeaders(headers); | 4797 [self registerLoadRequestForURL:webViewURL]; |
| 4798 context->SetIsSameDocument(isSameDocumentNavigation); | 4798 newContext->SetIsSameDocument(true); |
| 4799 _webStateImpl->OnNavigationFinished(context); | 4799 _webStateImpl->OnNavigationFinished(newContext.get()); |
| 4800 } else { |
| 4801 // Same document navigation does not contain response headers. |
| 4802 net::HttpResponseHeaders* headers = |
| 4803 isSameDocumentNavigation ? nullptr |
| 4804 : _webStateImpl->GetHttpResponseHeaders(); |
| 4805 existingContext->SetResponseHeaders(headers); |
| 4806 existingContext->SetIsSameDocument(isSameDocumentNavigation); |
| 4807 _webStateImpl->OnNavigationFinished(existingContext); |
| 4808 } |
| 4800 } | 4809 } |
| 4801 | 4810 |
| 4802 [self updateSSLStatusForCurrentNavigationItem]; | 4811 [self updateSSLStatusForCurrentNavigationItem]; |
| 4803 | 4812 |
| 4804 // Fast back forward navigation may not call |didFinishNavigation:|, so | 4813 // Fast back forward navigation may not call |didFinishNavigation:|, so |
| 4805 // signal did finish navigation explicitly. | 4814 // signal did finish navigation explicitly. |
| 4806 if (_lastRegisteredRequestURL == _documentURL) { | 4815 if (_lastRegisteredRequestURL == _documentURL) { |
| 4807 [self didFinishNavigation:nil]; | 4816 [self didFinishNavigation:nil]; |
| 4808 } | 4817 } |
| 4809 } | 4818 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 - (NSUInteger)observerCount { | 5210 - (NSUInteger)observerCount { |
| 5202 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5211 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
| 5203 return [_observers count]; | 5212 return [_observers count]; |
| 5204 } | 5213 } |
| 5205 | 5214 |
| 5206 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5215 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5207 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5216 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5208 } | 5217 } |
| 5209 | 5218 |
| 5210 @end | 5219 @end |
| OLD | NEW |