Home | History | Annotate | Download | only in common
      1 // Copyright (c) 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 // Defines the IPC messages used by the automation interface.
      6 
      7 // NOTE: All IPC messages have either a routing_id of 0 (for asynchronous
      8 //       messages), or one that's been assigned by the proxy (for calls
      9 //       which expect a response).  The routing_id shouldn't be used for
     10 //       any other purpose in these message types.
     11 
     12 // NOTE: All the new IPC messages should go at the end.
     13 //       The test <--> browser IPC message IDs need to match the reference
     14 //       builds.  Since we now define the IDs based on __LINE__, to allow these
     15 //       IPC messages to be used to control an old version of Chrome we need
     16 //       the message IDs to remain the same.  This means that you should not
     17 //       change the line number of these types of messages.
     18 
     19 
     20 #define IPC_MESSAGE_START AutomationMsgStart
     21 
     22 // This message is fired when the AutomationProvider is up and running
     23 // in the app (the app is not fully up at this point). The parameter to this
     24 // message is the version string of the automation provider. This parameter
     25 // is defined to be the version string as returned by
     26 // chrome::VersionInfo::Version().
     27 // The client can choose to use this version string to decide whether or not
     28 // it can talk to the provider.
     29 IPC_MESSAGE_CONTROL1(AutomationMsg_Hello,
     30                      std::string)
     31 
     32 // This message is fired when the initial tab(s) are finished loading.
     33 IPC_MESSAGE_CONTROL0(AutomationMsg_InitialLoadsComplete)
     34 
     35 // This message notifies the AutomationProvider to append a new tab the
     36 // window with the given handle. The return value contains the index of
     37 // the new tab, or -1 if the request failed.
     38 // The second parameter is the url to be loaded in the new tab.
     39 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AppendTab,
     40                             int,
     41                             GURL,
     42                             int)
     43 
     44 // This message requests the (zero-based) index for the currently
     45 // active tab in the window with the given handle. The return value contains
     46 // the index of the active tab, or -1 if the request failed.
     47 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ActiveTabIndex,
     48                             int,
     49                             int)
     50 
     51 // This message notifies the AutomationProvider to active the tab.
     52 // The first parameter is the handle to window resource.
     53 // The second parameter is the (zero-based) index to be activated
     54 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActivateTab,
     55                             int,
     56                             int,
     57                             int)
     58 
     59 // This message requests the cookie value for given url in the
     60 // profile of the tab identified by the second parameter.  The first
     61 // parameter is the URL string. The response contains the length of the
     62 // cookie value string. On failure, this length = -1.
     63 IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetCookies,
     64                             GURL,
     65                             int,
     66                             int,
     67                             std::string)
     68 
     69 // This message notifies the AutomationProvider to set and broadcast a cookie
     70 // with given name and value for the given url in the profile of the tab
     71 // identified by the third parameter. The first parameter is the URL
     72 // string, and the second parameter is the cookie name and value to be set.
     73 // The return value is a non-negative value on success.
     74 IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DEPRECATED_SetCookie,
     75                             GURL,
     76                             std::string,
     77                             int,
     78                             int)
     79 
     80 // This message is used to implement the asynchronous version of
     81 // NavigateToURL.
     82 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigationAsync,
     83                             int /* tab handle */,
     84                             GURL,
     85                             bool /* result */)
     86 
     87 // This message requests the number of browser windows that the app currently
     88 // has open.  The return value is the number of windows.
     89 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_BrowserWindowCount,
     90                             int)
     91 
     92 // This message requests the handle (int64 app-unique identifier) of the
     93 // window with the given (zero-based) index.  On error, the returned handle
     94 // value is 0.
     95 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BrowserWindow,
     96                             int,
     97                             int)
     98 
     99 // This message requests the number of tabs in the window with the given
    100 // handle.  The return value contains the number of tabs, or -1 if the
    101 // request failed.
    102 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabCount,
    103                             int,
    104                             int)
    105 
    106 // This message requests the handle of the tab with the given (zero-based)
    107 // index in the given app window. First parameter specifies the given window
    108 // handle, second specifies the given tab_index. On error, the returned handle
    109 // value is 0.
    110 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab,
    111                             int,
    112                             int,
    113                             int)
    114 
    115 // This message requests the the title of the tab with the given handle.
    116 // The return value contains the size of the title string. On error, this
    117 // value should be -1 and empty string. Note that the title can be empty in
    118 // which case the size would be 0.
    119 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabTitle,
    120                             int,
    121                             int,
    122                             std::wstring)
    123 
    124 // This message requests the url of the tab with the given handle.
    125 // The return value contains a success flag and the URL string. The URL will
    126 // be empty on failure, and it still may be empty on success.
    127 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabURL,
    128                             int /* tab handle */,
    129                             bool /* success flag */,
    130                             GURL)
    131 
    132 // This message notifies the AutomationProxy that a handle that it has
    133 // previously been given is now invalid.  (For instance, if the handle
    134 // represented a window which has now been closed.)  The parameter
    135 // value is the handle.
    136 IPC_MESSAGE_CONTROL1(AutomationMsg_InvalidateHandle,
    137                      int)
    138 
    139 // This message notifies the AutomationProvider that a handle is no
    140 // longer being used, so it can stop paying attention to the
    141 // associated resource.  The parameter value is the handle.
    142 IPC_MESSAGE_CONTROL1(AutomationMsg_HandleUnused,
    143                      int)
    144 
    145 // This message requests that the AutomationProvider executes a JavaScript,
    146 // which is sent embedded in a 'javascript:' URL.
    147 // The javascript is executed in context of child frame whose xpath
    148 // is passed as parameter (context_frame). The execution results in
    149 // a serialized JSON string response.
    150 IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DomOperation,
    151                             int /* tab handle */,
    152                             std::wstring /* context_frame */,
    153                             std::wstring /* the javascript to be executed */,
    154                             std::string /* the serialized json string containg
    155                                            the result of a javascript
    156                                            execution */)
    157 
    158 // Is the Download Shelf visible for the specified browser?
    159 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DEPRECATED_ShelfVisibility,
    160                             int /* browser_handle */,
    161                             bool /* is_visible */)
    162 
    163 // This message requests the bounds of the specified View element in
    164 // window coordinates.
    165 // Request:
    166 //   int - the handle of the window in which the view appears
    167 //   int - the ID of the view, as specified in chrome/browser/ui/view_ids.h
    168 //   bool - whether the bounds should be returned in the screen coordinates
    169 //          (if true) or in the browser coordinates (if false).
    170 // Response:
    171 //   bool - true if the view was found
    172 //   gfx::Rect - the bounds of the view, in window coordinates
    173 IPC_SYNC_MESSAGE_CONTROL3_2(AutomationMsg_WindowViewBounds,
    174                             int,
    175                             int,
    176                             bool,
    177                             bool,
    178                             gfx::Rect)
    179 
    180 // This message sets the bounds of the window.
    181 // Request:
    182 //   int - the handle of the window to resize
    183 //   gfx::Rect - the bounds of the window
    184 // Response:
    185 //   bool - true if the resize was successful
    186 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds,
    187                             int,
    188                             gfx::Rect,
    189                             bool)
    190 
    191 // TODO(port): Port these messages.
    192 //
    193 // This message requests that a drag be performed in window coordinate space
    194 // Request:
    195 //   int - the handle of the window that's the context for this drag
    196 //   std::vector<gfx::Point> - the path of the drag in window coordinate
    197 //                             space; it should have at least 2 points
    198 //                             (start and end)
    199 //   int - the flags which identify the mouse button(s) for the drag, as
    200 //         defined in chrome/views/event.h
    201 // Response:
    202 //   bool - true if the drag could be performed
    203 IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_DEPRECATED_WindowDrag,
    204                            int,
    205                            std::vector<gfx::Point>,
    206                            int,
    207                            bool,
    208                            bool)
    209 
    210 // Similar to AutomationMsg_InitialLoadsComplete, this indicates that the
    211 // new tab ui has completed the initial load of its data.
    212 // Time is how many milliseconds the load took.
    213 IPC_MESSAGE_CONTROL1(AutomationMsg_InitialNewTabUILoadComplete,
    214                     int /* time */)
    215 
    216 // This tells the browser to enable or disable the filtered network layer.
    217 IPC_MESSAGE_CONTROL1(AutomationMsg_DEPRECATED_SetFilteredInet,
    218                      bool /* enabled */)
    219 
    220 // Gets the directory that downloads will occur in for the active profile.
    221 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DEPRECATED_DownloadDirectory,
    222                             int /* tab_handle */,
    223                             base::FilePath /* directory */)
    224 
    225 // Opens a new browser window.
    226 // TODO(sky): remove this and replace with OpenNewBrowserWindowOfType.
    227 // Doing this requires updating the reference build.
    228 IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_OpenNewBrowserWindow,
    229                             bool /* show */ )
    230 
    231 // This message requests the handle (int64 app-unique identifier) of the
    232 // current active top window.  On error, the returned handle value is 0.
    233 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_DEPRECATED_ActiveWindow,
    234                             int)
    235 
    236 // This message requests the window associated with the specified browser
    237 // handle.
    238 // The return value contains a success flag and the handle of the window.
    239 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_WindowForBrowser,
    240                             int /* browser handle */,
    241                             bool /* success flag */,
    242                             int /* window handle */)
    243 
    244 // This message requests that a key press be performed.
    245 // Request:
    246 //   int - the handle of the window that's the context for this click
    247 //   int - the ui::KeyboardCode of the key that was pressed.
    248 //   int - the flags which identify the modifiers (shift, ctrl, alt)
    249 //         associated for, as defined in chrome/views/event.h
    250 IPC_MESSAGE_CONTROL3(AutomationMsg_DEPRECATED_WindowKeyPress,
    251                      int,
    252                      int,
    253                      int)
    254 #if defined(OS_WIN)
    255 // This message notifies the AutomationProvider to create a tab which is
    256 // hosted by an external process.
    257 // Request:
    258 //   ExternalTabSettings - settings for external tab
    259 IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_CreateExternalTab,
    260                             ExternalTabSettings  /* settings*/,
    261                             HWND  /* Tab container window */,
    262                             HWND  /* Tab window */,
    263                             int  /* Handle to the new tab */,
    264                             int  /* Session Id of the new tab */)
    265 #endif  // defined(OS_WIN)
    266 // This message notifies the AutomationProvider to navigate to a specified
    267 // url in the external tab with given handle. The first parameter is the
    268 // handle to the tab resource. The second parameter is the target url.
    269 // The third parameter is the referrer.
    270 // The return value contains a status code which is nonnegative on success.
    271 // see AutomationMsg_NavigationResponseValues for the navigation response.
    272 IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigateInExternalTab,
    273                             int,
    274                             GURL,
    275                             GURL,
    276                             AutomationMsg_NavigationResponseValues)
    277 
    278 // This message is an outgoing message from Chrome to an external host.
    279 // It is a notification that the NavigationState was changed
    280 // Request:
    281 //   -int: The flags specifying what changed
    282 //         (see content::InvalidateTypes)
    283 // Response:
    284 //   None expected
    285 IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationStateChanged,
    286                     int,  // content::InvalidateTypes
    287                     NavigationInfo)  // title, url etc.
    288 
    289 // This message is an outgoing message from Chrome to an external host.
    290 // It is a notification that the target URL has changed (the target URL
    291 // is the URL of the link that the user is hovering on)
    292 // Request:
    293 //   -std::wstring: The new target URL
    294 // Response:
    295 //   None expected
    296 IPC_MESSAGE_ROUTED1(AutomationMsg_UpdateTargetUrl,
    297                     std::wstring)
    298 
    299 
    300 // This message requests that a tab be closed.
    301 // Request:
    302 //   - int: handle of the tab to close
    303 //   - bool: if true the proxy blocks until the tab has completely closed,
    304 //           otherwise the proxy only blocks until it initiates the close.
    305 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CloseTab,
    306                             int,
    307                             bool,
    308                             bool)
    309 
    310 // This message requests that the browser be closed.
    311 // Request:
    312 //   - int: handle of the browser which contains the tab
    313 // Response:
    314 //  - bool: whether the operation was successfull.
    315 //  - bool: whether the browser process will be terminated as a result (if
    316 //          this was the last closed browser window).
    317 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_CloseBrowser,
    318                             int,
    319                             bool,
    320                             bool)
    321 
    322 #if defined(OS_WIN)
    323 // TODO(port): Port these messages.
    324 //
    325 // This message is an outgoing message from Chrome to an external host.
    326 // It is a request to process a keyboard accelerator.
    327 // Request:
    328 //   -MSG: The keyboard message
    329 // Response:
    330 //   None expected
    331 // TODO(sanjeevr): Ideally we need to add a response from the external
    332 // host saying whether it processed the accelerator
    333 IPC_MESSAGE_ROUTED1(AutomationMsg_HandleAccelerator,
    334                     MSG)
    335 
    336 // This message is sent by the container of an externally hosted tab to
    337 // reflect any accelerator keys that it did not process. This gives the
    338 // tab a chance to handle the keys
    339 // Request:
    340 //   - int: handle of the tab
    341 //   -MSG: The keyboard message that the container did not handle
    342 // Response:
    343 //   None expected
    344 IPC_MESSAGE_CONTROL2(AutomationMsg_ProcessUnhandledAccelerator,
    345                      int,
    346                      MSG)
    347 #endif  // defined(OS_WIN)
    348 
    349 // Sent by the external tab to the host to notify that the user has tabbed
    350 // out of the tab.
    351 // Request:
    352 //   - bool: |reverse| set to true when shift-tabbing out of the tab, false
    353 //    otherwise.
    354 // Response:
    355 //   None expected
    356 IPC_MESSAGE_ROUTED1(AutomationMsg_TabbedOut,
    357                     bool)
    358 
    359 // Sent by the external tab host to ask focus to be set to either the first
    360 // or last element on the page.
    361 // Request:
    362 //   - int: handle of the tab
    363 //   - bool: |reverse|
    364 //      true: Focus will be set to the last focusable element
    365 //      false: Focus will be set to the first focusable element
    366 //   - bool: |restore_focus_to_view|
    367 //      true: The renderer view associated with the current tab will be
    368 //            infomed that it is receiving focus.
    369 // Response:
    370 //   None expected
    371 IPC_MESSAGE_CONTROL3(AutomationMsg_SetInitialFocus,
    372                      int,
    373                      bool,
    374                      bool)
    375 
    376 // This message is an outgoing message from Chrome to an external host.
    377 // It is a request to open a url
    378 // Request:
    379 //   -GURL: The URL to open
    380 //   -GURL: The referrer
    381 //   -int: The WindowOpenDisposition that specifies where the URL should
    382 //         be opened (new tab, new window etc).
    383 // Response:
    384 //   None expected
    385 IPC_MESSAGE_ROUTED3(AutomationMsg_OpenURL,
    386                     GURL,
    387                     GURL,
    388                     int)
    389 
    390 // This message requests the provider to wait until the specified tab has
    391 // finished restoring after session restore.
    392 // Request:
    393 //   - int: handle of the tab
    394 // Response:
    395 //  - bool: whether the operation was successful.
    396 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DEPRECATED_WaitForTabToBeRestored,
    397                             int, bool)
    398 
    399 // This message is an outgoing message from Chrome to an external host.
    400 // It is a notification that a navigation happened
    401 // Request:
    402 //
    403 // Response:
    404 //   None expected
    405 IPC_MESSAGE_ROUTED1(AutomationMsg_DidNavigate,
    406                     NavigationInfo)
    407 
    408 // This message requests the different security states of the page displayed
    409 // in the specified tab.
    410 // Request:
    411 //   - int: handle of the tab
    412 // Response:
    413 //  - bool: whether the operation was successful.
    414 //  - SecurityStyle: the security style of the tab.
    415 //  - net::CertStatus: the status of the server's ssl cert (0 means no errors or
    416 //                     no ssl was used).
    417 //  - int: the insecure content state, 0 means no insecure contents.
    418 
    419 IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_DEPRECATED_GetSecurityState,
    420                             int,
    421                             bool,
    422                             content::SecurityStyle,
    423                             net::CertStatus,
    424                             int)
    425 
    426 // This message requests the page type of the page displayed in the specified
    427 // tab (normal, error or interstitial).
    428 // Request:
    429 //   - int: handle of the tab
    430 // Response:
    431 //  - bool: whether the operation was successful.
    432 //  - PageType: the type of the page currently displayed.
    433 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_DEPRECATED_GetPageType,
    434                             int,
    435                             bool,
    436                             content::PageType)
    437 
    438 // This message simulates the user action on the SSL blocking page showing in
    439 // the specified tab.  This message is only effective if an interstitial page
    440 // is showing in the tab.
    441 // Request:
    442 //   - int: handle of the tab
    443 //   - bool: whether to proceed or abort the navigation
    444 // Response:
    445 //  - AutomationMsg_NavigationResponseValues: result of the operation.
    446 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_DEPRECATED_ActionOnSSLBlockingPage,
    447                             int,
    448                             bool,
    449                             AutomationMsg_NavigationResponseValues)
    450 
    451 // Message to request that a browser window is brought to the front and
    452 // activated.
    453 // Request:
    454 //   - int: handle of the browser window.
    455 // Response:
    456 //   - bool: True if the browser is brought to the front.
    457 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BringBrowserToFront,
    458                             int,
    459                             bool)
    460 
    461 // Message to request whether a certain item is enabled of disabled in the
    462 // menu in the browser window
    463 //
    464 // Request:
    465 //   - int: handle of the browser window.
    466 //   - int: IDC message identifier to query if enabled
    467 // Response:
    468 //   - bool: True if the command is enabled on the menu
    469 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_DEPRECATED_IsMenuCommandEnabled,
    470                             int,
    471                             int,
    472                             bool)
    473 
    474 // This message notifies the AutomationProvider to reload the current page in
    475 // the tab with given handle. The first parameter is the handle to the tab
    476 // resource.  The return value contains a status code which is nonnegative on
    477 // success.
    478 // see AutomationMsg_NavigationResponseValues for the navigation response.
    479 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Reload,
    480                             int,
    481                             AutomationMsg_NavigationResponseValues)
    482 
    483 // This message requests the execution of a browser command in the browser
    484 // for which the handle is specified.
    485 // The return value contains a boolean, whether the command was dispatched.
    486 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommandAsync,
    487                             int /* automation handle */,
    488                             int /* browser command */,
    489                             bool /* success flag */)
    490 
    491 // This message requests the execution of a browser command in the browser
    492 // for which the handle is specified.
    493 // The return value contains a boolean, whether the command was dispatched
    494 // and successful executed.
    495 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommand,
    496                             int /* automation handle */,
    497                             int /* browser command */,
    498                             bool /* success flag */)
    499 
    500 
    501 // This message opens the Find window within a tab corresponding to the
    502 // supplied tab handle.
    503 IPC_MESSAGE_CONTROL1(AutomationMsg_DEPRECATED_OpenFindInPage,
    504                      int /* tab_handle */)
    505 
    506 // Posts a message from external host to chrome renderer.
    507 IPC_MESSAGE_CONTROL4(AutomationMsg_HandleMessageFromExternalHost,
    508                      int /* automation handle */,
    509                      std::string /* message */,
    510                      std::string /* origin */,
    511                      std::string /* target */)
    512 
    513 // A message for an external host.
    514 IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardMessageToExternalHost,
    515                     std::string /* message */,
    516                     std::string /* origin */,
    517                     std::string /* target */)
    518 
    519 // This message starts a find within a tab corresponding to the supplied
    520 // tab handle. The parameter |request| specifies what to search for.
    521 // If an error occurs, |matches_found| will be -1.
    522 //
    523 IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_Find,
    524                             int /* tab_handle */,
    525                             AutomationMsg_Find_Params /* params */,
    526                             int /* active_ordinal */,
    527                             int /* matches_found */)
    528 
    529 // Is the Find window fully visible (and not animating) for the specified
    530 // tab?
    531 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_FindWindowVisibility,
    532                             int /* tab_handle */,
    533                             bool /* is_visible */)
    534 
    535 // Gets the bookmark bar visibility, animating and detached states.
    536 // TODO(phajdan.jr): Adjust the last param when the reference build is updated.
    537 IPC_SYNC_MESSAGE_CONTROL1_3(AutomationMsg_BookmarkBarVisibility,
    538                             int /* browser_handle */,
    539                             bool, /* is_visible */
    540                             bool, /* still_animating */ bool /* is_detached */)
    541 
    542 // Uses the specified encoding to override the encoding of the page in the
    543 // specified web content tab.
    544 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_OverrideEncoding,
    545                             int /* tab handle */,
    546                             std::string /* overrided encoding name */,
    547                             bool /* success */)
    548 
    549 // This message is an outgoing message from Chrome to an external host.
    550 // It is a notification that a navigation failed
    551 // Request:
    552 //   -int : The status code.
    553 //   -GURL:  The URL we failed to navigate to.
    554 // Response:
    555 //   None expected
    556 IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationFailed,
    557                     int,
    558                     GURL)
    559 
    560 #if defined(OS_WIN)
    561 // This message is an outgoing message from an automation client to Chrome.
    562 // It is used to reposition a chrome tab window.
    563 IPC_MESSAGE_CONTROL2(AutomationMsg_TabReposition,
    564                      int /* tab handle */,
    565                      Reposition_Params /* SetWindowPos params */)
    566 #endif  // defined(OS_WIN)
    567 
    568 // Tab load complete
    569 IPC_MESSAGE_ROUTED1(AutomationMsg_TabLoaded,
    570                     GURL)
    571 
    572 // This message requests the tabstrip index of the tab with the given handle.
    573 // The return value contains the index, which will be -1 on failure.
    574 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabIndex,
    575                             int,
    576                             int)
    577 
    578 // This message requests the handle (int64 app-unique identifier) of
    579 // a valid tabbed browser window, i.e. normal type and non-incognito mode.
    580 // On error, the returned handle value is 0.
    581 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_DEPRECATED_FindTabbedBrowserWindow,
    582                             int)
    583 
    584 // This message requests the number of normal browser windows, i.e. normal
    585 // type and non-incognito mode that the app currently has open.  The return
    586 // value is the number of windows.
    587 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_NormalBrowserWindowCount,
    588                             int)
    589 
    590 // This message tells the browser to start using the new proxy configuration
    591 // represented by the given JSON string. The parameters used in the JSON
    592 // string are defined in automation_constants.h.
    593 IPC_MESSAGE_CONTROL1(AutomationMsg_SetProxyConfig,
    594                      std::string /* proxy_config_json_string */)
    595 
    596 // Sets Download Shelf visibility for the specified browser.
    597 IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_DEPRECATED_SetShelfVisibility,
    598                             int /* browser_handle */,
    599                             bool /* is_visible */)
    600 
    601 #if defined(OS_WIN)
    602 IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardContextMenuToExternalHost,
    603                     ContextMenuModel /* description of menu */,
    604                     int    /* align flags */,
    605                     MiniContextMenuParams /* params */)
    606 
    607 IPC_MESSAGE_CONTROL2(AutomationMsg_ForwardContextMenuCommandToChrome,
    608                      int /* tab_handle */,
    609                      int /* selected_command */)
    610 #endif  // OS_WIN
    611 
    612 // A URL request to be fetched via automation
    613 IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStart,
    614                     int /* request_id */,
    615                     AutomationURLRequest /* request */)
    616 
    617 // Read data from a URL request to be fetched via automation
    618 IPC_MESSAGE_ROUTED2(AutomationMsg_RequestRead,
    619                     int /* request_id */,
    620                     int /* bytes_to_read */)
    621 
    622 // Response to a AutomationMsg_RequestStart message
    623 IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStarted,
    624                     int /* request_id */,
    625                     AutomationURLResponse /* response */)
    626 
    627 // Data read via automation
    628 IPC_MESSAGE_ROUTED2(AutomationMsg_RequestData,
    629                     int /* request_id */,
    630                     std::string /* data */)
    631 
    632 IPC_MESSAGE_ROUTED2(AutomationMsg_RequestEnd,
    633                     int /* request_id */,
    634                     net::URLRequestStatus /* status */)
    635 
    636 IPC_MESSAGE_CONTROL1(AutomationMsg_PrintAsync,
    637                      int /* tab_handle */)
    638 
    639 IPC_MESSAGE_ROUTED2(AutomationMsg_SetCookieAsync,
    640                     GURL /* url */,
    641                     std::string /* cookie */)
    642 
    643 IPC_MESSAGE_CONTROL1(AutomationMsg_SelectAll,
    644                     int /* tab handle */)
    645 
    646 IPC_MESSAGE_CONTROL1(AutomationMsg_Cut,
    647                      int /* tab handle */)
    648 
    649 IPC_MESSAGE_CONTROL1(AutomationMsg_Copy,
    650                      int /* tab handle */)
    651 
    652 IPC_MESSAGE_CONTROL1(AutomationMsg_Paste,
    653                      int /* tab handle */)
    654 
    655 IPC_MESSAGE_CONTROL1(AutomationMsg_ReloadAsync,
    656                      int /* tab handle */)
    657 
    658 IPC_MESSAGE_CONTROL1(AutomationMsg_StopAsync,
    659                      int /* tab handle */)
    660 
    661 // This message notifies the AutomationProvider to navigate to a specified
    662 // url in the tab with given handle. The first parameter is the handle to
    663 // the tab resource. The second parameter is the target url.  The third
    664 // parameter is the number of navigations that are required for a successful
    665 // return value. See AutomationMsg_NavigationResponseValues for the return
    666 // value.
    667 IPC_SYNC_MESSAGE_CONTROL3_1(
    668     AutomationMsg_NavigateToURLBlockUntilNavigationsComplete,
    669     int,
    670     GURL,
    671     int,
    672     AutomationMsg_NavigationResponseValues)
    673 
    674 // This message notifies the AutomationProvider to navigate to a specified
    675 // navigation entry index in the external tab with given handle. The first
    676 // parameter is the handle to the tab resource. The second parameter is the
    677 // index of navigation entry.
    678 // The return value contains a status code which is nonnegative on success.
    679 // see AutomationMsg_NavigationResponseValues for the navigation response.
    680 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigateExternalTabAtIndex,
    681                             int,
    682                             int,
    683                             AutomationMsg_NavigationResponseValues)
    684 
    685 // This message requests the provider to wait until the window count
    686 // reached the specified value.
    687 // Request:
    688 //  - int: target browser window count
    689 // Response:
    690 //  - bool: whether the operation was successful.
    691 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBrowserWindowCountToBecome,
    692                            int,
    693                            bool)
    694 
    695 // This message notifies the AutomationProvider to navigate back in session
    696 // history in the tab with given handle. The first parameter is the handle
    697 // to the tab resource. The second parameter is the number of navigations the
    698 // provider will wait for.
    699 // See AutomationMsg_NavigationResponseValues for the navigation response
    700 // values.
    701 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete,
    702                             int,
    703                             int,
    704                             AutomationMsg_NavigationResponseValues)
    705 
    706 // This message notifies the AutomationProvider to navigate forward in session
    707 // history in the tab with given handle. The first parameter is the handle
    708 // to the tab resource. The second parameter is the number of navigations
    709 // the provider will wait for.
    710 // See AutomationMsg_NavigationResponseValues for the navigation response
    711 // values.
    712 IPC_SYNC_MESSAGE_CONTROL2_1(
    713     AutomationMsg_GoForwardBlockUntilNavigationsComplete,
    714     int,
    715     int,
    716     AutomationMsg_NavigationResponseValues)
    717 
    718 IPC_MESSAGE_ROUTED1(AutomationMsg_AttachExternalTab,
    719                     AttachExternalTabParams)
    720 #if defined(OS_WIN)
    721 // Sent when the automation client connects to an existing tab.
    722 IPC_SYNC_MESSAGE_CONTROL3_4(AutomationMsg_ConnectExternalTab,
    723                             uint64 /* cookie */,
    724                             bool   /* allow/block tab*/,
    725                             HWND  /* parent window */,
    726                             HWND  /* Tab container window */,
    727                             HWND  /* Tab window */,
    728                             int  /* Handle to the new tab */,
    729                             int  /* Session Id of the new tab */)
    730 #endif  // defined(OS_WIN)
    731 // Simulate an end of session. Normally this happens when the user
    732 // shuts down the machine or logs off.
    733 // Request:
    734 //   int - the handle of the browser
    735 // Response:
    736 //   bool - true if succesful
    737 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TerminateSession,
    738                             int,
    739                             bool)
    740 
    741 IPC_MESSAGE_CONTROL2(AutomationMsg_SetPageFontSize,
    742                      int /* tab_handle */,
    743                      int /* The font size */)
    744 
    745 // Returns a metric event duration that was last recorded.  Returns -1 if the
    746 // event hasn't occurred yet.
    747 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetMetricEventDuration,
    748                             std::string /* event_name */,
    749                             int /* duration ms */)
    750 
    751 // Sent by automation provider - go to history entry via automation.
    752 IPC_MESSAGE_ROUTED1(AutomationMsg_RequestGoToHistoryEntryOffset,
    753                     int)   // numbers of entries (negative or positive)
    754 
    755 // This message requests the type of the window with the given handle. The
    756 // return value contains the type (Browser::Type), or -1 if the request
    757 // failed.
    758 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Type,
    759                             int,
    760                             int)
    761 
    762 // Opens a new browser window of a specific type.
    763 IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType,
    764                             int   /* Type (Browser::Type) */,
    765                             bool  /* show */ )
    766 
    767 // This message requests that the mouse be moved to this location, in
    768 // window coordinate space.
    769 // Request:
    770 //   int - the handle of the window that's the context for this click
    771 //   gfx::Point - the location to move to
    772 IPC_MESSAGE_CONTROL2(AutomationMsg_DEPRECATED_WindowMouseMove,
    773                      int,
    774                      gfx::Point)
    775 
    776 // Called when requests should be downloaded using a host browser's
    777 // download mechanism when chrome is being embedded.
    778 IPC_MESSAGE_ROUTED1(AutomationMsg_DownloadRequestInHost,
    779                     int /* request_id */)
    780 
    781 IPC_MESSAGE_CONTROL1(AutomationMsg_SaveAsAsync,
    782                      int /* tab handle */)
    783 
    784 #if defined(OS_WIN)
    785 // An incoming message from an automation host to Chrome.  Signals that
    786 // the browser containing |tab_handle| has moved.
    787 IPC_MESSAGE_CONTROL1(AutomationMsg_BrowserMove,
    788                      int /* tab handle */)
    789 #endif
    790 
    791 // Used to get cookies for the given URL.
    792 IPC_MESSAGE_ROUTED2(AutomationMsg_GetCookiesFromHost,
    793                     GURL /* url */,
    794                     int /* opaque_cookie_id */)
    795 
    796 IPC_MESSAGE_CONTROL5(AutomationMsg_GetCookiesHostResponse,
    797                      int /* tab_handle */,
    798                      bool /* success */,
    799                      GURL /* url */,
    800                      std::string /* cookies */,
    801                      int /* opaque_cookie_id */)
    802 
    803 // Return the bookmarks encoded as a JSON string.
    804 IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_DEPRECATED_GetBookmarksAsJSON,
    805                             int /* browser_handle */,
    806                             std::string /* bookmarks as a JSON string */,
    807                             bool /* success */)
    808 
    809 // Wait for the bookmark model to load.
    810 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBookmarkModelToLoad,
    811                             int /* browser_handle */,
    812                             bool /* success */)
    813 
    814 // Bookmark addition, modification, and removal.
    815 // Bookmarks are indexed by their id.
    816 IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_DEPRECATED_AddBookmarkGroup,
    817                             int /* browser_handle */,
    818                             int64 /* parent_id */,
    819                             int /* index */,
    820                             std::wstring /* title */,
    821                             bool /* success */)
    822 IPC_SYNC_MESSAGE_CONTROL5_1(AutomationMsg_DEPRECATED_AddBookmarkURL,
    823                             int /* browser_handle */,
    824                             int64 /* parent_id */,
    825                             int /* index */,
    826                             std::wstring /* title */,
    827                             GURL /* url */,
    828                             bool /* success */)
    829 IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_DEPRECATED_ReparentBookmark,
    830                             int /* browser_handle */,
    831                             int64 /* id */,
    832                             int64 /* new_parent_id */,
    833                             int /* index */,
    834                             bool /* success */)
    835 IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DEPRECATED_SetBookmarkTitle,
    836                             int /* browser_handle */,
    837                             int64 /* id */,
    838                             std::wstring /* title */,
    839                             bool /* success */)
    840 IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DEPRECATED_SetBookmarkURL,
    841                             int /* browser_handle */,
    842                             int64 /* id */,
    843                             GURL /* url */,
    844                             bool /* success */)
    845 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_DEPRECATED_RemoveBookmark,
    846                             int /* browser_handle */,
    847                             int64 /* id */,
    848                             bool /* success */)
    849 
    850 // This message informs the browser process to remove the history entries
    851 // for the specified types across all time ranges. See
    852 // browsing_data_remover.h for a list of REMOVE_* types supported in the
    853 // remove_mask parameter.
    854 IPC_MESSAGE_CONTROL1(AutomationMsg_RemoveBrowsingData,
    855                      int)
    856 
    857 // Generic pyauto pattern to help avoid future addition of
    858 // automation messages.
    859 IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequestWithBrowserHandle,
    860                             int /* browser_handle */,
    861                             std::string /* JSON request */,
    862                             std::string /* JSON response */,
    863                             bool /* success */)
    864 
    865 // Resets to the default theme.
    866 IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_DEPRECIATED_ResetToDefaultTheme)
    867 
    868 // This message requests the external tab identified by the tab handle
    869 // passed in be closed.
    870 // Request:
    871 // Response:
    872 //   None expected
    873 IPC_MESSAGE_ROUTED0(AutomationMsg_CloseExternalTab)
    874 
    875 // This message requests that the external tab identified by the tab handle
    876 // runs unload handlers if any on the current page.
    877 // Request:
    878 //   -int: Tab handle
    879 //   -bool: result: true->unload, false->don't unload
    880 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_RunUnloadHandlers,
    881                             int,
    882                             bool)
    883 
    884 // This message sets the current zoom level on the tab
    885 // Request:
    886 //   -int: Tab handle
    887 //   -int: Zoom level. Values ZOOM_OUT = -1, RESET = 0, ZOOM_IN  = 1
    888 // Response:
    889 //   None expected
    890 IPC_MESSAGE_CONTROL2(AutomationMsg_SetZoomLevel,
    891                      int,
    892                      int)
    893 
    894 // Waits for tab count to reach target value.
    895 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForTabCountToBecome,
    896                             int /* browser handle */,
    897                             int /* target tab count */,
    898                             bool /* success */)
    899 
    900 // Waits for the infobar count to reach given number.
    901 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForInfoBarCount,
    902                             int /* tab handle */,
    903                             size_t /* target count */,
    904                             bool /* success */)
    905 
    906 // Notify the JavaScript engine in the render to change its parameters
    907 // while performing stress testing.
    908 IPC_MESSAGE_CONTROL3(AutomationMsg_JavaScriptStressTestControl,
    909                      int /* tab handle */,
    910                      int /* command */,
    911                      int /* type or run */)
    912 
    913 // This message posts a task to the PROCESS_LAUNCHER thread. Once processed
    914 // the response is sent back. This is useful when you want to make sure all
    915 // changes to the number of processes have completed.
    916 IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_WaitForProcessLauncherThreadToGoIdle)
    917 
    918 // This message is an outgoing message from Chrome to an external host.
    919 // It is a notification that a popup window position or dimentions have
    920 // changed
    921 // Request:
    922 //   gfx::Rect - the bounds of the window
    923 // Response:
    924 //   None expected
    925 IPC_MESSAGE_ROUTED1(AutomationMsg_MoveWindow,
    926                     gfx::Rect /* window position and dimentions */)
    927 
    928 // Call BeginTracing on the browser TraceController. This will tell all
    929 // processes to start collecting trace events via base/debug/trace_event.h.
    930 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BeginTracing,
    931                             std::string /* category_patterns */,
    932                             bool /* success */)
    933 
    934 // End tracing (called after BeginTracing). This blocks until tracing has
    935 // stopped on all processes and all the events are ready to be retrieved.
    936 IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_EndTracing,
    937                             size_t /* num_trace_chunks */,
    938                             bool /* success */)
    939 
    940 // Retrieve trace event data (called after EndTracing). Must call exactly
    941 // |num_trace_chunks| times.
    942 // TODO(jbates): See bug 100255, IPC send fails if message is too big. This
    943 // code can be removed if that limitation is fixed.
    944 IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_GetTracingOutput,
    945                             std::string /* trace_chunk */,
    946                             bool /* success */)
    947 
    948 // Used on Mac OS X to read the number of active Mach ports used in the browser
    949 // process.
    950 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetMachPortCount,
    951                             int /* number of Mach ports */)
    952 
    953 // Generic pyauto pattern to help avoid future addition of
    954 // automation messages.
    955 IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest,
    956                             int /* window_index */,
    957                             std::string /* JSON request */,
    958                             std::string /* JSON response */,
    959                             bool /* success */)
    960