| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 BASE_CLIPBOARD_H_ | 5 #ifndef BASE_CLIPBOARD_H_ |
| 6 #define BASE_CLIPBOARD_H_ | 6 #define BASE_CLIPBOARD_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/process.h" | 13 #include "base/process.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "base/gfx/size.h" | 15 #include "base/gfx/size.h" |
| 16 | 16 |
| 17 class Clipboard { | 17 class Clipboard { |
| 18 public: | 18 public: |
| 19 typedef std::string FormatType; | 19 typedef std::string FormatType; |
| 20 #if defined(OS_LINUX) | 20 #if defined(OS_LINUX) |
| 21 #if defined(TOOLKIT_GTK) |
| 21 typedef struct _GtkClipboard GtkClipboard; | 22 typedef struct _GtkClipboard GtkClipboard; |
| 23 #endif |
| 22 typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap; | 24 typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap; |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 // ObjectType designates the type of data to be stored in the clipboard. This | 27 // ObjectType designates the type of data to be stored in the clipboard. This |
| 26 // designation is shared across all OSes. The system-specific designation | 28 // designation is shared across all OSes. The system-specific designation |
| 27 // is defined by FormatType. A single ObjectType might be represented by | 29 // is defined by FormatType. A single ObjectType might be represented by |
| 28 // several system-specific FormatTypes. For example, on Linux the CBF_TEXT | 30 // several system-specific FormatTypes. For example, on Linux the CBF_TEXT |
| 29 // ObjectType maps to "text/plain", "STRING", and several other formats. On | 31 // ObjectType maps to "text/plain", "STRING", and several other formats. On |
| 30 // windows it maps to CF_UNICODETEXT. | 32 // windows it maps to CF_UNICODETEXT. |
| 31 enum ObjectType { | 33 enum ObjectType { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // it in |clipboard_data_|. | 190 // it in |clipboard_data_|. |
| 189 | 191 |
| 190 // Write changes to gtk clipboard. | 192 // Write changes to gtk clipboard. |
| 191 void SetGtkClipboard(); | 193 void SetGtkClipboard(); |
| 192 // Free pointers in clipboard_data_ and clear() the map. | 194 // Free pointers in clipboard_data_ and clear() the map. |
| 193 void FreeTargetMap(); | 195 void FreeTargetMap(); |
| 194 // Insert a mapping into clipboard_data_. | 196 // Insert a mapping into clipboard_data_. |
| 195 void InsertMapping(const char* key, char* data, size_t data_len); | 197 void InsertMapping(const char* key, char* data, size_t data_len); |
| 196 | 198 |
| 197 TargetMap* clipboard_data_; | 199 TargetMap* clipboard_data_; |
| 200 #if defined(TOOLKIT_GTK) |
| 198 GtkClipboard* clipboard_; | 201 GtkClipboard* clipboard_; |
| 199 #endif | 202 #endif |
| 203 #endif |
| 200 | 204 |
| 201 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); | 205 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); |
| 202 }; | 206 }; |
| 203 | 207 |
| 204 #endif // BASE_CLIPBOARD_H_ | 208 #endif // BASE_CLIPBOARD_H_ |
| OLD | NEW |