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 {
try {
String path = UiUtils.getDirectoryForImageCapture(ContextUtils.getApplicationContext())
+ File.separator + SHARE_IMAGES_DIRECTORY_NAME;
contents.getContentBitmapAsync(
contents.writeContentBitmapToDiskAsync(
width, height, path, new ExternallyVisibleUriCallback(callback));
} catch (IOException e) {
Log.e(TAG, "Error getting content bitmap: ", e);
......
......@@ -6,6 +6,7 @@
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include "base/android/callback_android.h"
......@@ -643,7 +644,7 @@ void WebContentsAndroid::SetOverscrollRefreshHandler(
overscroll_refresh_handler));
}
void WebContentsAndroid::GetContentBitmap(
void WebContentsAndroid::WriteContentBitmapToDisk(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
jint width,
......@@ -768,7 +769,6 @@ void WebContentsAndroid::OnFinishGetContentBitmap(
const std::string& path,
const SkBitmap& bitmap) {
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_bitmap;
if (!bitmap.drawsNothing()) {
auto task_runner = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
......
......@@ -178,12 +178,13 @@ class CONTENT_EXPORT WebContentsAndroid
const base::android::JavaParamRef<jobject>& overscroll_refresh_handler);
// Relay the access from Java layer to RWHV::CopyFromSurface() through JNI.
void GetContentBitmap(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint width,
jint height,
const base::android::JavaParamRef<jstring>& jpath,
const base::android::JavaParamRef<jobject>& jcallback);
void WriteContentBitmapToDisk(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint width,
jint height,
const base::android::JavaParamRef<jstring>& jpath,
const base::android::JavaParamRef<jobject>& jcallback);
void ReloadLoFiImages(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
......
......@@ -672,9 +672,9 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi
}
@Override
public void getContentBitmapAsync(
public void writeContentBitmapToDiskAsync(
int width, int height, String path, Callback<String> callback) {
nativeGetContentBitmap(mNativeWebContentsAndroid, width, height, path, callback);
nativeWriteContentBitmapToDisk(mNativeWebContentsAndroid, width, height, path, callback);
}
@Override
......@@ -912,8 +912,8 @@ public class WebContentsImpl implements WebContents, RenderFrameHostDelegate, Wi
long nativeWebContentsAndroid, AccessibilitySnapshotCallback callback);
private native void nativeSetOverscrollRefreshHandler(
long nativeWebContentsAndroid, OverscrollRefreshHandler nativeOverscrollRefreshHandler);
private native void nativeGetContentBitmap(long nativeWebContentsAndroid, int width, int height,
String path, Callback<String> callback);
private native void nativeWriteContentBitmapToDisk(long nativeWebContentsAndroid, int width,
int height, String path, Callback<String> callback);
private native void nativeReloadLoFiImages(long nativeWebContentsAndroid);
private native int nativeDownloadImage(long nativeWebContentsAndroid,
String url, boolean isFavicon, int maxBitmapSize,
......
......@@ -396,7 +396,7 @@ public interface WebContents extends Parcelable {
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 height The height of the resulting bitmap, or 0 for "auto."
......@@ -404,7 +404,8 @@ public interface WebContents extends Parcelable {
* @param callback May be called synchronously, or at a later point, to deliver the bitmap
* 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.
......
......@@ -219,7 +219,7 @@ public class MockWebContents implements WebContents {
public void setOverscrollRefreshHandler(OverscrollRefreshHandler handler) {}
@Override
public void getContentBitmapAsync(
public void writeContentBitmapToDiskAsync(
int width, int height, String path, Callback<String> callback) {}
@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