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