- add sources.
[platform/framework/web/crosswalk.git] / src / content / common / clipboard_messages.h
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/public/common/common_param_traits.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_param_traits.h"
14 #include "ui/base/clipboard/clipboard.h"
15
16 #define IPC_MESSAGE_START ClipboardMsgStart
17
18 #ifndef CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
19 #define CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
20
21 namespace IPC {
22
23 template<>
24 struct ParamTraits<ui::Clipboard::FormatType> {
25   typedef ui::Clipboard::FormatType param_type;
26   static void Write(Message* m, const param_type& p);
27   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
28   static void Log(const param_type& p, std::string* l);
29 };
30
31 }  // namespace IPC
32
33 #endif  // CONTENT_COMMON_CLIPBOARD_MESSAGES_H_
34
35 IPC_ENUM_TRAITS(ui::ClipboardType)
36
37 // Clipboard IPC messages sent from the renderer to the browser.
38
39 // This message is used when the object list does not contain a bitmap.
40 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteObjectsAsync,
41                      ui::Clipboard::ObjectMap /* objects */)
42 // This message is used when the object list contains a bitmap.
43 // It is synchronized so that the renderer knows when it is safe to
44 // free the shared memory used to transfer the bitmap.
45 IPC_SYNC_MESSAGE_CONTROL2_0(ClipboardHostMsg_WriteObjectsSync,
46                             ui::Clipboard::ObjectMap /* objects */,
47                             base::SharedMemoryHandle /* bitmap handle */)
48 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_GetSequenceNumber,
49                             ui::ClipboardType /* type */,
50                             uint64 /* result */)
51 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable,
52                             ui::Clipboard::FormatType /* format */,
53                             ui::ClipboardType /* type */,
54                             bool /* result */)
55 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_Clear,
56                      ui::ClipboardType /* type */)
57 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes,
58                             ui::ClipboardType /* type */,
59                             std::vector<string16> /* types */,
60                             bool /* contains filenames */)
61 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadText,
62                             ui::ClipboardType /* type */,
63                             string16 /* result */)
64 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadAsciiText,
65                             ui::ClipboardType /* type */,
66                             std::string /* result */)
67 IPC_SYNC_MESSAGE_CONTROL1_4(ClipboardHostMsg_ReadHTML,
68                             ui::ClipboardType /* type */,
69                             string16 /* markup */,
70                             GURL /* url */,
71                             uint32 /* fragment start */,
72                             uint32 /* fragment end */)
73 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadRTF,
74                             ui::ClipboardType /* type */,
75                             std::string /* result */)
76 IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage,
77                             ui::ClipboardType /* type */,
78                             base::SharedMemoryHandle /* PNG-encoded image */,
79                             uint32 /* image size */)
80 IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_ReadCustomData,
81                             ui::ClipboardType /* type */,
82                             string16 /* type */,
83                             string16 /* result */)
84 IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadData,
85                             ui::Clipboard::FormatType /* format */,
86                             std::string /* result */)
87
88 #if defined(OS_MACOSX)
89 IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync,
90                      string16 /* text */)
91 #endif