| 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 27 matching lines...) Expand all Loading... |
| 38 #include "base/time/time.h" | 38 #include "base/time/time.h" |
| 39 #include "base/values.h" | 39 #include "base/values.h" |
| 40 #import "ios/net/http_response_headers_util.h" | 40 #import "ios/net/http_response_headers_util.h" |
| 41 #import "ios/net/nsurlrequest_util.h" | 41 #import "ios/net/nsurlrequest_util.h" |
| 42 #include "ios/web/history_state_util.h" | 42 #include "ios/web/history_state_util.h" |
| 43 #import "ios/web/interstitials/web_interstitial_impl.h" | 43 #import "ios/web/interstitials/web_interstitial_impl.h" |
| 44 #import "ios/web/navigation/crw_session_controller.h" | 44 #import "ios/web/navigation/crw_session_controller.h" |
| 45 #import "ios/web/navigation/navigation_item_impl.h" | 45 #import "ios/web/navigation/navigation_item_impl.h" |
| 46 #import "ios/web/navigation/navigation_manager_impl.h" | 46 #import "ios/web/navigation/navigation_manager_impl.h" |
| 47 #include "ios/web/navigation/navigation_manager_util.h" | 47 #include "ios/web/navigation/navigation_manager_util.h" |
| 48 #import "ios/web/navigation/web_view_navigation_proxy_impl.h" |
| 48 #include "ios/web/net/cert_host_pair.h" | 49 #include "ios/web/net/cert_host_pair.h" |
| 49 #import "ios/web/net/crw_cert_verification_controller.h" | 50 #import "ios/web/net/crw_cert_verification_controller.h" |
| 50 #import "ios/web/net/crw_ssl_status_updater.h" | 51 #import "ios/web/net/crw_ssl_status_updater.h" |
| 51 #include "ios/web/public/browser_state.h" | 52 #include "ios/web/public/browser_state.h" |
| 52 #include "ios/web/public/favicon_url.h" | 53 #include "ios/web/public/favicon_url.h" |
| 53 #import "ios/web/public/java_script_dialog_presenter.h" | 54 #import "ios/web/public/java_script_dialog_presenter.h" |
| 54 #import "ios/web/public/navigation_item.h" | 55 #import "ios/web/public/navigation_item.h" |
| 55 #import "ios/web/public/navigation_manager.h" | 56 #import "ios/web/public/navigation_manager.h" |
| 56 #import "ios/web/public/origin_util.h" | 57 #import "ios/web/public/origin_util.h" |
| 57 #include "ios/web/public/referrer.h" | 58 #include "ios/web/public/referrer.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 CRWSSLStatusUpdaterDelegate, | 261 CRWSSLStatusUpdaterDelegate, |
| 261 CRWWebControllerContainerViewDelegate, | 262 CRWWebControllerContainerViewDelegate, |
| 262 CRWWebViewScrollViewProxyObserver, | 263 CRWWebViewScrollViewProxyObserver, |
| 263 WKNavigationDelegate, | 264 WKNavigationDelegate, |
| 264 WKUIDelegate> { | 265 WKUIDelegate> { |
| 265 base::WeakNSProtocol<id<CRWWebDelegate>> _delegate; | 266 base::WeakNSProtocol<id<CRWWebDelegate>> _delegate; |
| 266 base::WeakNSProtocol<id<CRWNativeContentProvider>> _nativeProvider; | 267 base::WeakNSProtocol<id<CRWNativeContentProvider>> _nativeProvider; |
| 267 base::WeakNSProtocol<id<CRWSwipeRecognizerProvider>> _swipeRecognizerProvider; | 268 base::WeakNSProtocol<id<CRWSwipeRecognizerProvider>> _swipeRecognizerProvider; |
| 268 // The WKWebView managed by this instance. | 269 // The WKWebView managed by this instance. |
| 269 base::scoped_nsobject<WKWebView> _webView; | 270 base::scoped_nsobject<WKWebView> _webView; |
| 271 std::unique_ptr<web::WebViewNavigationProxyImpl> _webViewNavigationProxyImpl; |
| 270 // The CRWWebViewProxy is the wrapper to give components access to the | 272 // The CRWWebViewProxy is the wrapper to give components access to the |
| 271 // web view in a controlled and limited way. | 273 // web view in a controlled and limited way. |
| 272 base::scoped_nsobject<CRWWebViewProxyImpl> _webViewProxy; | 274 base::scoped_nsobject<CRWWebViewProxyImpl> _webViewProxy; |
| 273 // The view used to display content. Must outlive |_webViewProxy|. The | 275 // The view used to display content. Must outlive |_webViewProxy|. The |
| 274 // container view should be accessed through this property rather than | 276 // container view should be accessed through this property rather than |
| 275 // |self.view| from within this class, as |self.view| triggers creation while | 277 // |self.view| from within this class, as |self.view| triggers creation while |
| 276 // |self.containerView| will return nil if the view hasn't been instantiated. | 278 // |self.containerView| will return nil if the view hasn't been instantiated. |
| 277 base::scoped_nsobject<CRWWebControllerContainerView> _containerView; | 279 base::scoped_nsobject<CRWWebControllerContainerView> _containerView; |
| 278 // If |_contentView| contains a native view rather than a web view, this | 280 // If |_contentView| contains a native view rather than a web view, this |
| 279 // is its controller. If it's a web view, this is nil. | 281 // is its controller. If it's a web view, this is nil. |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 _certVerificationController.reset([[CRWCertVerificationController alloc] | 956 _certVerificationController.reset([[CRWCertVerificationController alloc] |
| 955 initWithBrowserState:browserState]); | 957 initWithBrowserState:browserState]); |
| 956 _certVerificationErrors.reset( | 958 _certVerificationErrors.reset( |
| 957 new CertVerificationErrorsCacheType(kMaxCertErrorsCount)); | 959 new CertVerificationErrorsCacheType(kMaxCertErrorsCount)); |
| 958 _navigationStates.reset([[CRWWKNavigationStates alloc] init]); | 960 _navigationStates.reset([[CRWWKNavigationStates alloc] init]); |
| 959 [[NSNotificationCenter defaultCenter] | 961 [[NSNotificationCenter defaultCenter] |
| 960 addObserver:self | 962 addObserver:self |
| 961 selector:@selector(orientationDidChange) | 963 selector:@selector(orientationDidChange) |
| 962 name:UIApplicationDidChangeStatusBarOrientationNotification | 964 name:UIApplicationDidChangeStatusBarOrientationNotification |
| 963 object:nil]; | 965 object:nil]; |
| 966 _webViewNavigationProxyImpl = |
| 967 base::MakeUnique<web::WebViewNavigationProxyImpl>(nullptr); |
| 964 } | 968 } |
| 965 return self; | 969 return self; |
| 966 } | 970 } |
| 967 | 971 |
| 968 - (id<CRWNativeContentProvider>)nativeProvider { | 972 - (id<CRWNativeContentProvider>)nativeProvider { |
| 969 return _nativeProvider.get(); | 973 return _nativeProvider.get(); |
| 970 } | 974 } |
| 971 | 975 |
| 972 - (void)setNativeProvider:(id<CRWNativeContentProvider>)nativeProvider { | 976 - (void)setNativeProvider:(id<CRWNativeContentProvider>)nativeProvider { |
| 973 _nativeProvider.reset(nativeProvider); | 977 _nativeProvider.reset(nativeProvider); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 // necessary; this creates _containerView if it doesn't exist. | 1422 // necessary; this creates _containerView if it doesn't exist. |
| 1419 [self triggerPendingLoad]; | 1423 [self triggerPendingLoad]; |
| 1420 DCHECK(_containerView); | 1424 DCHECK(_containerView); |
| 1421 return _containerView; | 1425 return _containerView; |
| 1422 } | 1426 } |
| 1423 | 1427 |
| 1424 - (id<CRWWebViewProxy>)webViewProxy { | 1428 - (id<CRWWebViewProxy>)webViewProxy { |
| 1425 return _webViewProxy.get(); | 1429 return _webViewProxy.get(); |
| 1426 } | 1430 } |
| 1427 | 1431 |
| 1432 - (web::WebViewNavigationProxy*)webViewNavigationProxy { |
| 1433 _webViewNavigationProxyImpl->SetWebView(_webView); |
| 1434 return _webViewNavigationProxyImpl.get(); |
| 1435 } |
| 1436 |
| 1428 - (UIView*)viewForPrinting { | 1437 - (UIView*)viewForPrinting { |
| 1429 // Printing is not supported for native controllers. | 1438 // Printing is not supported for native controllers. |
| 1430 return _webView; | 1439 return _webView; |
| 1431 } | 1440 } |
| 1432 | 1441 |
| 1433 - (double)loadingProgress { | 1442 - (double)loadingProgress { |
| 1434 return [_webView estimatedProgress]; | 1443 return [_webView estimatedProgress]; |
| 1435 } | 1444 } |
| 1436 | 1445 |
| 1437 - (std::unique_ptr<web::NavigationContextImpl>)registerLoadRequestForURL: | 1446 - (std::unique_ptr<web::NavigationContextImpl>)registerLoadRequestForURL: |
| (...skipping 3763 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 |