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