Index: ios/web/web_state/ui/crw_web_controller.mm |
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm |
index ca23114424b25110cd961183512fc18ee9f53b60..1bc7e98233a3f3d07e66d71c0aface89b0da87e7 100644 |
--- a/ios/web/web_state/ui/crw_web_controller.mm |
+++ b/ios/web/web_state/ui/crw_web_controller.mm |
@@ -3476,6 +3476,26 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
return YES; |
} |
+- (void)displayOfflineVersionForURL:(const GURL&)URL { |
+ if ([_nativeProvider hasControllerForURL:URL]) { |
+ id<CRWNativeContent> controller = [_nativeProvider controllerForURL:URL]; |
+ web::NavigationItem* item = |
+ self.webState->GetNavigationManager()->GetItemAtIndex( |
+ self.webState->GetNavigationManager()->GetCurrentItemIndex()); |
+ // Allows the native content to set the displayed URL. |
+ if (item) { |
+ item->SetURL([controller url]); |
+ if ([controller respondsToSelector:@selector(virtualURL)]) { |
+ item->SetVirtualURL([controller virtualURL]); |
+ } |
+ } |
+ [self loadCompleteWithSuccess:NO]; |
+ [self removeWebViewAllowingCachedReconstruction:NO]; |
+ [self setNativeController:controller]; |
+ [self loadNativeViewWithSuccess:YES]; |
+ } |
+} |
+ |
- (void)handleLoadError:(NSError*)error inMainFrame:(BOOL)inMainFrame { |
NSString* MIMEType = [_pendingNavigationInfo MIMEType]; |
if ([_passKitDownloader isMIMETypePassKitType:MIMEType]) |