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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java

Issue 1579153002: [Offline Pages on the NTP] Mark "file://" URLs as offline-available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline_feature
Patch Set: rebase Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
index 08fef9539566316883599a427a7d84b638069331..0c27b1ffed2d557564a853633950c41695780b80 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -13,6 +13,7 @@ import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
+import android.net.Uri;
import android.os.Build;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@@ -450,9 +451,14 @@ public class NewTabPage
mProfile, mTab.getWebContents(), pageUrl, iconUrl, isLargeIcon, callback);
}
+ private boolean isLocalUrl(String url) {
+ return "file".equals(Uri.parse(url).getScheme());
+ }
+
@Override
public boolean isOfflineAvailable(String pageUrl) {
if (mIsDestroyed || !isNtpOfflinePagesEnabled()) return false;
+ if (isLocalUrl(pageUrl)) return true;
if (mOfflinePageBridge == null) mOfflinePageBridge = new OfflinePageBridge(mProfile);
return mOfflinePageBridge.getPageByOnlineURL(pageUrl) != null;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698