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