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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.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/ContentViewCore.java
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 9f97f23f810dfe48d007672441057d7d73deea0c..78232fadca835332a2681f6939a556bc620979a8 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
@@ -263,14 +263,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
boolean super_awakenScrollBars(int startDelay, boolean invalidate);
}
- /**
- * An interface that allows the embedder to be notified when the results of
- * extractSmartClipData are available.
- */
- public interface SmartClipDataListener {
- public void onSmartClipDataExtracted(String text, String html, Rect clipRect);
- }
-
private final Context mContext;
private final String mProductVersion;
private ViewGroup mContainerView;
@@ -359,8 +351,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
// onNativeFlingStopped() is called asynchronously.
private int mPotentiallyActiveFlingCount;
- private SmartClipDataListener mSmartClipDataListener;
-
/**
* PID used to indicate an invalid render process.
*/
@@ -372,10 +362,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
private float mCurrentTouchOffsetX;
private float mCurrentTouchOffsetY;
- // Offsets for smart clip
- private int mSmartClipOffsetX;
- private int mSmartClipOffsetY;
-
// Whether the ContentViewCore requires the WebContents to be fullscreen in order to lock the
// screen orientation.
private boolean mFullscreenRequiredForOrientationLock = true;
@@ -792,7 +778,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
}
mWebContentsObserver.destroy();
mWebContentsObserver = null;
- setSmartClipDataListener(null);
mImeAdapter.resetAndHideKeyboard();
// TODO(igsolla): address TODO in ContentViewClient because ContentViewClient is not
// currently a real Null Object.
@@ -2565,52 +2550,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
return new Rect(x, y, right, bottom);
}
- public void extractSmartClipData(int x, int y, int width, int height) {
- if (mNativeContentViewCore != 0) {
- x += mSmartClipOffsetX;
- y += mSmartClipOffsetY;
- nativeExtractSmartClipData(mNativeContentViewCore, x, y, width, height);
- }
- }
-
- /**
- * Set offsets for smart clip.
- *
- * <p>This should be called if there is a viewport change introduced by,
- * e.g., show and hide of a location bar.
- *
- * @param offsetX Offset for X position.
- * @param offsetY Offset for Y position.
- */
- public void setSmartClipOffsets(int offsetX, int offsetY) {
- mSmartClipOffsetX = offsetX;
- mSmartClipOffsetY = offsetY;
- }
-
- @CalledByNative
- private void onSmartClipDataExtracted(String text, String html, Rect clipRect) {
- // Translate the positions by the offsets introduced by location bar. Note that the
- // coordinates are in dp scale, and that this definitely has the potential to be
- // different from the offsets when extractSmartClipData() was called. However,
- // as long as OEM has a UI that consumes all the inputs and waits until the
- // callback is called, then there shouldn't be any difference.
- // TODO(changwan): once crbug.com/416432 is resolved, try to pass offsets as
- // separate params for extractSmartClipData(), and apply them not the new offset
- // values in the callback.
- final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
- final int offsetXInDp = (int) (mSmartClipOffsetX / deviceScale);
- final int offsetYInDp = (int) (mSmartClipOffsetY / deviceScale);
- clipRect.offset(-offsetXInDp, -offsetYInDp);
-
- if (mSmartClipDataListener != null) {
- mSmartClipDataListener.onSmartClipDataExtracted(text, html, clipRect);
- }
- }
-
- public void setSmartClipDataListener(SmartClipDataListener listener) {
- mSmartClipDataListener = listener;
- }
-
public void setBackgroundOpaque(boolean opaque) {
if (mNativeContentViewCore != 0) {
nativeSetBackgroundOpaque(mNativeContentViewCore, opaque);
@@ -2907,9 +2846,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
String textTrackFontStyle, String textTrackFontVariant, String textTrackTextColor,
String textTrackTextShadow, String textTrackTextSize);
- private native void nativeExtractSmartClipData(long nativeContentViewCoreImpl,
- int x, int y, int w, int h);
-
private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl, boolean opaque);
private native boolean nativeIsTouchDragDropEnabled(long nativeContentViewCoreImpl);
private native void nativeOnDragEvent(long nativeContentViewCoreImpl, int action, int x, int y,

Powered by Google App Engine
This is Rietveld 408576698