[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / clipboard_messages.h
blob8e417c071f6f7be55d5e1d61b196ee1c396c1fa1
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
3 // found in the LICENSE file.
5 // Multiply-included message file, so no include guard.
7 #include <map>
8 #include <string>
9 #include <vector>
11 #include "base/memory/shared_memory.h"
12 #include "base/strings/string16.h"
13 #include "content/common/clipboard_format.h"
14 #include "content/public/common/common_param_traits.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "ui/base/clipboard/clipboard.h"
18 // Singly-included section for types and/or struct declarations.
19 #ifndef CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
20 #define CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
22 // Custom data consists of arbitrary MIME types an untrusted sender wants to
23 // write to the clipboard. Note that exposing a general interface to do this is
24 // dangerous--an untrusted sender could cause a DoS or code execution.
25 typedef std::map<base::string16, base::string16> CustomDataMap;
27 #endif // CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
29 #define IPC_MESSAGE_START ClipboardMsgStart
31 IPC_ENUM_TRAITS_MAX_VALUE(content::ClipboardFormat,
32 content::CLIPBOARD_FORMAT_LAST)
33 IPC_ENUM_TRAITS_MAX_VALUE(ui::ClipboardType, ui::CLIPBOARD_TYPE_LAST)
35 // Clipboard IPC messages sent from the renderer to the browser.
37 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_GetSequenceNumber,
38 ui::ClipboardType /* type */,
39 uint64 /* result */)
40 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable,
41 content::ClipboardFormat /* format */,
42 ui::ClipboardType /* type */,
43 bool /* result */)
44 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_Clear,
45 ui::ClipboardType /* type */)
46 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes,
47 ui::ClipboardType /* type */,
48 std::vector<base::string16> /* types */,
49 bool /* contains filenames */)
50 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadText,
51 ui::ClipboardType /* type */,
52 base::string16 /* result */)
53 IPC_SYNC_MESSAGE_CONTROL1_4(ClipboardHostMsg_ReadHTML,
54 ui::ClipboardType /* type */,
55 base::string16 /* markup */,
56 GURL /* url */,
57 uint32 /* fragment start */,
58 uint32 /* fragment end */)
59 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadRTF,
60 ui::ClipboardType /* type */,
61 std::string /* result */)
62 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage,
63 ui::ClipboardType /* type */,
64 base::SharedMemoryHandle /* PNG-encoded image */,
65 uint32 /* image size */)
66 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_ReadCustomData,
67 ui::ClipboardType /* type */,
68 base::string16 /* type */,
69 base::string16 /* result */)
71 // Writing to the clipboard via IPC is a two-phase operation. First, the sender
72 // sends the different types of data it'd like to write to the receiver. Then,
73 // it sends a commit message to commit the data to the system clipboard.
74 IPC_MESSAGE_CONTROL2(ClipboardHostMsg_WriteText,
75 ui::ClipboardType /* type */,
76 base::string16 /* text */)
77 IPC_MESSAGE_CONTROL3(ClipboardHostMsg_WriteHTML,
78 ui::ClipboardType /* type */,
79 base::string16 /* markup */,
80 GURL /* url */)
81 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteSmartPasteMarker,
82 ui::ClipboardType /* type */)
83 IPC_MESSAGE_CONTROL2(ClipboardHostMsg_WriteCustomData,
84 ui::ClipboardType /* type */,
85 CustomDataMap /* custom data */)
86 // TODO(dcheng): The |url| parameter should really be a GURL, but <canvas>'s
87 // copy as image tries to set very long data: URLs on the clipboard. Using
88 // GURL causes the browser to kill the renderer for sending a bad IPC (GURLs
89 // bigger than 2 megabytes are considered to be bad). https://crbug.com/459822
90 IPC_MESSAGE_CONTROL3(ClipboardHostMsg_WriteBookmark,
91 ui::ClipboardType /* type */,
92 std::string /* url */,
93 base::string16 /* title */)
94 IPC_SYNC_MESSAGE_CONTROL3_0(ClipboardHostMsg_WriteImage,
95 ui::ClipboardType /* type */,
96 gfx::Size /* size */,
97 base::SharedMemoryHandle /* bitmap handle */)
98 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_CommitWrite, ui::ClipboardType /* type */)
100 #if defined(OS_MACOSX)
101 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync,
102 base::string16 /* text */)
103 #endif