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

Unified Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2800673002: [iOS Reading List] Only allow offline URL when the offline file exists. (Closed)
Patch Set: Update comments Created 3 years, 8 months 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/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 3b33bf054592754095b17443f657a14df97b46b4..e8fb03e09104f6d2962e98d6109c986298266329 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -2970,9 +2970,14 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
- (BOOL)hasControllerForURL:(const GURL&)url {
std::string host(url.host());
+ if (host == kChromeUIOfflineHost) {
+ // Only allow offline URL that are fully specified.
+ return reading_list::IsOfflineURLValid(
+ url, ReadingListModelFactory::GetForBrowserState(_browserState));
+ }
return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost ||
- host == kChromeUITermsHost || host == kChromeUIOfflineHost;
+ host == kChromeUITermsHost;
}
- (id<CRWNativeContent>)controllerForURL:(const GURL&)url
@@ -3025,7 +3030,8 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
[self setOverScrollActionControllerToStaticNativeContent:
staticNativeController];
nativeController = staticNativeController;
- } else if (url_host == kChromeUIOfflineHost) {
+ } else if (url_host == kChromeUIOfflineHost &&
+ [self hasControllerForURL:url]) {
StaticHtmlNativeContent* staticNativeController =
[[[OfflinePageNativeContent alloc] initWithLoader:self
browserState:_browserState

Powered by Google App Engine
This is Rietveld 408576698