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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Fix trybot Created 4 years, 4 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/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 b36430795a25752004fbbcda18d393d7e846b610..087d35928e5650851d4be93b393317ac880e4a96 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,12 +283,12 @@ public class OfflinePageUtils {
* @param callback Optional callback to be called when user makes a choice. Will not be called
* if receiving a response when the user makes a choice is not supported (see
* TargetChosenReceiver#isSupported()).
- * @param currentTab Tab that is used to access offlineUrl and tile.
+ * @param currentTab The current tab for which sharing is being done.
*/
public static void shareOfflinePage(final boolean shareDirectly, final boolean saveLastUsed,
final Activity mainActivity, final String text, final String onlineUrl,
final Bitmap bitmap, final ShareHelper.TargetChosenCallback callback,
- final Tab currentTab, boolean isOfflinePage) {
+ final Tab currentTab) {
final String offlineUrl = currentTab.getUrl();
final String title = currentTab.getTitle();
final OfflinePageBridge offlinePageBridge =
@@ -299,21 +299,20 @@ public class OfflinePageUtils {
return;
}
- Callback<OfflinePageItem> prepareForSharing = onGotOfflinePageItemToShare(shareDirectly,
- saveLastUsed, mainActivity, title, text, onlineUrl, bitmap, callback);
-
- if (isOfflinePage) {
+ OfflinePageItem offlinePage = currentTab.getOfflinePage();
+ if (offlinePage != null) {
// If we're currently on offline page get the saved file directly.
- offlinePageBridge.getPageByOfflineUrl(offlineUrl, prepareForSharing);
+ prepareFileAndShare(shareDirectly, saveLastUsed, mainActivity, title, text,
+ onlineUrl, bitmap, callback, offlinePage.getFilePath());
return;
}
// If this is an online page, share the offline copy of it.
- WebContents webContents = currentTab.getWebContents();
- int tabId = currentTab.getId();
-
- offlinePageBridge.selectPageForOnlineUrl(onlineUrl, tabId,
- selectPageForOnlineUrlCallback(webContents, offlinePageBridge, prepareForSharing));
+ Callback<OfflinePageItem> prepareForSharing = onGotOfflinePageItemToShare(shareDirectly,
+ saveLastUsed, mainActivity, title, text, onlineUrl, bitmap, callback);
+ offlinePageBridge.selectPageForOnlineUrl(onlineUrl, currentTab.getId(),
+ selectPageForOnlineUrlCallback(currentTab.getWebContents(), offlinePageBridge,
+ prepareForSharing));
}
/**

Powered by Google App Engine
This is Rietveld 408576698