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 // Multiply-included message file, so no include guard. | 5 // Multiply-included message file, so no include guard. |
6 | 6 |
7 #include <map> | |
8 #include <string> | 7 #include <string> |
9 #include <vector> | 8 #include <vector> |
10 | 9 |
11 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
12 #include "base/strings/string16.h" | |
13 #include "content/common/clipboard_format.h" | 11 #include "content/common/clipboard_format.h" |
14 #include "content/public/common/common_param_traits.h" | 12 #include "content/public/common/common_param_traits.h" |
15 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
16 #include "ui/base/clipboard/clipboard.h" | 14 #include "ui/base/clipboard/clipboard.h" |
17 | 15 |
18 #define IPC_MESSAGE_START ClipboardMsgStart | 16 #define IPC_MESSAGE_START ClipboardMsgStart |
19 | 17 |
20 IPC_ENUM_TRAITS_MAX_VALUE(content::ClipboardFormat, | 18 IPC_ENUM_TRAITS_MAX_VALUE(content::ClipboardFormat, |
21 content::CLIPBOARD_FORMAT_LAST) | 19 content::CLIPBOARD_FORMAT_LAST) |
22 IPC_ENUM_TRAITS_MAX_VALUE(ui::ClipboardType, ui::CLIPBOARD_TYPE_LAST) | 20 IPC_ENUM_TRAITS_MAX_VALUE(ui::ClipboardType, ui::CLIPBOARD_TYPE_LAST) |
23 | 21 |
24 // Clipboard IPC messages sent from the renderer to the browser. | 22 // Clipboard IPC messages sent from the renderer to the browser. |
25 | 23 |
| 24 // This message is used when the object list does not contain a bitmap. |
| 25 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteObjectsAsync, |
| 26 ui::Clipboard::ObjectMap /* objects */) |
| 27 // This message is used when the object list contains a bitmap. |
| 28 // It is synchronized so that the renderer knows when it is safe to |
| 29 // free the shared memory used to transfer the bitmap. |
| 30 IPC_SYNC_MESSAGE_CONTROL2_0(ClipboardHostMsg_WriteObjectsSync, |
| 31 ui::Clipboard::ObjectMap /* objects */, |
| 32 base::SharedMemoryHandle /* bitmap handle */) |
26 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_GetSequenceNumber, | 33 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_GetSequenceNumber, |
27 ui::ClipboardType /* type */, | 34 ui::ClipboardType /* type */, |
28 uint64 /* result */) | 35 uint64 /* result */) |
29 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable, | 36 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable, |
30 content::ClipboardFormat /* format */, | 37 content::ClipboardFormat /* format */, |
31 ui::ClipboardType /* type */, | 38 ui::ClipboardType /* type */, |
32 bool /* result */) | 39 bool /* result */) |
33 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_Clear, | 40 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_Clear, |
34 ui::ClipboardType /* type */) | 41 ui::ClipboardType /* type */) |
35 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes, | 42 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes, |
(...skipping 14 matching lines...) Expand all Loading... |
50 std::string /* result */) | 57 std::string /* result */) |
51 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage, | 58 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage, |
52 ui::ClipboardType /* type */, | 59 ui::ClipboardType /* type */, |
53 base::SharedMemoryHandle /* PNG-encoded image */, | 60 base::SharedMemoryHandle /* PNG-encoded image */, |
54 uint32 /* image size */) | 61 uint32 /* image size */) |
55 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_ReadCustomData, | 62 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_ReadCustomData, |
56 ui::ClipboardType /* type */, | 63 ui::ClipboardType /* type */, |
57 base::string16 /* type */, | 64 base::string16 /* type */, |
58 base::string16 /* result */) | 65 base::string16 /* result */) |
59 | 66 |
60 // Writing to the clipboard via IPC is a two-phase operation. First, the sender | |
61 // sends the different types of data it'd like to write to the receiver. Then, | |
62 // it sends a commit message to commit the data to the system clipboard. | |
63 IPC_MESSAGE_CONTROL2(ClipboardHostMsg_WriteText, | |
64 ui::ClipboardType /* type */, | |
65 base::string16 /* text */) | |
66 IPC_MESSAGE_CONTROL3(ClipboardHostMsg_WriteHTML, | |
67 ui::ClipboardType /* type */, | |
68 base::string16 /* markup */, | |
69 GURL /* url */) | |
70 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteSmartPasteMarker, | |
71 ui::ClipboardType /* type */); | |
72 // Custom data consists of arbitrary MIME types an untrusted sender wants to | |
73 // write to the clipboard. Note that exposing a general interface to do this is | |
74 // dangerous--an untrusted sender could cause a DoS or code execution. | |
75 typedef std::map<base::string16, base::string16> CustomDataMap; | |
76 IPC_MESSAGE_CONTROL2(ClipboardHostMsg_WriteCustomData, | |
77 ui::ClipboardType /* type */, | |
78 CustomDataMap /* custom data */) | |
79 IPC_MESSAGE_CONTROL3(ClipboardHostMsg_WriteBookmark, | |
80 ui::ClipboardType /* type */, | |
81 GURL /* url */, | |
82 base::string16 /* title */) | |
83 IPC_SYNC_MESSAGE_CONTROL3_0(ClipboardHostMsg_WriteImage, | |
84 ui::ClipboardType /* type */, | |
85 gfx::Size /* size */, | |
86 base::SharedMemoryHandle /* bitmap handle */) | |
87 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_CommitWrite, ui::ClipboardType /* type */) | |
88 | |
89 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
90 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync, | 68 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync, |
91 base::string16 /* text */) | 69 base::string16 /* text */) |
92 #endif | 70 #endif |
OLD | NEW |