Index: ui/android/java/src/org/chromium/ui/base/Clipboard.java |
diff --git a/ui/android/java/src/org/chromium/ui/base/Clipboard.java b/ui/android/java/src/org/chromium/ui/base/Clipboard.java |
index e62c84ab84134c46b304d537d96300d8e0f234d8..fd231c68d0a9885db5191eb36de45a64dee090ad 100644 |
--- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java |
+++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java |
@@ -77,6 +77,23 @@ public class Clipboard { |
} |
/** |
+ * Gets the HTML text of top item on the primary clip on the Android clipboard. |
+ * |
+ * @return a Java string with the html text if any, or null if there is no html |
+ * text or no entries on the primary clip. |
+ */ |
+ @CalledByNative |
+ private String getHtmlText() { |
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
+ final ClipData clip = mClipboardManager.getPrimaryClip(); |
+ if (clip != null && clip.getItemCount() > 0) { |
+ return clip.getItemAt(0).getHtmlText(); |
+ } |
+ } |
+ return null; |
+ } |
+ |
+ /** |
* Emulates the behavior of the now-deprecated |
* {@link android.text.ClipboardManager#setText(CharSequence)}, setting the |
* clipboard's current primary clip to a plain-text clip that consists of |
@@ -105,24 +122,4 @@ public class Clipboard { |
ClipData.newHtmlText(null, text, html)); |
} |
} |
- |
- /** |
- * Approximates the behavior of the now-deprecated |
- * {@link android.text.ClipboardManager#hasText()}, returning true if and |
- * only if the clipboard has a primary clip and that clip contains a plain |
- * non-empty text entry (without attempting coercion - URLs and intents |
- * will cause this method to return false). |
- * |
- * @return as described above |
- */ |
- @SuppressWarnings("javadoc") |
- @CalledByNative |
- private boolean hasPlainText() { |
- final ClipData clip = mClipboardManager.getPrimaryClip(); |
- if (clip != null && clip.getItemCount() > 0) { |
- final CharSequence text = clip.getItemAt(0).getText(); |
- return !TextUtils.isEmpty(text); |
- } |
- return false; |
- } |
} |