From f5164b9f8b4352fb326260ae2f901b17a000fd51 Mon Sep 17 00:00:00 2001 From: pedrosimonetti Date: Fri, 19 Sep 2014 16:22:54 -0700 Subject: [PATCH] [Contextual Search] Pass selection coordinate to ContentViewClient. BUG=415656 Review URL: https://codereview.chromium.org/583583005 Cr-Commit-Position: refs/heads/master@{#295802} --- .../org/chromium/content/browser/ContentViewClient.java | 14 +++++++++++++- .../src/org/chromium/content/browser/ContentViewCore.java | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java index c3e4bf091c52..8e1f09b4e765 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java @@ -131,13 +131,25 @@ public class ContentViewClient { /** * Notification that a selection or insertion-related event has occurred. - * TODO(donnd): Remove this and instead expose a ContextualSearchClient, crbug.com/403001. + * TODO(pedrosimonetti): remove this method once downstream code has been updated to use + * the other signature. * @param eventType The selection event type, see {@link SelectionEventType}. */ public void onSelectionEvent(int eventType) { } /** + * Notification that a selection or insertion-related event has occurred. + * TODO(donnd): Remove this and instead expose a ContextualSearchClient, crbug.com/403001. + * @param eventType The selection event type, see {@link SelectionEventType}. + * @param posXPix The x coordinate of the selection start handle. + * @param posYPix The y coordinate of the selection start handle. + */ + public void onSelectionEvent(int eventType, float posXPix, float posYPix) { + onSelectionEvent(eventType); + } + + /** * Called when a new content intent is requested to be started. */ public void onStartContentIntent(Context context, String intentUrl) { diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 451a5be5210e..226d7989bdbd 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java @@ -2021,7 +2021,9 @@ public class ContentViewCore default: assert false : "Invalid selection event type."; } - getContentViewClient().onSelectionEvent(eventType); + + final float scale = mRenderCoordinates.getDeviceScaleFactor(); + getContentViewClient().onSelectionEvent(eventType, posXDip * scale, posYDip * scale); } private void hideTextHandles() { -- 2.11.4.GIT