Chromium Code Reviews| 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 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 | 2283 |
| 2284 DCHECK(_webView); | 2284 DCHECK(_webView); |
| 2285 | 2285 |
| 2286 const GURL currentURL([self currentURL]); | 2286 const GURL currentURL([self currentURL]); |
| 2287 | 2287 |
| 2288 _loadPhase = web::PAGE_LOADED; | 2288 _loadPhase = web::PAGE_LOADED; |
| 2289 | 2289 |
| 2290 [self optOutScrollsToTopForSubviews]; | 2290 [self optOutScrollsToTopForSubviews]; |
| 2291 | 2291 |
| 2292 // Ensure the URL is as expected (and already reported to the delegate). | 2292 // Ensure the URL is as expected (and already reported to the delegate). |
| 2293 DCHECK(currentURL == _lastRegisteredRequestURL) | 2293 // If |_lastRegisteredRequestURL| is invalid then |currentURL| will be |
| 2294 // "about:blank". | |
| 2295 DCHECK((currentURL == _lastRegisteredRequestURL) || | |
| 2296 (!_lastRegisteredRequestURL.is_valid() && | |
| 2297 _documentURL.spec() == url::kAboutBlankURL)) | |
| 2294 << std::endl | 2298 << std::endl |
| 2295 << "currentURL = [" << currentURL << "]" << std::endl | 2299 << "currentURL = [" << currentURL << "]" << std::endl |
| 2296 << "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]"; | 2300 << "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]"; |
| 2297 | 2301 |
| 2298 // Perform post-load-finished updates. | 2302 // Perform post-load-finished updates. |
| 2299 [self didFinishWithURL:currentURL loadSuccess:loadSuccess]; | 2303 [self didFinishWithURL:currentURL loadSuccess:loadSuccess]; |
| 2300 | 2304 |
| 2301 // Execute the pending LoadCompleteActions. | 2305 // Execute the pending LoadCompleteActions. |
| 2302 for (ProceduralBlock action in _pendingLoadCompleteActions.get()) { | 2306 for (ProceduralBlock action in _pendingLoadCompleteActions.get()) { |
| 2303 action(); | 2307 action(); |
| (...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5088 DCHECK_EQ(_webView, webView); | 5092 DCHECK_EQ(_webView, webView); |
| 5089 _certVerificationErrors->Clear(); | 5093 _certVerificationErrors->Clear(); |
| 5090 // This point should closely approximate the document object change, so reset | 5094 // This point should closely approximate the document object change, so reset |
| 5091 // the list of injected scripts to those that are automatically injected. | 5095 // the list of injected scripts to those that are automatically injected. |
| 5092 _injectedScriptManagers.reset([[NSMutableSet alloc] init]); | 5096 _injectedScriptManagers.reset([[NSMutableSet alloc] init]); |
| 5093 [self injectWindowID]; | 5097 [self injectWindowID]; |
| 5094 | 5098 |
| 5095 // This is the point where the document's URL has actually changed, and | 5099 // This is the point where the document's URL has actually changed, and |
| 5096 // pending navigation information should be applied to state information. | 5100 // pending navigation information should be applied to state information. |
| 5097 [self setDocumentURL:net::GURLWithNSURL([_webView URL])]; | 5101 [self setDocumentURL:net::GURLWithNSURL([_webView URL])]; |
| 5098 DCHECK(_documentURL == _lastRegisteredRequestURL); | 5102 |
| 5103 if (!_lastRegisteredRequestURL.is_valid() && | |
| 5104 _documentURL != _lastRegisteredRequestURL) { | |
| 5105 // if |_lastRegisteredRequestURL| is an invalid URL, then |_documentURL| | |
| 5106 // will be "about:blank". | |
|
kkhorimoto
2016/06/22 22:20:54
Should we add a DCHECK to ensure that it's about:b
Eugene But (OOO till 7-30)
2016/06/22 22:48:25
1.) DCHECK below covers that case.
2) I don't thin
kkhorimoto
2016/06/23 23:06:22
Yeah, I checked it out and it looks like all clien
| |
| 5107 [[self sessionController] updatePendingEntry:_documentURL]; | |
| 5108 } | |
| 5109 DCHECK(_documentURL == _lastRegisteredRequestURL || | |
| 5110 (!_lastRegisteredRequestURL.is_valid() && | |
| 5111 _documentURL.spec() == url::kAboutBlankURL)); | |
| 5112 | |
| 5099 self.webStateImpl->OnNavigationCommitted(_documentURL); | 5113 self.webStateImpl->OnNavigationCommitted(_documentURL); |
| 5100 [self commitPendingNavigationInfo]; | 5114 [self commitPendingNavigationInfo]; |
| 5101 if ([self currentBackForwardListItemHolder]->navigation_type() == | 5115 if ([self currentBackForwardListItemHolder]->navigation_type() == |
| 5102 WKNavigationTypeBackForward) { | 5116 WKNavigationTypeBackForward) { |
| 5103 // A fast back/forward won't call decidePolicyForNavigationResponse, so | 5117 // A fast back/forward won't call decidePolicyForNavigationResponse, so |
| 5104 // the MIME type needs to be updated explicitly. | 5118 // the MIME type needs to be updated explicitly. |
| 5105 NSString* storedMIMEType = | 5119 NSString* storedMIMEType = |
| 5106 [self currentBackForwardListItemHolder]->mime_type(); | 5120 [self currentBackForwardListItemHolder]->mime_type(); |
| 5107 if (storedMIMEType) { | 5121 if (storedMIMEType) { |
| 5108 self.webStateImpl->SetContentsMimeType( | 5122 self.webStateImpl->SetContentsMimeType( |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5592 } | 5606 } |
| 5593 | 5607 |
| 5594 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5608 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5595 } | 5609 } |
| 5596 | 5610 |
| 5597 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5611 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5598 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5612 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5599 } | 5613 } |
| 5600 | 5614 |
| 5601 @end | 5615 @end |
| OLD | NEW |