Chromium Code Reviews| 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 | |
|
battre
2013/02/20 23:01:03
Nit: End comments with .
vasilii
2013/02/21 10:36:01
Done.
| |
| 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 TrackedActions { | |
|
battre
2013/02/20 23:01:03
I would rename this to TrackedAction.
vasilii
2013/02/21 10:36:01
Done.
| |
| 362 WRITE_CLIPBOARD_NO_SOURCE_TAG, | |
| 363 WRITE_CLIPBOARD_SOURCE_TAG, | |
| 364 READ_TEXT, | |
| 365 READ_ASCII_TEXT, | |
| 366 READ_RTF, | |
|
battre
2013/02/20 23:01:03
Is there a reason to distinguish between these 3 r
vasilii
2013/02/21 10:36:01
I think that more information is better.
| |
| 367 MAX_TRACKED_ACTION, | |
| 368 }; | |
| 369 | |
| 370 void ReportAction(Buffer buffer, TrackedActions action) const; | |
| 358 #if defined(OS_WIN) | 371 #if defined(OS_WIN) |
| 359 void WriteBitmapFromHandle(HBITMAP source_hbitmap, | 372 void WriteBitmapFromHandle(HBITMAP source_hbitmap, |
| 360 const gfx::Size& size); | 373 const gfx::Size& size); |
| 361 | 374 |
| 362 // Safely write to system clipboard. Free |handle| on failure. | 375 // Safely write to system clipboard. Free |handle| on failure. |
| 363 void WriteToClipboard(unsigned int format, HANDLE handle); | 376 void WriteToClipboard(unsigned int format, HANDLE handle); |
| 364 | 377 |
| 365 static void ParseBookmarkClipboardFormat(const string16& bookmark, | 378 static void ParseBookmarkClipboardFormat(const string16& bookmark, |
| 366 string16* title, | 379 string16* title, |
| 367 std::string* url); | 380 std::string* url); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 scoped_ptr<AuraX11Details> aurax11_details_; | 431 scoped_ptr<AuraX11Details> aurax11_details_; |
| 419 #endif | 432 #endif |
| 420 base::Callback<void(Buffer)> write_objects_callback_; | 433 base::Callback<void(Buffer)> write_objects_callback_; |
| 421 | 434 |
| 422 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 435 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
| 423 }; | 436 }; |
| 424 | 437 |
| 425 } // namespace ui | 438 } // namespace ui |
| 426 | 439 |
| 427 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 440 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| OLD | NEW |