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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Add comment per feedback Created 4 years, 2 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 6da24b6eb354f5dc12b8e5d508d599d0ded207d1..f60a6d45df3fa42c959a7d30e57ec4231b27824e 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
@@ -273,19 +273,16 @@ public class OfflinePageUtils {
* @param mainActivity Activity that is used to access package manager.
* @param text Text to be shared. If both |text| and |url| are supplied, they are concatenated
* with a space.
- * @param onlineUrl Online URL associated with the offline page that is used to access the
- * offline page file path.
* @param screenshotUri Screenshot of the page to be shared.
* @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 Uri screenshotUri, final ShareHelper.TargetChosenCallback callback,
- final Tab currentTab, boolean isOfflinePage) {
- final String offlineUrl = currentTab.getUrl();
+ final Activity mainActivity, final String text, final Uri screenshotUri,
+ final ShareHelper.TargetChosenCallback callback, final Tab currentTab) {
+ final String url = currentTab.getUrl();
final String title = currentTab.getTitle();
final OfflinePageBridge offlinePageBridge =
OfflinePageBridge.getForProfile(currentTab.getProfile());
@@ -295,21 +292,20 @@ public class OfflinePageUtils {
return;
}
- Callback<OfflinePageItem> prepareForSharing = onGotOfflinePageItemToShare(shareDirectly,
- saveLastUsed, mainActivity, title, text, onlineUrl, screenshotUri, 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,
+ url, screenshotUri, 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, url, screenshotUri, callback);
+ offlinePageBridge.selectPageForOnlineUrl(url, currentTab.getId(),
+ selectPageForOnlineUrlCallback(currentTab.getWebContents(), offlinePageBridge,
+ prepareForSharing));
}
/**

Powered by Google App Engine
This is Rietveld 408576698