| 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 47709b4ecaa56d3c3a03bca1f85c93db9906bb88..39f86dd3b467f3364d3dc87c0b817423f4b4d94c 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
|
| @@ -283,7 +283,7 @@ public class OfflinePageUtils {
|
| return;
|
| }
|
|
|
| - OfflinePageItem offlinePage = currentTab.getOfflinePage();
|
| + OfflinePageItem offlinePage = offlinePageBridge.getOfflinePage(currentTab.getWebContents());
|
| if (offlinePage != null) {
|
| // If we're currently on offline page get the saved file directly.
|
| prepareFileAndShare(shareDirectly, saveLastUsed, mainActivity, title, text,
|
| @@ -564,6 +564,28 @@ public class OfflinePageUtils {
|
| }
|
|
|
| /**
|
| + * Checks if an offline page is shown for the tab.
|
| + * @param tab The tab to be reloaded.
|
| + * @return True if the offline page is opened.
|
| + */
|
| + public static boolean isOfflinePage(Tab tab) {
|
| + OfflinePageBridge offlinePageBridge = getInstance().getOfflinePageBridge(tab.getProfile());
|
| + if (offlinePageBridge == null) return false;
|
| + return offlinePageBridge.isOfflinePage(tab.getWebContents());
|
| + }
|
| +
|
| + /**
|
| + * Retrieves the offline page that is shown for the tab.
|
| + * @param tab The tab to be reloaded.
|
| + * @return The offline page if tab currently displays it, null otherwise.
|
| + */
|
| + public static OfflinePageItem getOfflinePage(Tab tab) {
|
| + OfflinePageBridge offlinePageBridge = getInstance().getOfflinePageBridge(tab.getProfile());
|
| + if (offlinePageBridge == null) return null;
|
| + return offlinePageBridge.getOfflinePage(tab.getWebContents());
|
| + }
|
| +
|
| + /**
|
| * Reloads specified tab, which should allow to open an online version of the page.
|
| * @param tab The tab to be reloaded.
|
| */
|
| @@ -698,7 +720,7 @@ public class OfflinePageUtils {
|
| // We first compute the bitwise tab restore context.
|
| int tabRestoreContext = 0;
|
| if (isConnected()) tabRestoreContext |= BIT_ONLINE;
|
| - OfflinePageItem page = tab.getOfflinePage();
|
| + OfflinePageItem page = getOfflinePage(tab);
|
| if (page != null) {
|
| tabRestoreContext |= BIT_OFFLINE_PAGE;
|
| if (page.getClientId().getNamespace().equals(OfflinePageBridge.LAST_N_NAMESPACE)) {
|
|
|