Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/Clipboard.java |
| diff --git a/ui/android/java/src/org/chromium/ui/Clipboard.java b/ui/android/java/src/org/chromium/ui/Clipboard.java |
| index b4e0c21c9a9c03c147e4525ee7ba3e36c33cabf9..a7a3381706ceb35ca368577a725598197660cc64 100644 |
| --- a/ui/android/java/src/org/chromium/ui/Clipboard.java |
| +++ b/ui/android/java/src/org/chromium/ui/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(); |
|
joth
2013/11/13 23:11:15
want to comment that coerce would be better (as it
|
| + } |
| + } |
| + 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; |
| - } |
| } |