Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java |
| index e2eebabac8082e7b55b7c1250e9cf4cf6da5d887..4198714875e06b0c97b179d73886063f192092a5 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java |
| @@ -106,7 +106,32 @@ import java.util.UUID; |
| // the same life time as native MediaSession. |
| private MediaSessionImpl mMediaSession; |
| - private SmartClipCallback mSmartClipCallback; |
| + class SmartClipCallbackImpl implements SmartClipCallback { |
| + public SmartClipCallbackImpl(final Handler smartClipHandler) { |
| + mHandler = smartClipHandler; |
| + } |
| + public void storeRequestRect(Rect rect) { |
| + mRect = rect; |
| + } |
| + |
| + @Override |
| + public void onSmartClipDataExtracted(String text, String html) { |
| + Bundle bundle = new Bundle(); |
| + bundle.putString("url", getVisibleUrl()); |
| + bundle.putString("title", getTitle()); |
| + bundle.putString("text", text); |
| + bundle.putString("html", html); |
| + bundle.putParcelable("rect", mRect); |
| + |
| + Message msg = Message.obtain(mHandler, 0); |
| + msg.setData(bundle); |
| + msg.sendToTarget(); |
| + } |
| + |
| + Rect mRect; |
| + final Handler mHandler; |
| + } |
| + private SmartClipCallbackImpl mSmartClipCallback; |
| private EventForwarder mEventForwarder; |
| @@ -400,8 +425,9 @@ import java.util.UUID; |
| } |
| @Override |
| - public void requestSmartClipExtract(int x, int y, int width, int height) { |
| + public void requestSmartClipExtract(Rect originalRect, int x, int y, int width, int height) { |
| if (mSmartClipCallback == null) return; |
| + mSmartClipCallback.storeRequestRect(originalRect); |
|
David Trainor- moved to gerrit
2017/04/26 20:58:17
Should we just build the rect here and do the dpi
aelias_OOO_until_Jul13
2017/04/26 23:18:15
OK, done. I needed to pass in the RenderCoordinat
|
| nativeRequestSmartClipExtract( |
| mNativeWebContentsAndroid, mSmartClipCallback, x, y, width, height); |
| } |
| @@ -412,20 +438,7 @@ import java.util.UUID; |
| mSmartClipCallback = null; |
| return; |
| } |
| - mSmartClipCallback = new SmartClipCallback() { |
| - @Override |
| - public void onSmartClipDataExtracted(String text, String html) { |
| - Bundle bundle = new Bundle(); |
| - bundle.putString("url", getVisibleUrl()); |
| - bundle.putString("title", getTitle()); |
| - bundle.putString("text", text); |
| - bundle.putString("html", html); |
| - |
| - Message msg = Message.obtain(smartClipHandler, 0); |
| - msg.setData(bundle); |
| - msg.sendToTarget(); |
| - } |
| - }; |
| + mSmartClipCallback = new SmartClipCallbackImpl(smartClipHandler); |
| } |
| @CalledByNative |