Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1371)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2578973002: Reload offline version on load failure (Closed)
Patch Set: clean Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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])

Powered by Google App Engine
This is Rietveld 408576698