| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #import "ios/web/web_state/js/crw_js_window_id_manager.h" | 84 #import "ios/web/web_state/js/crw_js_window_id_manager.h" |
| 85 #import "ios/web/web_state/navigation_context_impl.h" | 85 #import "ios/web/web_state/navigation_context_impl.h" |
| 86 #import "ios/web/web_state/page_viewport_state.h" | 86 #import "ios/web/web_state/page_viewport_state.h" |
| 87 #import "ios/web/web_state/ui/crw_context_menu_controller.h" | 87 #import "ios/web/web_state/ui/crw_context_menu_controller.h" |
| 88 #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" | 88 #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" |
| 89 #import "ios/web/web_state/ui/crw_web_controller.h" | 89 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 90 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" | 90 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" |
| 91 #import "ios/web/web_state/ui/crw_web_view_proxy_impl.h" | 91 #import "ios/web/web_state/ui/crw_web_view_proxy_impl.h" |
| 92 #import "ios/web/web_state/ui/crw_wk_navigation_states.h" | 92 #import "ios/web/web_state/ui/crw_wk_navigation_states.h" |
| 93 #import "ios/web/web_state/ui/crw_wk_script_message_router.h" | 93 #import "ios/web/web_state/ui/crw_wk_script_message_router.h" |
| 94 #import "ios/web/web_state/ui/web_view_navigation_proxy_impl.h" |
| 94 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" | 95 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" |
| 95 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" | 96 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" |
| 96 #import "ios/web/web_state/web_controller_observer_bridge.h" | 97 #import "ios/web/web_state/web_controller_observer_bridge.h" |
| 97 #import "ios/web/web_state/web_state_impl.h" | 98 #import "ios/web/web_state/web_state_impl.h" |
| 98 #import "ios/web/web_state/web_view_internal_creation_util.h" | 99 #import "ios/web/web_state/web_view_internal_creation_util.h" |
| 99 #import "ios/web/web_state/wk_web_view_security_util.h" | 100 #import "ios/web/web_state/wk_web_view_security_util.h" |
| 100 #import "ios/web/webui/crw_web_ui_manager.h" | 101 #import "ios/web/webui/crw_web_ui_manager.h" |
| 101 #import "ios/web/webui/mojo_facade.h" | 102 #import "ios/web/webui/mojo_facade.h" |
| 102 #import "net/base/mac/url_conversions.h" | 103 #import "net/base/mac/url_conversions.h" |
| 103 #include "net/base/net_errors.h" | 104 #include "net/base/net_errors.h" |
| (...skipping 156 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 |