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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapViewHolder.java

Issue 2816733002: Photo Picker Dialog: Use sandboxed utility process for decoding images. (Closed)
Patch Set: Address comments from Theresa 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/photo_picker/PickerBitmapViewHolder.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapViewHolder.java
index 70d18a837fd8316262c9c3918ccda1a786811a35..bd8dba0de3b4683aba1e342f1edd57a12cc7ec72 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapViewHolder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmapViewHolder.java
@@ -5,9 +5,6 @@
package org.chromium.chrome.browser.photo_picker;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.text.TextUtils;
@@ -16,7 +13,8 @@ import java.util.List;
/**
* Holds on to a {@link PickerBitmapView} that displays information about a picker bitmap.
*/
-public class PickerBitmapViewHolder extends ViewHolder {
+public class PickerBitmapViewHolder
+ extends ViewHolder implements DecoderServiceHost.ImageDecodedCallback {
// Our parent category.
private PickerCategoryView mCategoryView;
@@ -35,11 +33,9 @@ public class PickerBitmapViewHolder extends ViewHolder {
mItemView = itemView;
}
- /**
- * The notification handler for when an image has been decoded.
- * @param filePath The file path for the newly decoded image.
- * @param bitmap The results of the decoding (or placeholder image, if failed).
- */
+ // DecoderServiceHost.ImageDecodedCallback
+
+ @Override
public void imageDecodedCallback(String filePath, Bitmap bitmap) {
if (bitmap == null || bitmap.getWidth() == 0 || bitmap.getHeight() == 0) {
return;
@@ -65,31 +61,16 @@ public class PickerBitmapViewHolder extends ViewHolder {
if (mBitmapDetails.type() == PickerBitmap.CAMERA
|| mBitmapDetails.type() == PickerBitmap.GALLERY) {
- mItemView.initializeSpecialTile(mBitmapDetails);
+ mItemView.initialize(mBitmapDetails, null, false);
return;
}
// TODO(finnur): Use cached image, if available.
- // TODO(finnur): Use decoder instead.
- int size = mCategoryView.getImageSize();
- imageDecodedCallback(mBitmapDetails.getFilePath(), createPlaceholderBitmap(size, size));
- }
+ mItemView.initialize(mBitmapDetails, null, true);
- /**
- * Creates a placeholder bitmap.
- * @param width The requested width of the resulting bitmap.
- * @param height The requested height of the resulting bitmap.
- * @return Placeholder bitmap.
- */
- // TODO(finnur): Remove once the decoder is in place.
- private Bitmap createPlaceholderBitmap(int width, int height) {
- Bitmap placeholder = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(placeholder);
- Paint paint = new Paint();
- paint.setColor(Color.GRAY);
- canvas.drawRect(0, 0, (float) width, (float) height, paint);
- return placeholder;
+ int size = mCategoryView.getImageSize();
+ mCategoryView.getDecoderServiceHost().decodeImage(mBitmapDetails.getFilePath(), size, this);
}
/**

Powered by Google App Engine
This is Rietveld 408576698