Index: ui/base/clipboard/clipboard.h |
diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h |
index 4dc7a380557640a94b1d6cf426d6712104a1987a..34000e15153f50892c2dc93c8f36d48fe028738e 100644 |
--- a/ui/base/clipboard/clipboard.h |
+++ b/ui/base/clipboard/clipboard.h |
@@ -20,6 +20,11 @@ |
#include <gdk/gdk.h> |
#endif |
+#if defined(OS_ANDROID) |
+#include "base/synchronization/lock.h" |
+#include <jni.h> |
+#endif |
+ |
namespace gfx { |
class Size; |
} |
@@ -70,6 +75,9 @@ class UI_EXPORT Clipboard { |
explicit FormatType(const std::string& native_format); |
const std::string& ToString() const { return data_; } |
std::string data_; |
+#if defined(OS_ANDROID) |
+ int compare(const std::string& str) const { return data_.compare(str); } |
dcheng
2012/01/19 18:10:17
I think your cleanup ate a few lines.
John Grabowski
2012/01/19 20:32:56
Verified this doesn't compile; we only hit this co
Peter Beverloo
2012/01/20 15:13:51
Good catch. I actually meant to add OS_ANDROID to
Peter Beverloo
2012/01/20 15:13:51
As noted, cleanup fail on my side. PS4 compiles an
|
+#endif |
#elif defined(TOOLKIT_USES_GTK) |
explicit FormatType(const std::string& native_format); |
explicit FormatType(const GdkAtom& native_format); |
@@ -165,7 +173,8 @@ class UI_EXPORT Clipboard { |
// On Linux/BSD, we need to know when the clipboard is set to a URL. Most |
// platforms don't care. |
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(USE_AURA) |
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(USE_AURA) \ |
+ || defined(OS_ANDROID) |
void DidWriteURL(const std::string& utf8_text) {} |
#else // !defined(OS_WIN) && !defined(OS_MACOSX) |
void DidWriteURL(const std::string& utf8_text); |
@@ -322,6 +331,33 @@ class UI_EXPORT Clipboard { |
GtkClipboard* clipboard_; |
GtkClipboard* primary_selection_; |
#endif |
+#if defined(OS_ANDROID) |
+ FRIEND_TEST_ALL_PREFIXES(ClipboardTest, InternalClipboardInvalidation); |
+ |
+ // Java class and methods for the Android ClipboardManager |
+ jobject clipboard_manager_; |
+ jmethodID set_text_; |
+ jmethodID has_text_; |
+ jmethodID get_text_; |
+ jmethodID to_string_; |
+ |
+ // Returns whether some text is available from the Android Clipboard |
+ bool IsTextAvailableFromAndroid() const; |
+ |
+ // Make sure that the Android Clipboard contents matches what we think it |
+ // should contain. If it changed, a copy occured from another application and |
+ // all internal data is dropped. |
+ void ValidateInternalClipboard() const; |
+ |
+ // Clear the Clipboard for all types. Both for Android and internal |
+ void Clear(); |
+ |
+ // Clear the internal clipboard |
+ void ClearInternalClipboard() const; |
+ |
+ // This private method is used to set non text key/value |
+ void Set(const std::string& key, const std::string& value); |
+#endif |
// MIME type constants. |
static const char kMimeTypeText[]; |