| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // size gfx::Size struct | 166 // size gfx::Size struct |
| 167 // CBF_DATA format char array | 167 // CBF_DATA format char array |
| 168 // data byte array | 168 // data byte array |
| 169 typedef std::vector<char> ObjectMapParam; | 169 typedef std::vector<char> ObjectMapParam; |
| 170 typedef std::vector<ObjectMapParam> ObjectMapParams; | 170 typedef std::vector<ObjectMapParam> ObjectMapParams; |
| 171 typedef std::map<int /* ObjectType */, ObjectMapParams> ObjectMap; | 171 typedef std::map<int /* ObjectType */, ObjectMapParams> ObjectMap; |
| 172 | 172 |
| 173 // WriteObject() caller can use the SourceTag that will be stored in the | 173 // WriteObject() caller can use the SourceTag that will be stored in the |
| 174 // clipboard. NULL value means "no tag". | 174 // clipboard. NULL value means "no tag". |
| 175 typedef void* SourceTag; | 175 typedef void* SourceTag; |
| 176 // kInvalidSourceTag is not NULL but a special value != any pointer. |
| 177 static const SourceTag kInvalidSourceTag; |
| 176 static ObjectMapParam SourceTag2Binary(SourceTag tag); | 178 static ObjectMapParam SourceTag2Binary(SourceTag tag); |
| 177 static SourceTag Binary2SourceTag(const std::string& serialization); | 179 static SourceTag Binary2SourceTag(const std::string& serialization); |
| 178 | 180 |
| 179 // Buffer designates which clipboard the action should be applied to. | 181 // Buffer designates which clipboard the action should be applied to. |
| 180 // Only platforms that use the X Window System support the selection | 182 // Only platforms that use the X Window System support the selection |
| 181 // buffer. | 183 // buffer. |
| 182 enum Buffer { | 184 enum Buffer { |
| 183 BUFFER_STANDARD, | 185 BUFFER_STANDARD, |
| 184 BUFFER_SELECTION, | 186 BUFFER_SELECTION, |
| 185 }; | 187 }; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 350 |
| 349 void WriteWebSmartPaste(); | 351 void WriteWebSmartPaste(); |
| 350 | 352 |
| 351 void WriteBitmap(const char* pixel_data, const char* size_data); | 353 void WriteBitmap(const char* pixel_data, const char* size_data); |
| 352 | 354 |
| 353 void WriteData(const FormatType& format, | 355 void WriteData(const FormatType& format, |
| 354 const char* data_data, | 356 const char* data_data, |
| 355 size_t data_len); | 357 size_t data_len); |
| 356 | 358 |
| 357 void WriteSourceTag(SourceTag tag); | 359 void WriteSourceTag(SourceTag tag); |
| 360 |
| 361 enum TrackedAction { |
| 362 WRITE_CLIPBOARD_NO_SOURCE_TAG, |
| 363 WRITE_CLIPBOARD_SOURCE_TAG, |
| 364 READ_TEXT, |
| 365 MAX_TRACKED_ACTION, |
| 366 }; |
| 367 |
| 368 void ReportAction(Buffer buffer, TrackedAction action) const; |
| 358 #if defined(OS_WIN) | 369 #if defined(OS_WIN) |
| 359 void WriteBitmapFromHandle(HBITMAP source_hbitmap, | 370 void WriteBitmapFromHandle(HBITMAP source_hbitmap, |
| 360 const gfx::Size& size); | 371 const gfx::Size& size); |
| 361 | 372 |
| 362 // Safely write to system clipboard. Free |handle| on failure. | 373 // Safely write to system clipboard. Free |handle| on failure. |
| 363 void WriteToClipboard(unsigned int format, HANDLE handle); | 374 void WriteToClipboard(unsigned int format, HANDLE handle); |
| 364 | 375 |
| 365 static void ParseBookmarkClipboardFormat(const string16& bookmark, | 376 static void ParseBookmarkClipboardFormat(const string16& bookmark, |
| 366 string16* title, | 377 string16* title, |
| 367 std::string* url); | 378 std::string* url); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 scoped_ptr<AuraX11Details> aurax11_details_; | 429 scoped_ptr<AuraX11Details> aurax11_details_; |
| 419 #endif | 430 #endif |
| 420 base::Callback<void(Buffer)> write_objects_callback_; | 431 base::Callback<void(Buffer)> write_objects_callback_; |
| 421 | 432 |
| 422 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 433 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
| 423 }; | 434 }; |
| 424 | 435 |
| 425 } // namespace ui | 436 } // namespace ui |
| 426 | 437 |
| 427 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 438 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| OLD | NEW |