1 // Copyright 2015 Samsung Electronics. 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 file, no traditional include guard.
7 #include "base/values.h"
8 #include "common/print_pages_params.h"
9 #include "common/hit_test_params.h"
10 #include "common/error_params.h"
11 #include "common/cache_params_efl.h"
12 #include "common/navigation_policy_params.h"
13 #include "ipc/ipc_message_macros.h"
14 #include "ipc/ipc_channel_handle.h"
15 #include "private/ewk_hit_test_private.h"
16 #include "private/ewk_text_style_private.h"
17 #include "private/ewk_wrt_private.h"
18 #include "public/ewk_view.h"
19 #include "tizen_webview/public/tw_hit_test.h"
20 #include "tizen_webview/public/tw_settings.h"
21 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
22 #include "third_party/WebKit/public/web/WebNavigationType.h"
23 #include "third_party/WebKit/public/web/WebViewModeEnums.h"
25 typedef std::map<std::string, std::string> StringMap;
27 #define IPC_MESSAGE_START EwkMsgStart
29 IPC_STRUCT_TRAITS_BEGIN(Ewk_Wrt_Message_Data)
30 IPC_STRUCT_TRAITS_MEMBER(type)
31 IPC_STRUCT_TRAITS_MEMBER(value)
32 IPC_STRUCT_TRAITS_MEMBER(id)
33 IPC_STRUCT_TRAITS_MEMBER(reference_id)
34 IPC_STRUCT_TRAITS_END()
36 IPC_STRUCT_TRAITS_BEGIN(tizen_webview::Settings)
37 IPC_STRUCT_TRAITS_MEMBER(javascript_can_open_windows)
38 IPC_STRUCT_TRAITS_END()
40 IPC_STRUCT_TRAITS_BEGIN(ErrorParams)
41 IPC_STRUCT_TRAITS_MEMBER(url)
42 IPC_STRUCT_TRAITS_MEMBER(is_main_frame)
43 IPC_STRUCT_TRAITS_MEMBER(code)
44 IPC_STRUCT_TRAITS_MEMBER(description)
45 IPC_STRUCT_TRAITS_MEMBER(domain)
46 IPC_STRUCT_TRAITS_END()
48 IPC_STRUCT_TRAITS_BEGIN(Hit_Test_Params::Node_Data)
49 IPC_STRUCT_TRAITS_MEMBER(tagName)
50 IPC_STRUCT_TRAITS_MEMBER(nodeValue)
51 IPC_STRUCT_TRAITS_MEMBER(attributes)
52 IPC_STRUCT_TRAITS_END()
54 IPC_STRUCT_TRAITS_BEGIN(Hit_Test_Params::Image_Data)
55 IPC_STRUCT_TRAITS_MEMBER(fileNameExtension)
56 IPC_STRUCT_TRAITS_MEMBER(imageBitmap)
57 IPC_STRUCT_TRAITS_END()
59 IPC_STRUCT_TRAITS_BEGIN(Hit_Test_Params)
60 IPC_STRUCT_TRAITS_MEMBER(context)
61 IPC_STRUCT_TRAITS_MEMBER(linkURI)
62 IPC_STRUCT_TRAITS_MEMBER(linkTitle)
63 IPC_STRUCT_TRAITS_MEMBER(linkLabel)
64 IPC_STRUCT_TRAITS_MEMBER(imageURI)
65 IPC_STRUCT_TRAITS_MEMBER(mediaURI)
66 IPC_STRUCT_TRAITS_MEMBER(isEditable)
67 IPC_STRUCT_TRAITS_MEMBER(mode)
68 IPC_STRUCT_TRAITS_MEMBER(nodeData)
69 IPC_STRUCT_TRAITS_MEMBER(imageData)
70 IPC_STRUCT_TRAITS_END()
72 IPC_ENUM_TRAITS(Ewk_CSP_Header_Type)
74 IPC_ENUM_TRAITS(tizen_webview::Hit_Test_Mode)
76 IPC_STRUCT_TRAITS_BEGIN(DidPrintPagesParams)
77 IPC_STRUCT_TRAITS_MEMBER(metafile_data_handle)
78 IPC_STRUCT_TRAITS_MEMBER(data_size)
79 IPC_STRUCT_TRAITS_MEMBER(document_cookie)
80 IPC_STRUCT_TRAITS_MEMBER(filename)
81 IPC_STRUCT_TRAITS_END()
83 IPC_STRUCT_TRAITS_BEGIN(CacheParamsEfl)
84 IPC_STRUCT_TRAITS_MEMBER(cache_total_capacity)
85 IPC_STRUCT_TRAITS_MEMBER(cache_min_dead_capacity)
86 IPC_STRUCT_TRAITS_MEMBER(cache_max_dead_capacity)
87 IPC_STRUCT_TRAITS_END()
89 IPC_STRUCT_TRAITS_BEGIN(SelectionStylePrams)
90 IPC_STRUCT_TRAITS_MEMBER(underline_state)
91 IPC_STRUCT_TRAITS_MEMBER(italic_state)
92 IPC_STRUCT_TRAITS_MEMBER(bold_state)
93 IPC_STRUCT_TRAITS_MEMBER(bg_color)
94 IPC_STRUCT_TRAITS_MEMBER(color)
95 IPC_STRUCT_TRAITS_MEMBER(font_size)
96 IPC_STRUCT_TRAITS_MEMBER(order_list_state)
97 IPC_STRUCT_TRAITS_MEMBER(un_order_list_state)
98 IPC_STRUCT_TRAITS_MEMBER(text_align_center_state)
99 IPC_STRUCT_TRAITS_MEMBER(text_align_left_state)
100 IPC_STRUCT_TRAITS_MEMBER(text_align_right_state)
101 IPC_STRUCT_TRAITS_MEMBER(text_align_full_state)
102 IPC_STRUCT_TRAITS_MEMBER(has_composition)
103 IPC_STRUCT_TRAITS_END()
105 IPC_STRUCT_TRAITS_BEGIN(SelectionColor)
106 IPC_STRUCT_TRAITS_MEMBER(r)
107 IPC_STRUCT_TRAITS_MEMBER(g)
108 IPC_STRUCT_TRAITS_MEMBER(b)
109 IPC_STRUCT_TRAITS_MEMBER(a)
110 IPC_STRUCT_TRAITS_END()
112 IPC_ENUM_TRAITS(blink::WebNavigationPolicy)
113 IPC_ENUM_TRAITS(blink::WebNavigationType)
115 IPC_STRUCT_TRAITS_BEGIN(NavigationPolicyParams)
116 IPC_STRUCT_TRAITS_MEMBER(render_view_id)
117 IPC_STRUCT_TRAITS_MEMBER(cookie)
118 IPC_STRUCT_TRAITS_MEMBER(url)
119 IPC_STRUCT_TRAITS_MEMBER(httpMethod)
120 IPC_STRUCT_TRAITS_MEMBER(referrer)
121 IPC_STRUCT_TRAITS_MEMBER(policy)
122 IPC_STRUCT_TRAITS_MEMBER(type)
123 IPC_STRUCT_TRAITS_MEMBER(should_replace_current_entry)
124 IPC_STRUCT_TRAITS_MEMBER(is_main_frame)
125 IPC_STRUCT_TRAITS_MEMBER(is_redirect)
126 IPC_STRUCT_TRAITS_END()
128 IPC_ENUM_TRAITS(blink::WebViewMode)
131 IPC_MESSAGE_CONTROL4(WrtMsg_SetWidgetInfo,
132 int, // result: widgetHandle
133 double, // result: scale
134 std::string, // result: theme
135 std::string) // result: encodedBundle
137 IPC_MESSAGE_CONTROL2(WrtMsg_ParseUrl,
138 int, // result: request_id
141 IPC_MESSAGE_CONTROL2(WrtMsg_ParseUrlResponse,
142 int, // result: request_id
145 IPC_MESSAGE_CONTROL1(WrtMsg_SendWrtMessage,
146 Ewk_Wrt_Message_Data /* data */);
148 IPC_SYNC_MESSAGE_ROUTED1_1(EwkHostMsg_WrtSyncMessage,
149 Ewk_Wrt_Message_Data /* data */,
150 std::string /*result*/);
152 IPC_MESSAGE_ROUTED1(EwkHostMsg_WrtMessage,
153 Ewk_Wrt_Message_Data /* data */);
155 IPC_MESSAGE_CONTROL2(EwkViewHostMsg_HitTestReply,
156 int, /* render_view_id */
159 IPC_MESSAGE_CONTROL3(EwkViewHostMsg_HitTestAsyncReply,
160 int, /* render_view_id */
162 int64_t /* request id */)
164 IPC_MESSAGE_ROUTED1(EwkViewMsg_DidFailLoadWithError,
165 ErrorParams /* error */)
167 IPC_MESSAGE_ROUTED2(EwkViewMsg_SetCSP,
168 std::string, /* policy */
169 Ewk_CSP_Header_Type /* header type */)
171 IPC_SYNC_MESSAGE_ROUTED0_2(EwkHostMsg_GetContentSecurityPolicy,
172 std::string, /* policy */
173 Ewk_CSP_Header_Type /* header type */)
175 IPC_MESSAGE_ROUTED3(EwkViewMsg_Scale,
176 double, /* scale factor */
180 IPC_MESSAGE_ROUTED1(EwkHostMsg_DidPrintPagesToPdf,
181 DidPrintPagesParams /* pdf document parameters */)
183 IPC_MESSAGE_CONTROL0(EflViewMsg_ClearCache)
184 IPC_MESSAGE_CONTROL1(EflViewMsg_SetCache,
187 // Tells the renderer to dump as much memory as it can, perhaps because we
188 // have memory pressure or the renderer is (or will be) paged out. This
189 // should only result in purging objects we can recalculate, e.g. caches or
190 // JS garbage, not in purging irreplaceable objects.
191 IPC_MESSAGE_CONTROL0(EwkViewMsg_PurgeMemory)
193 IPC_MESSAGE_ROUTED3(EwkViewMsg_PrintToPdf,
196 base::FilePath /* file name to save pdf*/)
198 IPC_MESSAGE_ROUTED1(EwkViewMsg_GetMHTMLData,
199 int /* callback id */)
201 IPC_MESSAGE_ROUTED3(EwkViewMsg_DoHitTest,
202 int, /* horizontal position */
203 int, /* vertical position */
204 tizen_webview::Hit_Test_Mode /* mode */)
206 IPC_MESSAGE_ROUTED4(EwkViewMsg_DoHitTestAsync,
207 int, /* horizontal position */
208 int, /* vertical position */
209 tizen_webview::Hit_Test_Mode, /* mode */
210 int64_t /* request id */)
212 // Tells the renderer to clear the cache.
213 IPC_MESSAGE_ROUTED0(EwkViewMsg_UseSettingsFont)
214 IPC_MESSAGE_ROUTED0(EwkViewMsg_SetBrowserFont)
215 IPC_MESSAGE_ROUTED0(EwkViewMsg_SuspendScheduledTask)
216 IPC_MESSAGE_ROUTED0(EwkViewMsg_ResumeScheduledTasks)
218 IPC_MESSAGE_ROUTED0(EwkViewMsg_GetSelectionStyle)
220 IPC_MESSAGE_ROUTED2(EwkViewMsg_SetScroll,
221 int, /* horizontal position */
222 int /* vertical position */)
224 IPC_MESSAGE_ROUTED1(EwkViewMsg_PlainTextGet,
225 int /* callback id */)
227 IPC_MESSAGE_ROUTED1(EwkViewMsg_SelectionTextStyleState,
228 SelectionStylePrams /* params */)
230 IPC_MESSAGE_ROUTED1(EflViewMsg_UpdateSettings, tizen_webview::Settings)
232 IPC_MESSAGE_ROUTED2(EwkHostMsg_PlainTextGetContents,
233 std::string, /* contentText */
234 int /* callback id */)
236 IPC_MESSAGE_ROUTED2(EwkHostMsg_DidChangeContentsSize,
240 IPC_MESSAGE_ROUTED2(EwkHostMsg_DidChangeMaxScrollOffset,
244 IPC_MESSAGE_ROUTED2(EwkHostMsg_DidChangeScrollOffset,
248 IPC_MESSAGE_ROUTED2(EwkHostMsg_ReadMHTMLData,
249 std::string, /* Mhtml text */
250 int /* callback id */)
252 IPC_MESSAGE_ROUTED1(EwkHostMsg_DidChangePageScaleFactor,
253 double /* page scale factor */)
255 IPC_MESSAGE_ROUTED2(EwkHostMsg_DidChangePageScaleRange,
256 double, /* minimum page scale factor */
257 double /* maximum page scale factor */)
259 IPC_MESSAGE_ROUTED1(EwkViewMsg_SetDrawsTransparentBackground,
262 // Notifies the browser to form submit
263 IPC_MESSAGE_ROUTED1(EwkHostMsg_FormSubmit, GURL)
265 IPC_MESSAGE_ROUTED1(EwkViewMsg_WebAppIconUrlGet,
266 int /* callback id */)
268 IPC_MESSAGE_ROUTED2(EwkHostMsg_WebAppIconUrlGet,
269 std::string, /* icon url */
270 int /* callback id */)
272 IPC_MESSAGE_ROUTED1(EwkViewMsg_WebAppIconUrlsGet,
273 int /* callback id */)
275 IPC_MESSAGE_ROUTED2(EwkHostMsg_WebAppIconUrlsGet,
276 StringMap, /* icon urls */
277 int /* callback id */)
279 IPC_MESSAGE_ROUTED1(EwkViewMsg_WebAppCapableGet,
280 int /* calback id */)
282 IPC_MESSAGE_ROUTED2(EwkHostMsg_WebAppCapableGet,
284 int /* calback id */)
286 IPC_SYNC_MESSAGE_CONTROL1_1(EwkHostMsg_DecideNavigationPolicy,
287 NavigationPolicyParams,
290 IPC_MESSAGE_ROUTED1(ViewMsg_SetViewMode,
291 blink::WebViewMode /* view_mode */)