| 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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 // Load the current URL in a native controller, retrieved from the native | 1879 // Load the current URL in a native controller, retrieved from the native |
| 1880 // provider. Call |loadNativeViewWithSuccess:YES| to load the native controller. | 1880 // provider. Call |loadNativeViewWithSuccess:YES| to load the native controller. |
| 1881 - (void)loadCurrentURLInNativeView { | 1881 - (void)loadCurrentURLInNativeView { |
| 1882 // Free the web view. | 1882 // Free the web view. |
| 1883 [self removeWebViewAllowingCachedReconstruction:NO]; | 1883 [self removeWebViewAllowingCachedReconstruction:NO]; |
| 1884 | 1884 |
| 1885 web::NavigationItem* item = [self currentNavItem]; | 1885 web::NavigationItem* item = [self currentNavItem]; |
| 1886 const GURL targetURL = item ? item->GetURL() : GURL::EmptyGURL(); | 1886 const GURL targetURL = item ? item->GetURL() : GURL::EmptyGURL(); |
| 1887 const web::Referrer referrer; | 1887 const web::Referrer referrer; |
| 1888 id<CRWNativeContent> nativeContent = | 1888 id<CRWNativeContent> nativeContent = |
| 1889 [_nativeProvider controllerForURL:targetURL]; | 1889 [_nativeProvider controllerForURL:targetURL webState:self.webState]; |
| 1890 // Unlike the WebView case, always create a new controller and view. | 1890 // Unlike the WebView case, always create a new controller and view. |
| 1891 // TODO(pinkerton): What to do if this does return nil? | 1891 // TODO(pinkerton): What to do if this does return nil? |
| 1892 [self setNativeController:nativeContent]; | 1892 [self setNativeController:nativeContent]; |
| 1893 if ([nativeContent respondsToSelector:@selector(virtualURL)]) { | 1893 if ([nativeContent respondsToSelector:@selector(virtualURL)]) { |
| 1894 item->SetVirtualURL([nativeContent virtualURL]); | 1894 item->SetVirtualURL([nativeContent virtualURL]); |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 [self registerLoadRequest:targetURL | 1897 [self registerLoadRequest:targetURL |
| 1898 referrer:referrer | 1898 referrer:referrer |
| 1899 transition:[self currentTransition]]; | 1899 transition:[self currentTransition]]; |
| (...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5449 } | 5449 } |
| 5450 | 5450 |
| 5451 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5451 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5452 } | 5452 } |
| 5453 | 5453 |
| 5454 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5454 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5455 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5455 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5456 } | 5456 } |
| 5457 | 5457 |
| 5458 @end | 5458 @end |
| OLD | NEW |