| 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 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 | 2268 |
| 2269 DCHECK(_webView); | 2269 DCHECK(_webView); |
| 2270 | 2270 |
| 2271 const GURL currentURL([self currentURL]); | 2271 const GURL currentURL([self currentURL]); |
| 2272 | 2272 |
| 2273 _loadPhase = web::PAGE_LOADED; | 2273 _loadPhase = web::PAGE_LOADED; |
| 2274 | 2274 |
| 2275 [self optOutScrollsToTopForSubviews]; | 2275 [self optOutScrollsToTopForSubviews]; |
| 2276 | 2276 |
| 2277 // Ensure the URL is as expected (and already reported to the delegate). | 2277 // Ensure the URL is as expected (and already reported to the delegate). |
| 2278 DCHECK(currentURL == _lastRegisteredRequestURL) | 2278 // If |_lastRegisteredRequestURL| is invalid then |currentURL| will be |
| 2279 // "about:blank". |
| 2280 DCHECK((currentURL == _lastRegisteredRequestURL) || |
| 2281 (!_lastRegisteredRequestURL.is_valid() && |
| 2282 _documentURL.spec() == url::kAboutBlankURL)) |
| 2279 << std::endl | 2283 << std::endl |
| 2280 << "currentURL = [" << currentURL << "]" << std::endl | 2284 << "currentURL = [" << currentURL << "]" << std::endl |
| 2281 << "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]"; | 2285 << "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]"; |
| 2282 | 2286 |
| 2283 // Perform post-load-finished updates. | 2287 // Perform post-load-finished updates. |
| 2284 [self didFinishWithURL:currentURL loadSuccess:loadSuccess]; | 2288 [self didFinishWithURL:currentURL loadSuccess:loadSuccess]; |
| 2285 | 2289 |
| 2286 // Execute the pending LoadCompleteActions. | 2290 // Execute the pending LoadCompleteActions. |
| 2287 for (ProceduralBlock action in _pendingLoadCompleteActions.get()) { | 2291 for (ProceduralBlock action in _pendingLoadCompleteActions.get()) { |
| 2288 action(); | 2292 action(); |
| (...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5047 DCHECK_EQ(_webView, webView); | 5051 DCHECK_EQ(_webView, webView); |
| 5048 _certVerificationErrors->Clear(); | 5052 _certVerificationErrors->Clear(); |
| 5049 // This point should closely approximate the document object change, so reset | 5053 // This point should closely approximate the document object change, so reset |
| 5050 // the list of injected scripts to those that are automatically injected. | 5054 // the list of injected scripts to those that are automatically injected. |
| 5051 _injectedScriptManagers.reset([[NSMutableSet alloc] init]); | 5055 _injectedScriptManagers.reset([[NSMutableSet alloc] init]); |
| 5052 [self injectWindowID]; | 5056 [self injectWindowID]; |
| 5053 | 5057 |
| 5054 // This is the point where the document's URL has actually changed, and | 5058 // This is the point where the document's URL has actually changed, and |
| 5055 // pending navigation information should be applied to state information. | 5059 // pending navigation information should be applied to state information. |
| 5056 [self setDocumentURL:net::GURLWithNSURL([_webView URL])]; | 5060 [self setDocumentURL:net::GURLWithNSURL([_webView URL])]; |
| 5057 DCHECK(_documentURL == _lastRegisteredRequestURL); | 5061 |
| 5062 if (!_lastRegisteredRequestURL.is_valid() && |
| 5063 _documentURL != _lastRegisteredRequestURL) { |
| 5064 // if |_lastRegisteredRequestURL| is an invalid URL, then |_documentURL| |
| 5065 // will be "about:blank". |
| 5066 [[self sessionController] updatePendingEntry:_documentURL]; |
| 5067 } |
| 5068 DCHECK(_documentURL == _lastRegisteredRequestURL || |
| 5069 (!_lastRegisteredRequestURL.is_valid() && |
| 5070 _documentURL.spec() == url::kAboutBlankURL)); |
| 5071 |
| 5058 self.webStateImpl->OnNavigationCommitted(_documentURL); | 5072 self.webStateImpl->OnNavigationCommitted(_documentURL); |
| 5059 [self commitPendingNavigationInfo]; | 5073 [self commitPendingNavigationInfo]; |
| 5060 if ([self currentBackForwardListItemHolder]->navigation_type() == | 5074 if ([self currentBackForwardListItemHolder]->navigation_type() == |
| 5061 WKNavigationTypeBackForward) { | 5075 WKNavigationTypeBackForward) { |
| 5062 // A fast back/forward won't call decidePolicyForNavigationResponse, so | 5076 // A fast back/forward won't call decidePolicyForNavigationResponse, so |
| 5063 // the MIME type needs to be updated explicitly. | 5077 // the MIME type needs to be updated explicitly. |
| 5064 NSString* storedMIMEType = | 5078 NSString* storedMIMEType = |
| 5065 [self currentBackForwardListItemHolder]->mime_type(); | 5079 [self currentBackForwardListItemHolder]->mime_type(); |
| 5066 if (storedMIMEType) { | 5080 if (storedMIMEType) { |
| 5067 self.webStateImpl->SetContentsMimeType( | 5081 self.webStateImpl->SetContentsMimeType( |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5551 } | 5565 } |
| 5552 | 5566 |
| 5553 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5567 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5554 } | 5568 } |
| 5555 | 5569 |
| 5556 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5570 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5557 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5571 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5558 } | 5572 } |
| 5559 | 5573 |
| 5560 @end | 5574 @end |
| OLD | NEW |