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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentView.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: content/public/android/java/src/org/chromium/content/browser/ContentView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentView.java b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
index a0857e026c85160b93e9389a17f5edfa4d0abb5d..cff01aa9c05062140e357fecc43a20837de91ba1 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
@@ -10,7 +10,6 @@ import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Message;
import android.view.DragEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -22,7 +21,6 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
-import org.chromium.base.Log;
import org.chromium.base.TraceEvent;
/**
@@ -291,34 +289,16 @@ public class ContentView extends FrameLayout
// Implements SmartClipProvider
@Override
public void extractSmartClipData(int x, int y, int width, int height) {
- mContentViewCore.extractSmartClipData(x, y, width, height);
+ float dpi = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
+ y -= mContentViewCore.getRenderCoordinates().getContentOffsetYPix();
+ mContentViewCore.getWebContents().requestSmartClipExtract(
+ (int) (x / dpi), (int) (y / dpi), (int) (width / dpi), (int) (height / dpi));
}
// Implements SmartClipProvider
@Override
public void setSmartClipResultHandler(final Handler resultHandler) {
- 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);
- }
- }
- });
+ mContentViewCore.getWebContents().setSmartClipResultHandler(resultHandler);
}
///////////////////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698