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.
4
5// Multiply-included message file, so no include guard.
6
7#include <string>
8#include <vector>
9
10#include "base/memory/shared_memory.h"
11#include "content/common/clipboard_format.h"
12#include "content/public/common/common_param_traits.h"
13#include "ipc/ipc_message_macros.h"
14#include "ui/base/clipboard/clipboard.h"
15
16#define IPC_MESSAGE_START ClipboardMsgStart
17
18IPC_ENUM_TRAITS_MAX_VALUE(content::ClipboardFormat,
19                          content::CLIPBOARD_FORMAT_LAST)
20IPC_ENUM_TRAITS_MAX_VALUE(ui::ClipboardType, ui::CLIPBOARD_TYPE_LAST)
21
22// Clipboard IPC messages sent from the renderer to the browser.
23
24// This message is used when the object list does not contain a bitmap.
25IPC_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.
30IPC_SYNC_MESSAGE_CONTROL2_0(ClipboardHostMsg_WriteObjectsSync,
31                            ui::Clipboard::ObjectMap /* objects */,
32                            base::SharedMemoryHandle /* bitmap handle */)
33IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_GetSequenceNumber,
34                            ui::ClipboardType /* type */,
35                            uint64 /* result */)
36IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable,
37                            content::ClipboardFormat /* format */,
38                            ui::ClipboardType /* type */,
39                            bool /* result */)
40IPC_MESSAGE_CONTROL1(ClipboardHostMsg_Clear,
41                     ui::ClipboardType /* type */)
42IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes,
43                            ui::ClipboardType /* type */,
44                            std::vector<base::string16> /* types */,
45                            bool /* contains filenames */)
46IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadText,
47                            ui::ClipboardType /* type */,
48                            base::string16 /* result */)
49IPC_SYNC_MESSAGE_CONTROL1_4(ClipboardHostMsg_ReadHTML,
50                            ui::ClipboardType /* type */,
51                            base::string16 /* markup */,
52                            GURL /* url */,
53                            uint32 /* fragment start */,
54                            uint32 /* fragment end */)
55IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadRTF,
56                            ui::ClipboardType /* type */,
57                            std::string /* result */)
58IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage,
59                            ui::ClipboardType /* type */,
60                            base::SharedMemoryHandle /* PNG-encoded image */,
61                            uint32 /* image size */)
62IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_ReadCustomData,
63                            ui::ClipboardType /* type */,
64                            base::string16 /* type */,
65                            base::string16 /* result */)
66
67#if defined(OS_MACOSX)
68IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync,
69                     base::string16 /* text */)
70#endif
71