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

Unified Diff: ui/base/clipboard/clipboard.h

Issue 9264014: Upstream the clipboard implementation for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 8 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
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard.h
diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h
index 4dc7a380557640a94b1d6cf426d6712104a1987a..e0f0b71333309fc52018bc46060acb3b61868e24 100644
--- a/ui/base/clipboard/clipboard.h
+++ b/ui/base/clipboard/clipboard.h
@@ -20,6 +20,13 @@
#include <gdk/gdk.h>
#endif
+#if defined(OS_ANDROID)
+#include <jni.h>
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#endif
+
namespace gfx {
class Size;
}
@@ -75,6 +82,11 @@ class UI_EXPORT Clipboard {
explicit FormatType(const GdkAtom& native_format);
const GdkAtom& ToGdkAtom() const { return data_; }
GdkAtom data_;
+#elif defined(OS_ANDROID)
+ explicit FormatType(const std::string& native_format);
+ const std::string& ToString() const { return data_; }
+ int compare(const std::string& str) const { return data_.compare(str); }
+ std::string data_;
#else
#error No FormatType definition.
#endif
@@ -165,7 +177,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);
@@ -321,6 +334,30 @@ class UI_EXPORT Clipboard {
TargetMap* clipboard_data_;
GtkClipboard* clipboard_;
GtkClipboard* primary_selection_;
+#elif defined(OS_ANDROID)
+ // 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);
+
+ // Java class and methods for the Android ClipboardManager.
+ base::android::ScopedJavaGlobalRef<jobject> clipboard_manager_;
+ jmethodID set_text_;
+ jmethodID has_text_;
+ jmethodID get_text_;
+ jmethodID to_string_;
#endif
// MIME type constants.
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698