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

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

Issue 2143133002: Do screenshot capture async for share intents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to util/ Created 4 years, 3 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 e8e2663f0ae20e009639e8a1902eaede50f7162c..6b910401ca4fb1912aac7955adca3d9312591b0b 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
@@ -8,7 +8,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.BatteryManager;
@@ -279,7 +278,7 @@ public class OfflinePageUtils {
* with a space.
* @param onlineUrl Online URL associated with the offline page that is used to access the
* offline page file path.
- * @param bitmap Screenshot of the page to be shared.
+ * @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()).
@@ -287,7 +286,7 @@ public class OfflinePageUtils {
*/
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 Uri screenshotUri, final ShareHelper.TargetChosenCallback callback,
final Tab currentTab, boolean isOfflinePage) {
final String offlineUrl = currentTab.getUrl();
final String title = currentTab.getTitle();
@@ -300,7 +299,7 @@ public class OfflinePageUtils {
}
Callback<OfflinePageItem> prepareForSharing = onGotOfflinePageItemToShare(shareDirectly,
- saveLastUsed, mainActivity, title, text, onlineUrl, bitmap, callback);
+ saveLastUsed, mainActivity, title, text, onlineUrl, screenshotUri, callback);
if (isOfflinePage) {
// If we're currently on offline page get the saved file directly.
@@ -324,20 +323,20 @@ public class OfflinePageUtils {
* @param title Title of the page.
* @param onlineUrl Online URL associated with the offline page that is used to access the
* offline page file path.
- * @param bitmap Screenshot of the page to be shared.
+ * @param screenshotUri Screenshot of the page to be shared.
* @param mContext The application context.
* @return a callback of OfflinePageItem
*/
private static Callback<OfflinePageItem> onGotOfflinePageItemToShare(
final boolean shareDirectly, final boolean saveLastUsed, final Activity mainActivity,
- final String title, final String text, final String onlineUrl, final Bitmap bitmap,
+ final String title, final String text, final String onlineUrl, final Uri screenshotUri,
final ShareHelper.TargetChosenCallback callback) {
return new Callback<OfflinePageItem>() {
@Override
public void onResult(OfflinePageItem item) {
String offlineFilePath = (item == null) ? null : item.getFilePath();
prepareFileAndShare(shareDirectly, saveLastUsed, mainActivity, title, text,
- onlineUrl, bitmap, callback, offlineFilePath);
+ onlineUrl, screenshotUri, callback, offlineFilePath);
}
};
}
@@ -410,7 +409,7 @@ public class OfflinePageUtils {
* with a space.
* @param onlineUrl Online URL associated with the offline page that is used to access the
* offline page file path.
- * @param bitmap Screenshot of the page to be shared.
+ * @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 (on
* older Android versions).
@@ -418,7 +417,7 @@ public class OfflinePageUtils {
*/
private static void prepareFileAndShare(final boolean shareDirectly, final boolean saveLastUsed,
final Activity activity, final String title, final String text, final String onlineUrl,
- final Bitmap bitmap, final ShareHelper.TargetChosenCallback callback,
+ final Uri screenshotUri, final ShareHelper.TargetChosenCallback callback,
final String filePath) {
new AsyncTask<Void, Void, File>() {
@Override
@@ -463,7 +462,7 @@ public class OfflinePageUtils {
offlineUri = Uri.fromFile(offlinePageShareable);
}
ShareHelper.share(shareDirectly, saveLastUsed, activity, title, text, onlineUrl,
- offlineUri, bitmap, callback);
+ offlineUri, screenshotUri, callback);
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}

Powered by Google App Engine
This is Rietveld 408576698