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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java

Issue 2838773002: Move offline related functions from Tab to OfflinePageUtils (Closed)
Patch Set: Fix tests 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: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
index c73a50882369eb3302a88bb0ab1ab7661389af6d..8c09c2a4d51bd8ba7455415f6c40af00fd05c976 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
@@ -19,6 +19,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.annotation.Nullable;
+
/**
* Access gate to C++ side offline pages functionalities.
*/
@@ -468,6 +470,25 @@ public class OfflinePageBridge {
nativeScheduleDownload(mNativeOfflinePageBridge, webContents, nameSpace, url, uiAction);
}
+ /**
+ * Checks if an offline page is shown for the webContents.
+ * @param webContents Web contents used to find the offline page.
+ * @return True if the offline page is opened.
+ */
+ public boolean isOfflinePage(WebContents webContents) {
+ return nativeIsOfflinePage(mNativeOfflinePageBridge, webContents);
+ }
+
+ /**
+ * Retrieves the offline page that is shown for the tab.
+ * @param webContents Web contents used to find the offline page.
+ * @return The offline page if tab currently displays it, null otherwise.
+ */
+ @Nullable
+ public OfflinePageItem getOfflinePage(WebContents webContents) {
+ return nativeGetOfflinePage(mNativeOfflinePageBridge, webContents);
+ }
+
@VisibleForTesting
static void setOfflineBookmarksEnabledForTesting(boolean enabled) {
sOfflineBookmarksEnabled = enabled;
@@ -573,4 +594,8 @@ public class OfflinePageBridge {
long nativeOfflinePageBridge, WebContents webContents);
private native void nativeScheduleDownload(long nativeOfflinePageBridge,
WebContents webContents, String nameSpace, String url, int uiAction);
+ private native boolean nativeIsOfflinePage(
+ long nativeOfflinePageBridge, WebContents webContents);
+ private native OfflinePageItem nativeGetOfflinePage(
+ long nativeOfflinePageBridge, WebContents webContents);
}

Powered by Google App Engine
This is Rietveld 408576698