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

Unified Diff: ui/android/java/src/org/chromium/ui/base/Clipboard.java

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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: 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 aaa500ea6dec0a58c941f9e461844608253c7c66..67aaca273fe9543745b2aa883dce390a878665ca 100644
--- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java
+++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
@@ -4,12 +4,13 @@
package org.chromium.ui.base;
+import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
+import android.os.Build;
import android.widget.Toast;
-import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.ui.R;
@@ -20,6 +21,10 @@ import org.chromium.ui.R;
*/
@JNINamespace("ui")
public class Clipboard {
+
+ private static final boolean IS_HTML_CLIPBOARD_SUPPORTED =
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
+
// Necessary for coercing clipboard contents to text if they require
// access to network resources, etceteras (e.g., URI in clipboard)
private final Context mContext;
@@ -83,9 +88,10 @@ public class 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.
*/
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@CalledByNative
private String getHTMLText() {
- if (isHTMLClipboardSupported()) {
+ if (IS_HTML_CLIPBOARD_SUPPORTED) {
final ClipData clip = mClipboardManager.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
return clip.getItemAt(0).getHtmlText();
@@ -129,8 +135,9 @@ public class Clipboard {
* @param label The Plain-text label for the HTML content.
* @param text Plain-text representation of the HTML content.
*/
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void setHTMLText(final String html, final String label, final String text) {
- if (isHTMLClipboardSupported()) {
+ if (IS_HTML_CLIPBOARD_SUPPORTED) {
setPrimaryClipNoException(ClipData.newHtmlText(label, text, html));
}
}
@@ -150,7 +157,7 @@ public class Clipboard {
@CalledByNative
private static boolean isHTMLClipboardSupported() {
- return ApiCompatibilityUtils.isHTMLClipboardSupported();
+ return IS_HTML_CLIPBOARD_SUPPORTED;
}
private void setPrimaryClipNoException(ClipData clip) {
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698