Commit c17d6c3a authored by Ivan Kotenkov's avatar Ivan Kotenkov Committed by Commit Bot

Rename getContentBitmapAsync to writeContentBitmapToDiskAsync.

Update documentation and remove an unused variable.
This is a cleanup after
https://chromium-review.googlesource.com/c/chromium/src/+/935670

Bug: 651348
Change-Id: I6e974b282c61497a8e5fdc2ea092e48d32ee26ed
Reviewed-on: https://chromium-review.googlesource.com/1105827
Commit-Queue: Ivan Kotenkov <kotenkov@yandex-team.ru>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568770}
parent 6ac5174c
...@@ -415,7 +415,7 @@ public class ShareHelper { ...@@ -415,7 +415,7 @@ public class ShareHelper {
try { try {
String path = UiUtils.getDirectoryForImageCapture(ContextUtils.getApplicationContext()) String path = UiUtils.getDirectoryForImageCapture(ContextUtils.getApplicationContext())
+ File.separator + SHARE_IMAGES_DIRECTORY_NAME; + File.separator + SHARE_IMAGES_DIRECTORY_NAME;
contents.getContentBitmapAsync( contents.writeContentBitmapToDiskAsync(
width, height, path, new ExternallyVisibleUriCallback(callback)); width, height, path, new ExternallyVisibleUriCallback(callback));
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "Error getting content bitmap: ", e); Log.e(TAG, "Error getting content bitmap: ", e);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include "base/android/callback_android.h" #include "base/android/callback_android.h"
...@@ -643,7 +644,7 @@ void WebContentsAndroid::SetOverscrollRefreshHandler( ...@@ -643,7 +644,7 @@ void WebContentsAndroid::SetOverscrollRefreshHandler(
overscroll_refresh_handler)); overscroll_refresh_handler));
} }
void WebContentsAndroid::GetContentBitmap( void WebContentsAndroid::WriteContentBitmapToDisk(
JNIEnv* env, JNIEnv* env,
const JavaParamRef<jobject>& obj, const JavaParamRef<jobject>& obj,
jint width, jint width,
...@@ -768,7 +769,6 @@ void WebContentsAndroid::OnFinishGetContentBitmap( ...@@ -768,7 +769,6 @@ void WebContentsAndroid::OnFinishGetContentBitmap(
const std::string& path, const std::string& path,
const SkBitmap& bitmap) { const SkBitmap& bitmap) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_bitmap;
if (!bitmap.drawsNothing()) { if (!bitmap.drawsNothing()) {
auto task_runner = base::CreateSequencedTaskRunnerWithTraits( auto task_runner = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
......
...@@ -178,12 +178,13 @@ class CONTENT_EXPORT WebContentsAndroid ...@@ -178,12 +178,13 @@ class CONTENT_EXPORT WebContentsAndroid
const base::android::JavaParamRef<jobject>& overscroll_refresh_handler); const base::android::JavaParamRef<jobject>& overscroll_refresh_handler);
// Relay the access from Java layer to RWHV::CopyFromSurface() through JNI. // Relay the access from Java layer to RWHV::CopyFromSurface() through JNI.
void GetContentBitmap(JNIEnv* env, void WriteContentBitmapToDisk(
const base::android::JavaParamRef<jobject>& obj, JNIEnv* env,
jint width, const base::android::JavaParamRef<jobject>& obj,
jint height, jint width,
const base::android::JavaParamRef<jstring>& jpath, jint height,
const base::android::JavaParamRef<jobject>& jcallback); const base::android::JavaParamRef<jstring>& jpath,
const base::android::JavaParamRef<jobject>& jcallback);
void ReloadLoFiImages(JNIEnv* env, void ReloadLoFiImages(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj); const base::android::JavaParamRef<jobject>& obj);
......
...@@ -672,9 +672,9 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi ...@@ -672,9 +672,9 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi
} }
@Override @Override
public void getContentBitmapAsync( public void writeContentBitmapToDiskAsync(
int width, int height, String path, Callback<String> callback) { int width, int height, String path, Callback<String> callback) {
nativeGetContentBitmap(mNativeWebContentsAndroid, width, height, path, callback); nativeWriteContentBitmapToDisk(mNativeWebContentsAndroid, width, height, path, callback);
} }
@Override @Override
...@@ -912,8 +912,8 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi ...@@ -912,8 +912,8 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi
long nativeWebContentsAndroid, AccessibilitySnapshotCallback callback); long nativeWebContentsAndroid, AccessibilitySnapshotCallback callback);
private native void nativeSetOverscrollRefreshHandler( private native void nativeSetOverscrollRefreshHandler(
long nativeWebContentsAndroid, OverscrollRefreshHandler nativeOverscrollRefreshHandler); long nativeWebContentsAndroid, OverscrollRefreshHandler nativeOverscrollRefreshHandler);
private native void nativeGetContentBitmap(long nativeWebContentsAndroid, int width, int height, private native void nativeWriteContentBitmapToDisk(long nativeWebContentsAndroid, int width,
String path, Callback<String> callback); int height, String path, Callback<String> callback);
private native void nativeReloadLoFiImages(long nativeWebContentsAndroid); private native void nativeReloadLoFiImages(long nativeWebContentsAndroid);
private native int nativeDownloadImage(long nativeWebContentsAndroid, private native int nativeDownloadImage(long nativeWebContentsAndroid,
String url, boolean isFavicon, int maxBitmapSize, String url, boolean isFavicon, int maxBitmapSize,
......
...@@ -396,7 +396,7 @@ public interface WebContents extends Parcelable { ...@@ -396,7 +396,7 @@ public interface WebContents extends Parcelable {
void setOverscrollRefreshHandler(OverscrollRefreshHandler handler); void setOverscrollRefreshHandler(OverscrollRefreshHandler handler);
/** /**
* Requests an image snapshot of the content. * Requests an image snapshot of the content and stores it in the specified folder.
* *
* @param width The width of the resulting bitmap, or 0 for "auto." * @param width The width of the resulting bitmap, or 0 for "auto."
* @param height The height of the resulting bitmap, or 0 for "auto." * @param height The height of the resulting bitmap, or 0 for "auto."
...@@ -404,7 +404,8 @@ public interface WebContents extends Parcelable { ...@@ -404,7 +404,8 @@ public interface WebContents extends Parcelable {
* @param callback May be called synchronously, or at a later point, to deliver the bitmap * @param callback May be called synchronously, or at a later point, to deliver the bitmap
* result (or a failure code). * result (or a failure code).
*/ */
void getContentBitmapAsync(int width, int height, String path, Callback<String> callback); void writeContentBitmapToDiskAsync(
int width, int height, String path, Callback<String> callback);
/** /**
* Reloads all the Lo-Fi images in this WebContents. * Reloads all the Lo-Fi images in this WebContents.
......
...@@ -219,7 +219,7 @@ public class MockWebContents implements WebContents { ...@@ -219,7 +219,7 @@ public class MockWebContents implements WebContents {
public void setOverscrollRefreshHandler(OverscrollRefreshHandler handler) {} public void setOverscrollRefreshHandler(OverscrollRefreshHandler handler) {}
@Override @Override
public void getContentBitmapAsync( public void writeContentBitmapToDiskAsync(
int width, int height, String path, Callback<String> callback) {} int width, int height, String path, Callback<String> callback) {}
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment