| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include <gdk/gdk.h> | 22 #include <gdk/gdk.h> |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(OS_ANDROID) | 25 #if defined(OS_ANDROID) |
| 26 #include <jni.h> | 26 #include <jni.h> |
| 27 | 27 |
| 28 #include "base/android/jni_android.h" | 28 #include "base/android/jni_android.h" |
| 29 #include "base/android/scoped_java_ref.h" | 29 #include "base/android/scoped_java_ref.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #if defined(USE_AURA) && defined(USE_X11) |
| 33 #include "base/memory/scoped_ptr.h" |
| 34 #endif |
| 35 |
| 32 namespace gfx { | 36 namespace gfx { |
| 33 class Size; | 37 class Size; |
| 34 } | 38 } |
| 35 | 39 |
| 36 class FilePath; | 40 class FilePath; |
| 37 class SkBitmap; | 41 class SkBitmap; |
| 38 | 42 |
| 39 #if defined(TOOLKIT_GTK) | 43 #if defined(TOOLKIT_GTK) |
| 40 typedef struct _GtkClipboard GtkClipboard; | 44 typedef struct _GtkClipboard GtkClipboard; |
| 41 #endif | 45 #endif |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #elif defined(OS_MACOSX) | 90 #elif defined(OS_MACOSX) |
| 87 public: | 91 public: |
| 88 FormatType(const FormatType& other); | 92 FormatType(const FormatType& other); |
| 89 FormatType& operator=(const FormatType& other); | 93 FormatType& operator=(const FormatType& other); |
| 90 private: | 94 private: |
| 91 explicit FormatType(NSString* native_format); | 95 explicit FormatType(NSString* native_format); |
| 92 NSString* ToNSString() const { return data_; } | 96 NSString* ToNSString() const { return data_; } |
| 93 NSString* data_; | 97 NSString* data_; |
| 94 #elif defined(USE_AURA) | 98 #elif defined(USE_AURA) |
| 95 explicit FormatType(const std::string& native_format); | 99 explicit FormatType(const std::string& native_format); |
| 100 public: |
| 96 const std::string& ToString() const { return data_; } | 101 const std::string& ToString() const { return data_; } |
| 102 private: |
| 97 std::string data_; | 103 std::string data_; |
| 98 #elif defined(TOOLKIT_GTK) | 104 #elif defined(TOOLKIT_GTK) |
| 99 explicit FormatType(const std::string& native_format); | 105 explicit FormatType(const std::string& native_format); |
| 100 explicit FormatType(const GdkAtom& native_format); | 106 explicit FormatType(const GdkAtom& native_format); |
| 101 const GdkAtom& ToGdkAtom() const { return data_; } | 107 const GdkAtom& ToGdkAtom() const { return data_; } |
| 102 GdkAtom data_; | 108 GdkAtom data_; |
| 103 #elif defined(OS_ANDROID) | 109 #elif defined(OS_ANDROID) |
| 104 explicit FormatType(const std::string& native_format); | 110 explicit FormatType(const std::string& native_format); |
| 105 const std::string& data() const { return data_; } | 111 const std::string& data() const { return data_; } |
| 106 int compare(const std::string& str) const { return data_.compare(str); } | 112 int compare(const std::string& str) const { return data_.compare(str); } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 static void DestroyClipboardForCurrentThread(); | 208 static void DestroyClipboardForCurrentThread(); |
| 203 | 209 |
| 204 // Write a bunch of objects to the system clipboard. Copies are made of the | 210 // Write a bunch of objects to the system clipboard. Copies are made of the |
| 205 // contents of |objects|. On Windows they are copied to the system clipboard. | 211 // contents of |objects|. On Windows they are copied to the system clipboard. |
| 206 // On linux they are copied into a structure owned by the Clipboard object and | 212 // On linux they are copied into a structure owned by the Clipboard object and |
| 207 // kept until the system clipboard is set again. | 213 // kept until the system clipboard is set again. |
| 208 void WriteObjects(Buffer buffer, const ObjectMap& objects); | 214 void WriteObjects(Buffer buffer, const ObjectMap& objects); |
| 209 | 215 |
| 210 // On Linux/BSD, we need to know when the clipboard is set to a URL. Most | 216 // On Linux/BSD, we need to know when the clipboard is set to a URL. Most |
| 211 // platforms don't care. | 217 // platforms don't care. |
| 212 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(USE_AURA) \ | 218 #if defined(OS_WIN) || defined(OS_MACOSX) \ |
| 219 || (defined(USE_AURA) && defined(OS_CHROMEOS)) \ |
| 213 || defined(OS_ANDROID) | 220 || defined(OS_ANDROID) |
| 214 void DidWriteURL(const std::string& utf8_text) {} | 221 void DidWriteURL(const std::string& utf8_text) {} |
| 215 #else // !defined(OS_WIN) && !defined(OS_MACOSX) | 222 #else |
| 216 void DidWriteURL(const std::string& utf8_text); | 223 void DidWriteURL(const std::string& utf8_text); |
| 217 #endif | 224 #endif |
| 218 | 225 |
| 219 // Returns a sequence number which uniquely identifies clipboard state. | 226 // Returns a sequence number which uniquely identifies clipboard state. |
| 220 // This can be used to version the data on the clipboard and determine | 227 // This can be used to version the data on the clipboard and determine |
| 221 // whether it has changed. | 228 // whether it has changed. |
| 222 uint64 GetSequenceNumber(Buffer buffer); | 229 uint64 GetSequenceNumber(Buffer buffer); |
| 223 | 230 |
| 224 // Tests whether the clipboard contains a certain format | 231 // Tests whether the clipboard contains a certain format |
| 225 bool IsFormatAvailable(const FormatType& format, Buffer buffer) const; | 232 bool IsFormatAvailable(const FormatType& format, Buffer buffer) const; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 void SetGtkClipboard(Buffer buffer); | 375 void SetGtkClipboard(Buffer buffer); |
| 369 // Insert a mapping into clipboard_data_. | 376 // Insert a mapping into clipboard_data_. |
| 370 void InsertMapping(const char* key, char* data, size_t data_len); | 377 void InsertMapping(const char* key, char* data, size_t data_len); |
| 371 | 378 |
| 372 // Find the gtk clipboard for the passed buffer enum. | 379 // Find the gtk clipboard for the passed buffer enum. |
| 373 GtkClipboard* LookupBackingClipboard(Buffer clipboard) const; | 380 GtkClipboard* LookupBackingClipboard(Buffer clipboard) const; |
| 374 | 381 |
| 375 TargetMap* clipboard_data_; | 382 TargetMap* clipboard_data_; |
| 376 GtkClipboard* clipboard_; | 383 GtkClipboard* clipboard_; |
| 377 GtkClipboard* primary_selection_; | 384 GtkClipboard* primary_selection_; |
| 385 #elif defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) |
| 386 private: |
| 387 // We keep our implementation details private because otherwise we bring in |
| 388 // the X11 headers and break chrome compile. |
| 389 class AuraX11Details; |
| 390 scoped_ptr<AuraX11Details> aurax11_details_; |
| 378 #endif | 391 #endif |
| 379 | 392 |
| 380 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 393 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
| 381 }; | 394 }; |
| 382 | 395 |
| 383 } // namespace ui | 396 } // namespace ui |
| 384 | 397 |
| 385 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 398 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| OLD | NEW |