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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Move FrameMsg Created 3 years, 10 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: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 6ccba0af6dd9b70abf056fb7edc8c9307694315e..83b915080fbc499ee6873cd56f227c10b33bb5bf 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -3004,8 +3004,10 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
@Override
public void extractSmartClipData(int x, int y, int width, int height) {
+ float dpi = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
if (!isDestroyedOrNoOperation(WARN)) {
- mContentViewCore.extractSmartClipData(x, y, width, height);
+ mWebContents.requestSmartClipExtract(
+ (int) (x / dpi), (int) (y / dpi), (int) (width / dpi), (int) (height / dpi));
}
}
@@ -3013,28 +3015,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
public void setSmartClipResultHandler(final Handler resultHandler) {
if (isDestroyedOrNoOperation(WARN)) return;
- if (resultHandler == null) {
- mContentViewCore.setSmartClipDataListener(null);
- return;
- }
- mContentViewCore.setSmartClipDataListener(new ContentViewCore.SmartClipDataListener() {
- @Override
- public void onSmartClipDataExtracted(String text, String html, Rect clipRect) {
- Bundle bundle = new Bundle();
- bundle.putString("url", mContentViewCore.getWebContents().getVisibleUrl());
- bundle.putString("title", mContentViewCore.getWebContents().getTitle());
- bundle.putParcelable("rect", clipRect);
- bundle.putString("text", text);
- bundle.putString("html", html);
- try {
- Message msg = Message.obtain(resultHandler, 0);
- msg.setData(bundle);
- msg.sendToTarget();
- } catch (Exception e) {
- Log.e(TAG, "Error calling handler for smart clip data: ", e);
- }
- }
- });
+ mWebContents.setSmartClipResultHandler(resultHandler);
}
protected void insertVisualStateCallbackIfNotDestroyed(

Powered by Google App Engine
This is Rietveld 408576698