| 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 5020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5031 | 5031 |
| 5032 handler(allowNavigation ? WKNavigationResponsePolicyAllow | 5032 handler(allowNavigation ? WKNavigationResponsePolicyAllow |
| 5033 : WKNavigationResponsePolicyCancel); | 5033 : WKNavigationResponsePolicyCancel); |
| 5034 } | 5034 } |
| 5035 | 5035 |
| 5036 // TODO(stuartmorgan): Move all the guesswork around these states out of the | 5036 // TODO(stuartmorgan): Move all the guesswork around these states out of the |
| 5037 // superclass, and wire these up to the remaining methods. | 5037 // superclass, and wire these up to the remaining methods. |
| 5038 - (void)webView:(WKWebView*)webView | 5038 - (void)webView:(WKWebView*)webView |
| 5039 didStartProvisionalNavigation:(WKNavigation*)navigation { | 5039 didStartProvisionalNavigation:(WKNavigation*)navigation { |
| 5040 GURL webViewURL = net::GURLWithNSURL(webView.URL); | 5040 GURL webViewURL = net::GURLWithNSURL(webView.URL); |
| 5041 if (webViewURL.is_empty() && base::ios::IsRunningOnIOS9OrLater()) { | 5041 if (webViewURL.is_empty()) { |
| 5042 // May happen on iOS9, however in didCommitNavigation: callback the URL | 5042 // May happen on iOS9, however in didCommitNavigation: callback the URL |
| 5043 // will be "about:blank". TODO(eugenebut): File radar for this issue | 5043 // will be "about:blank". |
| 5044 // (crbug.com/523549). | |
| 5045 webViewURL = GURL(url::kAboutBlankURL); | 5044 webViewURL = GURL(url::kAboutBlankURL); |
| 5046 } | 5045 } |
| 5047 | 5046 |
| 5048 // Intercept renderer-initiated navigations. If this navigation has not yet | 5047 // Intercept renderer-initiated navigations. If this navigation has not yet |
| 5049 // been registered, do so. loadPhase check is necessary because | 5048 // been registered, do so. loadPhase check is necessary because |
| 5050 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab | 5049 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab |
| 5051 // created by window.open (default is about::blank). | 5050 // created by window.open (default is about::blank). |
| 5052 if (_lastRegisteredRequestURL != webViewURL || | 5051 if (_lastRegisteredRequestURL != webViewURL || |
| 5053 self.loadPhase != web::LOAD_REQUESTED) { | 5052 self.loadPhase != web::LOAD_REQUESTED) { |
| 5054 // Reset current WebUI if one exists. | 5053 // Reset current WebUI if one exists. |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5649 } | 5648 } |
| 5650 | 5649 |
| 5651 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5650 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5652 } | 5651 } |
| 5653 | 5652 |
| 5654 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5653 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5655 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5654 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5656 } | 5655 } |
| 5657 | 5656 |
| 5658 @end | 5657 @end |
| OLD | NEW |