Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / metro_viewer / metro_viewer_messages.h
1 // Copyright 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, no include guard.
6
7 #include <vector>
8
9 #include "base/basictypes.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "ui/events/event_constants.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/metro_viewer/ime_types.h"
14
15 #define IPC_MESSAGE_START MetroViewerMsgStart
16
17 IPC_ENUM_TRAITS(ui::EventType)
18 IPC_ENUM_TRAITS(ui::EventFlags)
19
20 // Contains the parameters sent for a mousebutton message.
21 IPC_STRUCT_BEGIN(MetroViewerHostMsg_MouseButtonParams)
22
23   IPC_STRUCT_MEMBER(int32, x)
24   IPC_STRUCT_MEMBER(int32, y)
25   IPC_STRUCT_MEMBER(int32, extra)
26   IPC_STRUCT_MEMBER(ui::EventType, event_type)
27   IPC_STRUCT_MEMBER(uint32, flags)
28   IPC_STRUCT_MEMBER(ui::EventFlags, changed_button)
29   IPC_STRUCT_MEMBER(bool, is_horizontal_wheel)
30
31 IPC_STRUCT_END()
32
33 // Messages sent from the viewer to the browser:
34
35 // Inform the browser of the surface to target for compositing.
36 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetTargetSurface,
37                      gfx::NativeViewId /* target hwnd */)
38 // Informs the browser that the mouse moved.
39 IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_MouseMoved,
40                      int32,       /* x-coordinate */
41                      int32,       /* y-coordinate */
42                      int32        /* flags */)
43 // Informs the brower that a mouse button was pressed.
44 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_MouseButton,
45                      MetroViewerHostMsg_MouseButtonParams)
46 // Informs the browser that a key was pressed.
47 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_KeyDown,
48                      uint32,       /* virtual key */
49                      uint32,       /* repeat count */
50                      uint32,       /* scan code */
51                      uint32        /* key state */);
52 // Informs the browser that a key was released.
53 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_KeyUp,
54                      uint32,       /* virtual key */
55                      uint32,       /* repeat count */
56                      uint32,       /* scan code */
57                      uint32        /* key state */);
58 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_Character,
59                      uint32,       /* virtual key */
60                      uint32,       /* repeat count */
61                      uint32,       /* scan code */
62                      uint32        /* key state */);
63 // Informs the browser that the Metro window has been activated.
64 IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_WindowActivated);
65
66 // Informs the browser that the user has completed an edge gesture.
67 IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_EdgeGesture)
68
69 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchDown,
70                      int32,           /* x-coordinate */
71                      int32,           /* y-coordinate */
72                      uint64,          /* timestamp */
73                      uint32)          /* pointer_id */
74 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchUp,
75                      int32,           /* x-coordinate */
76                      int32,           /* y-coordinate */
77                      uint64,          /* timestamp */
78                      uint32)          /* pointer_id */
79 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchMoved,
80                      int32,           /* x-coordinate */
81                      int32,           /* y-coordinate */
82                      uint64,          /* timestamp */
83                      uint32)          /* pointer_id */
84
85 // Informs the browser of the result of a file save as operation.
86 IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_FileSaveAsDone,
87                      bool,           /* success */
88                      base::FilePath, /* filename */
89                      int)            /* filter_index */
90
91 // Informs the browser of the result of a file open operation.
92 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_FileOpenDone,
93                      bool,           /* success */
94                      base::FilePath) /* filename */
95
96 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_MultiFileOpenDone,
97                      bool,                    /* success */
98                      std::vector<base::FilePath>)   /* filenames */
99
100 // Informs the browser of the result of a select folder operation.
101 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_SelectFolderDone,
102                      bool,           /* success */
103                      base::FilePath) /* filepath*/
104
105 // Messages sent from the browser to the viewer:
106
107 // Requests the viewer to activate desktop mode.
108 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_ActivateDesktop,
109                      base::FilePath /* shortcut */,
110                      bool           /* ash exit */);
111
112 // Request the viewer to close itself gracefully.
113 IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_MetroExit);
114
115 // Requests the viewer to open a URL in desktop mode.
116 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_OpenURLOnDesktop,
117                      base::FilePath,  /* shortcut */
118                      base::string16         /* url */);
119
120 // Requests the viewer to change the pointer to a new cursor.
121 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetCursor,
122                      int64         /* cursor */);
123
124 // This structure contains the parameters sent to the viewer process to display
125 // the file save dialog.
126 IPC_STRUCT_BEGIN(MetroViewerHostMsg_SaveAsDialogParams)
127
128   // The title of the file save dialog if any.
129   IPC_STRUCT_MEMBER(base::string16, title)
130
131   // The suggested file name.
132   IPC_STRUCT_MEMBER(base::FilePath, suggested_name)
133
134   // The save as filter to be used.
135   IPC_STRUCT_MEMBER(base::string16, filter)
136
137   // The filter index.
138   IPC_STRUCT_MEMBER(uint32, filter_index)
139
140   // The default extension.
141   IPC_STRUCT_MEMBER(base::string16, default_extension)
142
143 IPC_STRUCT_END()
144
145 // Requests the viewer to display the file save dialog.
146 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_DisplayFileSaveAs,
147                      MetroViewerHostMsg_SaveAsDialogParams)
148
149 // Requests the viewer to display the file open dialog.
150 IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_DisplayFileOpen,
151                      base::string16,       /* title */
152                      base::string16,       /* filter */
153                      base::FilePath, /* Default path */
154                      bool)           /* allow_multi_select */
155
156 // Requests the viewer to display the select folder dialog.
157 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_DisplaySelectFolder,
158                      base::string16)   /* title */
159
160 // Sent to the viewer process to set the cursor position.
161 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_SetCursorPos,
162                      int,  /* x */
163                      int)  /* y */
164
165 // Ack sent by the viewer process indicating that the SetCursorPos operation
166 // was completed.
167 IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_SetCursorPosAck)
168
169 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_OpenURL,
170                      base::string16)  /* url */
171
172 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SearchRequest,
173                      base::string16)  /* search_string */
174
175 // Sent from the metro viewer process to the browser process to indicate that
176 // the viewer window size has changed.
177 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_WindowSizeChanged,
178                      uint32,   /* width */
179                      uint32)   /* height */
180
181 IPC_STRUCT_TRAITS_BEGIN(metro_viewer::UnderlineInfo)
182   IPC_STRUCT_TRAITS_MEMBER(start_offset)
183   IPC_STRUCT_TRAITS_MEMBER(end_offset)
184   IPC_STRUCT_TRAITS_MEMBER(thick)
185 IPC_STRUCT_TRAITS_END()
186
187 // Sent from the metro viewer process to the browser process to update the
188 // composition string.
189 IPC_MESSAGE_CONTROL4(
190     MetroViewerHostMsg_ImeCompositionChanged,
191     base::string16,                                  /* text */
192     int32,                                     /* selection_start */
193     int32,                                     /* selection_end */
194     std::vector<metro_viewer::UnderlineInfo>)  /* underlines */
195
196 // Sent from the metro viewer process to the browser process to update the
197 // status of popup window that is managed by an IME.
198 IPC_MESSAGE_CONTROL1(
199     MetroViewerHostMsg_ImeCandidatePopupChanged,
200     bool)                                      /* UI visibility */
201
202 // Sent from the metro viewer process to the browser process to commit strings.
203 IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_ImeTextCommitted,
204                      base::string16)                 /* text */
205
206 // Sent from the metro viewer process to the browser process to notify that the
207 // active text input source is changed.
208 IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_ImeInputSourceChanged,
209                      uint16,                   /* Win32 LangID */
210                      bool)                     /* is IME or not */
211
212 // Requests the viewer to cancel the on-going composition.
213 IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_ImeCancelComposition)
214
215 IPC_STRUCT_TRAITS_BEGIN(metro_viewer::CharacterBounds)
216   IPC_STRUCT_TRAITS_MEMBER(left)
217   IPC_STRUCT_TRAITS_MEMBER(top)
218   IPC_STRUCT_TRAITS_MEMBER(right)
219   IPC_STRUCT_TRAITS_MEMBER(bottom)
220 IPC_STRUCT_TRAITS_END()
221
222 // Requests the viewer to update the document context such as attached
223 // InputScopes and character bounds.
224 IPC_MESSAGE_CONTROL2(
225     MetroViewerHostMsg_ImeTextInputClientUpdated,
226     std::vector<int32>,                           /* InputScope enums */
227     std::vector<metro_viewer::CharacterBounds>)   /* character bounds */