Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java |
| index 523e226f5f9a217ee39d53c42306ce8f65aa1610..9eb276209a292f1ae6514edd2dd88ff0c42e6ce7 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java |
| @@ -9,6 +9,8 @@ import android.net.ConnectivityManager; |
| import android.net.NetworkInfo; |
| import android.os.Environment; |
| +import org.chromium.base.ApplicationStatus; |
| +import org.chromium.base.PathUtils; |
| import org.chromium.base.metrics.RecordUserAction; |
| import org.chromium.chrome.R; |
| import org.chromium.chrome.browser.ChromeActivity; |
| @@ -114,6 +116,19 @@ public class OfflinePageUtils { |
| } |
| /** |
| + * Check whether the URL qualifies as offline URL for the purpose of storage permission check. |
| + * @param url A URL to check. |
| + * @return <code>true</code> if the URL qualifies as an offline page URL, <code>false</code> |
| + * otherwise. |
| + */ |
| + public static boolean isOfflineUrlForStoragePermissionCheck(String url) { |
| + Context context = ApplicationStatus.getApplicationContext(); |
| + return url != null && context != null |
| + && url.startsWith("file://" + PathUtils.getDataDirectory(context)) |
|
newt (away)
2016/01/04 19:45:05
This seems prone to silent breakage if the locatio
jianli
2016/01/04 21:42:00
The name isOfflineUrlForStoragePermissionCheck sou
fgorski
2016/01/04 23:11:35
This sits inside of the profile folder and I am no
|
| + && url.contains("/Offline%20Pages/archives/") && url.endsWith(".mhtml"); |
| + } |
| + |
| + /** |
| * Shows the snackbar for the current tab to provide offline specific information. |
| * @param activity The activity owning the tab. |
| * @param tabId The ID of current tab. |