automation_messages_internal.h revision 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801
1// Copyright (c) 2011 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#include <string>
8#include <vector>
9
10#include "base/string16.h"
11#include "chrome/common/content_settings.h"
12#include "chrome/common/navigation_types.h"
13#include "chrome/test/automation/autocomplete_edit_proxy.h"
14#include "googleurl/src/gurl.h"
15#include "ipc/ipc_message_macros.h"
16#include "net/url_request/url_request_status.h"
17#include "ui/gfx/rect.h"
18
19
20
21// NOTE: All IPC messages have either a routing_id of 0 (for asynchronous
22//       messages), or one that's been assigned by the proxy (for calls
23//       which expect a response).  The routing_id shouldn't be used for
24//       any other purpose in these message types.
25
26// NOTE: All the new IPC messages should go at the end.
27//       The IPC message IDs need to match the reference builds.  Since we now
28//       define the IDs based on __LINE__, to allow these IPC messages to be
29//       used to control an old version of Chrome we need the message IDs to
30//       remain the same.  This means that you should not change the line number
31//       of any of the messages below.  This will be fixed once Xcode supports
32//       __COUNTER__, in which case we can get rid of the __LINE__.
33
34#define IPC_MESSAGE_START AutomationMsgStart
35
36// This message is fired when the AutomationProvider is up and running
37// in the app (the app is not fully up at this point). The parameter to this
38// message is the version string of the automation provider. This parameter
39// is defined to be the version string as returned by
40// chrome::VersionInfo::Version().
41// The client can choose to use this version string to decide whether or not
42// it can talk to the provider.
43IPC_MESSAGE_CONTROL1(AutomationMsg_Hello,
44                     std::string)
45
46// This message is fired when the initial tab(s) are finished loading.
47IPC_MESSAGE_CONTROL0(AutomationMsg_InitialLoadsComplete)
48
49// This message notifies the AutomationProvider to append a new tab the
50// window with the given handle. The return value contains the index of
51// the new tab, or -1 if the request failed.
52// The second parameter is the url to be loaded in the new tab.
53IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AppendTab,
54                            int,
55                            GURL,
56                            int)
57
58// This message requests the (zero-based) index for the currently
59// active tab in the window with the given handle. The return value contains
60// the index of the active tab, or -1 if the request failed.
61IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ActiveTabIndex,
62                            int,
63                            int)
64
65// This message notifies the AutomationProvider to active the tab.
66// The first parameter is the handle to window resource.
67// The second parameter is the (zero-based) index to be activated
68IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActivateTab,
69                            int,
70                            int,
71                            int)
72
73// This message requests the cookie value for given url in the
74// profile of the tab identified by the second parameter.  The first
75// parameter is the URL string. The response contains the length of the
76// cookie value string. On failure, this length = -1.
77IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetCookies,
78                            GURL,
79                            int,
80                            int,
81                            std::string)
82
83// This message notifies the AutomationProvider to set and broadcast a cookie
84// with given name and value for the given url in the profile of the tab
85// identified by the third parameter. The first parameter is the URL
86// string, and the second parameter is the cookie name and value to be set.
87// The return value is a non-negative value on success.
88IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetCookie,
89                            GURL,
90                            std::string,
91                            int,
92                            int)
93
94// This message is used to implement the asynchronous version of
95// NavigateToURL.
96IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigationAsync,
97                            int /* tab handle */,
98                            GURL,
99                            bool /* result */)
100
101// This message requests the number of browser windows that the app currently
102// has open.  The return value is the number of windows.
103IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_BrowserWindowCount,
104                            int)
105
106// This message requests the handle (int64 app-unique identifier) of the
107// window with the given (zero-based) index.  On error, the returned handle
108// value is 0.
109IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BrowserWindow,
110                            int,
111                            int)
112
113// This message requests the number of tabs in the window with the given
114// handle.  The return value contains the number of tabs, or -1 if the
115// request failed.
116IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabCount,
117                            int,
118                            int)
119
120// This message requests the handle of the tab with the given (zero-based)
121// index in the given app window. First parameter specifies the given window
122// handle, second specifies the given tab_index. On error, the returned handle
123// value is 0.
124IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab,
125                            int,
126                            int,
127                            int)
128
129// This message requests the the title of the tab with the given handle.
130// The return value contains the size of the title string. On error, this
131// value should be -1 and empty string. Note that the title can be empty in
132// which case the size would be 0.
133IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabTitle,
134                            int,
135                            int,
136                            std::wstring)
137
138// This message requests the url of the tab with the given handle.
139// The return value contains a success flag and the URL string. The URL will
140// be empty on failure, and it still may be empty on success.
141IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabURL,
142                            int /* tab handle */,
143                            bool /* success flag */,
144                            GURL)
145
146// This message notifies the AutomationProxy that a handle that it has
147// previously been given is now invalid.  (For instance, if the handle
148// represented a window which has now been closed.)  The parameter
149// value is the handle.
150IPC_MESSAGE_CONTROL1(AutomationMsg_InvalidateHandle,
151                     int)
152
153// This message notifies the AutomationProvider that a handle is no
154// longer being used, so it can stop paying attention to the
155// associated resource.  The parameter value is the handle.
156IPC_MESSAGE_CONTROL1(AutomationMsg_HandleUnused,
157                     int)
158
159// This message tells the AutomationProvider to provide the given
160// authentication data to the specified tab, in response to an HTTP/FTP
161// authentication challenge.
162IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetAuth,
163                            int /* tab handle */,
164                            std::wstring /* username */,
165                            std::wstring /* password */,
166                            AutomationMsg_NavigationResponseValues /* status */)
167
168// This message tells the AutomationProvider to cancel the login in the
169// specified tab.
170IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_CancelAuth,
171                            int /* tab handle */,
172                            AutomationMsg_NavigationResponseValues /* status */)
173
174// Requests that the automation provider ask history for the most recent
175// chain of redirects coming from the given URL. The response must be
176// decoded by the caller manually; it contains an integer indicating the
177// number of URLs, followed by that many wstrings indicating a chain of
178// redirects. On failure, the count will be negative.
179IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_RedirectsFrom,
180                            int /* tab handle */,
181                            GURL /* source URL */,
182                            bool /* succeeded */,
183                            std::vector<GURL> /* redirects */)
184
185// This message asks the AutomationProvider whether a tab is waiting for
186// login info.
187IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_NeedsAuth,
188                            int /* tab handle */,
189                            bool /* status */)
190
191// This message requests that the AutomationProvider executes a JavaScript,
192// which is sent embedded in a 'javascript:' URL.
193// The javascript is executed in context of child frame whose xpath
194// is passed as parameter (context_frame). The execution results in
195// a serialized JSON string response.
196IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DomOperation,
197                            int /* tab handle */,
198                            std::wstring /* context_frame */,
199                            std::wstring /* the javascript to be executed */,
200                            std::string /* the serialized json string containg
201                                           the result of a javascript
202                                           execution */)
203
204// Is the Download Shelf visible for the specified browser?
205IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShelfVisibility,
206                            int /* browser_handle */,
207                            bool /* is_visible */)
208
209// This message requests the number of constrained windows in the tab with
210// the given handle.  The return value contains the number of constrained
211// windows, or -1 if the request failed.
212IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ConstrainedWindowCount,
213                            int /* tab_handle */,
214                            int /* constrained_window_count */)
215
216// This message requests the bounds of the specified View element in
217// window coordinates.
218// Request:
219//   int - the handle of the window in which the view appears
220//   int - the ID of the view, as specified in chrome/browser/ui/view_ids.h
221//   bool - whether the bounds should be returned in the screen coordinates
222//          (if true) or in the browser coordinates (if false).
223// Response:
224//   bool - true if the view was found
225//   gfx::Rect - the bounds of the view, in window coordinates
226IPC_SYNC_MESSAGE_CONTROL3_2(AutomationMsg_WindowViewBounds,
227                            int,
228                            int,
229                            bool,
230                            bool,
231                            gfx::Rect)
232
233// This message sets the bounds of the window.
234// Request:
235//   int - the handle of the window to resize
236//   gfx::Rect - the bounds of the window
237// Response:
238//   bool - true if the resize was successful
239IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds,
240                            int,
241                            gfx::Rect,
242                            bool)
243
244// TODO(port): Port these messages.
245//
246// This message requests that a drag be performed in window coordinate space
247// Request:
248//   int - the handle of the window that's the context for this drag
249//   std::vector<gfx::Point> - the path of the drag in window coordinate
250//                             space; it should have at least 2 points
251//                             (start and end)
252//   int - the flags which identify the mouse button(s) for the drag, as
253//         defined in chrome/views/event.h
254// Response:
255//   bool - true if the drag could be performed
256IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_WindowDrag,
257                           int,
258                           std::vector<gfx::Point>,
259                           int,
260                           bool,
261                           bool)
262
263// Similar to AutomationMsg_InitialLoadsComplete, this indicates that the
264// new tab ui has completed the initial load of its data.
265// Time is how many milliseconds the load took.
266IPC_MESSAGE_CONTROL1(AutomationMsg_InitialNewTabUILoadComplete,
267                    int /* time */)
268
269// This message sends a inspect element request for a given tab. The response
270// contains the number of resources loaded by the inspector controller.
271IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_InspectElement,
272                            int, /* tab_handle */
273                            int, /* x */
274                            int  /* y */,
275                            int)
276
277// This message requests the process ID of the tab that corresponds
278// to the given automation handle.
279// The return value has an integer corresponding to the PID of the tab's
280// renderer, 0 if the tab currently has no renderer process, or -1 on error.
281IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabProcessID,
282                            int /* tab_handle */,
283                            int /* process ID */)
284
285// This tells the browser to enable or disable the filtered network layer.
286IPC_MESSAGE_CONTROL1(AutomationMsg_SetFilteredInet,
287                     bool /* enabled */)
288
289// Gets the directory that downloads will occur in for the active profile.
290IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DownloadDirectory,
291                            int /* tab_handle */,
292                            FilePath /* directory */)
293
294// This message requests the id of the view that has the focus in the
295// specified window. If no view is focused, -1 is returned.  Note that the
296// window should either be a ViewWindow or a Browser.
297IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetFocusedViewID,
298                            int /* view_handle */,
299                            int /* focused_view_id */)
300
301// This message shows/hides the window.
302IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowVisible,
303                            int /* view_handle */,
304                            bool /* visible */,
305                            bool /* success */)
306
307// Gets the active status of a window.
308IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowActive,
309                            int /* view_handle */,
310                            bool /* success */,
311                            bool /* active */)
312
313// Makes the specified window the active window.
314IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_ActivateWindow,
315                            int /* view_handle */)
316
317// Opens a new browser window.
318// TODO(sky): remove this and replace with OpenNewBrowserWindowOfType.
319// Doing this requires updating the reference build.
320IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_OpenNewBrowserWindow,
321                            bool /* show */ )
322
323// This message requests the handle (int64 app-unique identifier) of the
324// current active top window.  On error, the returned handle value is 0.
325IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_ActiveWindow,
326                            int)
327
328// This message requests the browser associated with the specified window
329// handle.
330// The return value contains a success flag and the handle of the browser.
331IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BrowserForWindow,
332                            int /* window handle */,
333                            bool /* success flag */,
334                            int /* browser handle */)
335
336// This message requests the window associated with the specified browser
337// handle.
338// The return value contains a success flag and the handle of the window.
339IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_WindowForBrowser,
340                            int /* browser handle */,
341                            bool /* success flag */,
342                            int /* window handle */)
343
344// This message requests the AutocompleteEdit associated with the specified
345// browser handle.
346// The return value contains a success flag and the handle of the omnibox.
347IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditForBrowser,
348                            int /* browser handle */,
349                            bool /* success flag */,
350                            int /* AutocompleteEdit handle */)
351
352// This message requests that a mouse click be performed in window coordinate
353// space.
354// Request:
355//   int - the handle of the window that's the context for this click
356//   gfx::Point - the point to click
357//   int - the flags which identify the mouse button(s) for the click, as
358//       defined in chrome/views/event.h
359IPC_MESSAGE_CONTROL3(AutomationMsg_WindowClick,
360                     int,
361                     gfx::Point,
362                     int)
363
364// This message requests that a key press be performed.
365// Request:
366//   int - the handle of the window that's the context for this click
367//   int - the ui::KeyboardCode of the key that was pressed.
368//   int - the flags which identify the modifiers (shift, ctrl, alt)
369//         associated for, as defined in chrome/views/event.h
370IPC_MESSAGE_CONTROL3(AutomationMsg_WindowKeyPress,
371                     int,
372                     int,
373                     int)
374
375// This message notifies the AutomationProvider to create a tab which is
376// hosted by an external process.
377// Request:
378//   ExternalTabSettings - settings for external tab
379IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_CreateExternalTab,
380                            ExternalTabSettings  /* settings*/,
381                            gfx::NativeWindow  /* Tab container window */,
382                            gfx::NativeWindow  /* Tab window */,
383                            int  /* Handle to the new tab */,
384                            int  /* Session Id of the new tab */)
385
386// This message notifies the AutomationProvider to navigate to a specified
387// url in the external tab with given handle. The first parameter is the
388// handle to the tab resource. The second parameter is the target url.
389// The third parameter is the referrer.
390// The return value contains a status code which is nonnegative on success.
391// see AutomationMsg_NavigationResponseValues for the navigation response.
392IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigateInExternalTab,
393                            int,
394                            GURL,
395                            GURL,
396                            AutomationMsg_NavigationResponseValues)
397
398// This message is an outgoing message from Chrome to an external host.
399// It is a notification that the NavigationState was changed
400// Request:
401//   -int: The flags specifying what changed
402//         (see TabContents::InvalidateTypes)
403// Response:
404//   None expected
405IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationStateChanged,
406                    int,  // TabContents::InvalidateTypes
407                    NavigationInfo)  // title, url etc.
408
409// This message is an outgoing message from Chrome to an external host.
410// It is a notification that the target URL has changed (the target URL
411// is the URL of the link that the user is hovering on)
412// Request:
413//   -std::wstring: The new target URL
414// Response:
415//   None expected
416IPC_MESSAGE_ROUTED1(AutomationMsg_UpdateTargetUrl,
417                    std::wstring)
418
419// This message notifies the AutomationProvider to show the specified html
420// text in an interstitial page in the tab with given handle. The first
421// parameter is the handle to the tab resource. The second parameter is the
422// html text to be displayed.
423// The return value contains a success flag.
424IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ShowInterstitialPage,
425                            int,
426                            std::string,
427                            AutomationMsg_NavigationResponseValues)
428
429// This message notifies the AutomationProvider to hide the current
430// interstitial page in the tab with given handle. The parameter is the
431// handle to the tab resource.
432// The return value contains a success flag.
433IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_HideInterstitialPage,
434                            int,
435                            bool)
436
437// This message requests that a tab be closed.
438// Request:
439//   - int: handle of the tab to close
440//   - bool: if true the proxy blocks until the tab has completely closed,
441//           otherwise the proxy only blocks until it initiates the close.
442IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CloseTab,
443                            int,
444                            bool,
445                            bool)
446
447// This message requests that the browser be closed.
448// Request:
449//   - int: handle of the browser which contains the tab
450// Response:
451//  - bool: whether the operation was successfull.
452//  - bool: whether the browser process will be terminated as a result (if
453//          this was the last closed browser window).
454IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_CloseBrowser,
455                            int,
456                            bool,
457                            bool)
458
459IPC_MESSAGE_CONTROL1(AutomationMsg_CloseBrowserRequestAsync,
460                     int)
461
462#if defined(OS_WIN)
463// TODO(port): Port these messages.
464//
465// This message is an outgoing message from Chrome to an external host.
466// It is a request to process a keyboard accelerator.
467// Request:
468//   -MSG: The keyboard message
469// Response:
470//   None expected
471// TODO(sanjeevr): Ideally we need to add a response from the external
472// host saying whether it processed the accelerator
473IPC_MESSAGE_ROUTED1(AutomationMsg_HandleAccelerator,
474                    MSG)
475
476// This message is sent by the container of an externally hosted tab to
477// reflect any accelerator keys that it did not process. This gives the
478// tab a chance to handle the keys
479// Request:
480//   - int: handle of the tab
481//   -MSG: The keyboard message that the container did not handle
482// Response:
483//   None expected
484IPC_MESSAGE_CONTROL2(AutomationMsg_ProcessUnhandledAccelerator,
485                     int,
486                     MSG)
487#endif  // defined(OS_WIN)
488
489// Sent by the external tab to the host to notify that the user has tabbed
490// out of the tab.
491// Request:
492//   - bool: |reverse| set to true when shift-tabbing out of the tab, false
493//    otherwise.
494// Response:
495//   None expected
496IPC_MESSAGE_ROUTED1(AutomationMsg_TabbedOut,
497                    bool)
498
499// Sent by the external tab host to ask focus to be set to either the first
500// or last element on the page.
501// Request:
502//   - int: handle of the tab
503//   - bool: |reverse|
504//      true: Focus will be set to the last focusable element
505//      false: Focus will be set to the first focusable element
506//   - bool: |restore_focus_to_view|
507//      true: The renderer view associated with the current tab will be
508//            infomed that it is receiving focus.
509// Response:
510//   None expected
511IPC_MESSAGE_CONTROL3(AutomationMsg_SetInitialFocus,
512                     int,
513                     bool,
514                     bool)
515
516// This message is an outgoing message from Chrome to an external host.
517// It is a request to open a url
518// Request:
519//   -GURL: The URL to open
520//   -GURL: The referrer
521//   -int: The WindowOpenDisposition that specifies where the URL should
522//         be opened (new tab, new window etc).
523// Response:
524//   None expected
525IPC_MESSAGE_ROUTED3(AutomationMsg_OpenURL,
526                    GURL,
527                    GURL,
528                    int)
529
530// This message requests the provider to wait until the specified tab has
531// finished restoring after session restore.
532// Request:
533//   - int: handle of the tab
534// Response:
535//  - bool: whether the operation was successful.
536IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForTabToBeRestored,
537                            int, bool)
538
539// This message is an outgoing message from Chrome to an external host.
540// It is a notification that a navigation happened
541// Request:
542//
543// Response:
544//   None expected
545IPC_MESSAGE_ROUTED1(AutomationMsg_DidNavigate,
546                    NavigationInfo)
547
548// This message requests the different security states of the page displayed
549// in the specified tab.
550// Request:
551//   - int: handle of the tab
552// Response:
553//  - bool: whether the operation was successful.
554//  - SecurityStyle: the security style of the tab.
555//  - int: the status of the server's ssl cert (0 means no errors or no ssl
556//         was used).
557//  - int: the insecure content state, 0 means no insecure contents.
558
559IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_GetSecurityState,
560                            int,
561                            bool,
562                            SecurityStyle,
563                            int,
564                            int)
565
566// This message requests the page type of the page displayed in the specified
567// tab (normal, error or interstitial).
568// Request:
569//   - int: handle of the tab
570// Response:
571//  - bool: whether the operation was successful.
572//  - PageType: the type of the page currently displayed.
573IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetPageType,
574                            int,
575                            bool,
576                            PageType)
577
578// This message simulates the user action on the SSL blocking page showing in
579// the specified tab.  This message is only effective if an interstitial page
580// is showing in the tab.
581// Request:
582//   - int: handle of the tab
583//   - bool: whether to proceed or abort the navigation
584// Response:
585//  - AutomationMsg_NavigationResponseValues: result of the operation.
586IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActionOnSSLBlockingPage,
587                            int,
588                            bool,
589                            AutomationMsg_NavigationResponseValues)
590
591// Message to request that a browser window is brought to the front and
592// activated.
593// Request:
594//   - int: handle of the browser window.
595// Response:
596//   - bool: True if the browser is brought to the front.
597IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BringBrowserToFront,
598                            int,
599                            bool)
600
601// Message to request whether a certain item is enabled of disabled in the
602// menu in the browser window
603//
604// Request:
605//   - int: handle of the browser window.
606//   - int: IDC message identifier to query if enabled
607// Response:
608//   - bool: True if the command is enabled on the menu
609IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_IsMenuCommandEnabled,
610                            int,
611                            int,
612                            bool)
613
614// This message notifies the AutomationProvider to print the tab with given
615// handle. The first parameter is the handle to the tab resource.  The
616// return value contains a bool which is true on success.
617IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_PrintNow,
618                            int,
619                            bool)
620
621// This message notifies the AutomationProvider to reload the current page in
622// the tab with given handle. The first parameter is the handle to the tab
623// resource.  The return value contains a status code which is nonnegative on
624// success.
625// see AutomationMsg_NavigationResponseValues for the navigation response.
626IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Reload,
627                            int,
628                            AutomationMsg_NavigationResponseValues)
629
630// This message requests the handle (int64 app-unique identifier) of the
631// last active browser window, or the browser at index 0 if there is no last
632// active browser, or it no longer exists. Returns 0 if no browser windows
633// exist.
634IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_LastActiveBrowserWindow,
635                            int)
636
637// This message notifies the AutomationProvider to save the page with given
638// handle. The first parameter is the handle to the tab resource. The second
639// parameter is the main HTML file name. The third parameter is the directory
640// for saving resources. The fourth parameter is the saving type: 0 for HTML
641// only; 1 for complete web page.
642// The return value contains a bool which is true on success.
643IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SavePage,
644                            int,
645                            FilePath,
646                            FilePath,
647                            int,
648                            bool)
649
650// This message requests the text currently being displayed in the
651// AutocompleteEdit.  The parameter is the handle to the AutocompleteEdit.
652// The return value is a string indicating the text in the AutocompleteEdit.
653IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetText,
654                            int /* autocomplete edit handle */,
655                            bool /* the requested autocomplete edit exists */,
656                            string16 /* omnibox text */)
657
658// This message sets the text being displayed in the AutocompleteEdit.  The
659// first parameter is the handle to the omnibox and the second parameter is
660// the text to be displayed in the AutocompleteEdit.
661// The return value has no parameters and is returned when the operation has
662// completed.
663IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AutocompleteEditSetText,
664                            int /* autocomplete edit handle */,
665                            string16 /* text to set */,
666                            bool /* the requested autocomplete edit exists */)
667
668// This message requests if a query to a autocomplete provider is still in
669// progress.  The first parameter in the request is the handle to the
670// autocomplete edit.
671// The first return value indicates if the request succeeded.
672// The second return value indicates if a query is still in progress.
673IPC_SYNC_MESSAGE_CONTROL1_2( \
674    AutomationMsg_AutocompleteEditIsQueryInProgress,
675    int /* autocomplete edit handle*/,
676    bool /* the requested autocomplete edit exists */,
677    bool /* indicates if a query is in progress */)
678
679// This message requests a list of the autocomplete messages currently being
680// displayed by the popup.  The parameter in the request is a handle to the
681// autocomplete edit.
682// The first return value indicates if the request was successful, while
683// while the second is the actual list of matches.
684IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetMatches,
685                            int /* autocomplete edit handle*/,
686                            bool /* the requested autocomplete edit exists */,
687                            std::vector<AutocompleteMatchData> /* matches */)
688
689// This message requests the execution of a browser command in the browser
690// for which the handle is specified.
691// The return value contains a boolean, whether the command was dispatched.
692IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommandAsync,
693                            int /* automation handle */,
694                            int /* browser command */,
695                            bool /* success flag */)
696
697// This message requests the execution of a browser command in the browser
698// for which the handle is specified.
699// The return value contains a boolean, whether the command was dispatched
700// and successful executed.
701IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommand,
702                            int /* automation handle */,
703                            int /* browser command */,
704                            bool /* success flag */)
705
706
707// This message opens the Find window within a tab corresponding to the
708// supplied tab handle.
709IPC_MESSAGE_CONTROL1(AutomationMsg_OpenFindInPage,
710                     int /* tab_handle */)
711
712// Posts a message from external host to chrome renderer.
713IPC_MESSAGE_CONTROL4(AutomationMsg_HandleMessageFromExternalHost,
714                     int /* automation handle */,
715                     std::string /* message */,
716                     std::string /* origin */,
717                     std::string /* target */)
718
719// A message for an external host.
720IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardMessageToExternalHost,
721                    std::string /* message */,
722                    std::string /* origin */,
723                    std::string /* target */)
724
725// This message starts a find within a tab corresponding to the supplied
726// tab handle. The parameter |request| specifies what to search for.
727// If an error occurs, |matches_found| will be -1.
728//
729IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_Find,
730                            int /* tab_handle */,
731                            AutomationMsg_Find_Params /* params */,
732                            int /* active_ordinal */,
733                            int /* matches_found */)
734
735// Is the Find window fully visible (and not animating) for the specified
736// tab?
737IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_FindWindowVisibility,
738                            int /* tab_handle */,
739                            bool /* is_visible */)
740
741// Where is the Find window located. |x| and |y| will be -1, -1 on failure.
742IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_FindWindowLocation,
743                            int /* tab_handle */,
744                            int /* x */,
745                            int /* y */)
746
747// Is the Bookmark bar visible? The return value will indicate whether it is
748// visible or not and whether it is being animated into (or out of its place).
749IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BookmarkBarVisibility,
750                            int /* browser_handle */,
751                            bool, /* is_visible */
752                            bool  /* still_animating */)
753
754// This message requests the number of related info bars opened.  It
755// returns -1 if an error occurred.
756IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetInfoBarCount,
757                            int /* tab_handle */,
758                            size_t /* info bar count */)
759
760// This message triggers the action associated with the "accept" button in
761// the info-bar at the specified index.  If |wait for navigation| is true, it
762// won't return until a navigation has occurred.
763IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_ClickInfoBarAccept,
764                            int /* tab_handle */,
765                            size_t /* info bar index */,
766                            bool /* wait for navigation */,
767// This line blank on purpose, see comment atop file about __LINE__.
768                            /* navigation result */
769                            AutomationMsg_NavigationResponseValues)
770
771// This message retrieves the last time a navigation occurred in the specified
772// tab.  The value is intended to be used with WaitForNavigation.
773IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetLastNavigationTime,
774                            int /* tab_handle */,
775                            int64 /* last navigation time */)
776
777// This messages is used to block until a new navigation occurs (if there is
778// none more recent then the time specified).
779IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForNavigation,
780                            int /* tab_handle */,
781                            int64 /* last navigation time */,
782// This line blank on purpose, see comment atop file about __LINE__.
783                            /* navigation result */
784                            AutomationMsg_NavigationResponseValues)
785
786// This messages sets an int-value preference.
787IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetIntPreference,
788                            int /* browser handle */,
789                            std::string /* pref name */,
790                            int /* value */,
791                            bool /* success */)
792
793// Queries whether an app modal dialog is currently being shown. (i.e. a
794// javascript alert) and which buttons it contains.
795IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_ShowingAppModalDialog,
796                            bool /* showing dialog */,
797                            int /* view::DelegateDialog::DialogButton */)
798
799// This message triggers the specified button for the currently showing
800// modal dialog.
801IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ClickAppModalDialogButton,
802                            int /* view::DelegateDialog::DialogButton */,
803                            bool /* success */)
804
805// This messages sets a string-value preference.
806IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetStringPreference,
807                            int /* browser handle */,
808                            std::string /* pref name */,
809                            std::string /* pref value */,
810                            bool)
811
812// This messages gets a boolean-value preference.
813IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetBooleanPreference,
814                           int /* browser handle */,
815                           std::string /* pref name */,
816                           bool /* success */,
817                           bool /* pref value */)
818
819// This messages sets a boolean-value preference.
820IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBooleanPreference,
821                            int /* browser handle */,
822                            std::string /* pref name */,
823                            bool /* pref value */,
824                            bool /* success */)
825
826// Queries the current used encoding name of the page in the specified
827// web content tab.
828IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetPageCurrentEncoding,
829                            int /* tab handle */,
830                            std::string /* current used encoding name */)
831
832// Uses the specified encoding to override the encoding of the page in the
833// specified web content tab.
834IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_OverrideEncoding,
835                            int /* tab handle */,
836                            std::string /* overrided encoding name */,
837                            bool /* success */)
838
839// Used to disable the dialog box that prompts the user for a path when
840// saving a web page.
841IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_SavePackageShouldPromptUser,
842                            bool /* false if we want to not show the dialog */)
843
844// This message is an outgoing message from Chrome to an external host.
845// It is a notification that a navigation failed
846// Request:
847//   -int : The status code.
848//   -GURL:  The URL we failed to navigate to.
849// Response:
850//   None expected
851IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationFailed,
852                    int,
853                    GURL)
854
855#if defined(OS_WIN)
856// This message is an outgoing message from an automation client to Chrome.
857// It is used to reposition a chrome tab window.
858IPC_MESSAGE_CONTROL2(AutomationMsg_TabReposition,
859                     int /* tab handle */,
860                     Reposition_Params /* SetWindowPos params */)
861#endif  // defined(OS_WIN)
862
863// Gets the title of the top level browser window.
864IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WindowTitle,
865                            int /* automation handle */,
866                            string16 /* title text */ )
867
868// Tab load complete
869IPC_MESSAGE_ROUTED1(AutomationMsg_TabLoaded,
870                    GURL)
871
872// This message requests the tabstrip index of the tab with the given handle.
873// The return value contains the index, which will be -1 on failure.
874IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabIndex,
875                            int,
876                            int)
877
878// This message requests the handle (int64 app-unique identifier) of
879// a valid normal browser window, i.e. normal type and non-incognito mode.
880// On error, the returned handle value is 0.
881IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_FindNormalBrowserWindow,
882                            int)
883
884// This message requests the number of normal browser windows, i.e. normal
885// type and non-incognito mode that the app currently has open.  The return
886// value is the number of windows.
887IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_NormalBrowserWindowCount,
888                            int)
889
890// Used to put the browser into "extension automation mode" for a given
891// set of Chrome Extensions API functions for the current profile, or turn
892// off automation mode.  The specified tab is used as the conduit for all
893// automated API functions.  It must be an external tab (as in
894// AutomationMsg_CreateExternalTab).
895IPC_MESSAGE_CONTROL2(AutomationMsg_SetEnableExtensionAutomation,
896                     // Tab handle.
897                     int,
898                     // Empty to disable automation, non-empty to enable
899                     // automation of the specified API functions, single
900                     // entry of "*" to enable automation of all API
901                     // functions.
902                     std::vector<std::string>)
903
904// This message tells the browser to start using the new proxy configuration
905// represented by the given JSON string. The parameters used in the JSON
906// string are defined in automation_constants.h.
907IPC_MESSAGE_CONTROL1(AutomationMsg_SetProxyConfig,
908                     std::string /* proxy_config_json_string */)
909
910// Sets Download Shelf visibility for the specified browser.
911IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_SetShelfVisibility,
912                            int /* browser_handle */,
913                            bool /* is_visible */)
914
915// This message requests the number of blocked popups in a certain tab with
916// the given handle. The return value is the number of blocked popups, or -1
917// if this request failed.
918IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BlockedPopupCount,
919                            int /* tab_handle */,
920                            int /* blocked_popup_count */)
921
922// This message retrieves the locale of the browser process.  On success
923// |chrome_locale| will contain the locale as reported by ICU.  On failure
924// |chrome_locale| is the empty string.
925IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetBrowserLocale,
926                            string16 /* chrome_locale */)
927
928#if defined(OS_WIN)
929IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardContextMenuToExternalHost,
930                    HANDLE /* source menu handle */,
931                    int    /* align flags */,
932                    MiniContextMenuParams /* params */)
933
934IPC_MESSAGE_CONTROL2(AutomationMsg_ForwardContextMenuCommandToChrome,
935                     int /* tab_handle */,
936                     int /* selected_command */)
937#endif  // OS_WIN
938
939// A URL request to be fetched via automation
940IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStart,
941                    int /* request_id */,
942                    AutomationURLRequest /* request */)
943
944// Read data from a URL request to be fetched via automation
945IPC_MESSAGE_ROUTED2(AutomationMsg_RequestRead,
946                    int /* request_id */,
947                    int /* bytes_to_read */)
948
949// Response to a AutomationMsg_RequestStart message
950IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStarted,
951                    int /* request_id */,
952                    AutomationURLResponse /* response */)
953
954// Data read via automation
955IPC_MESSAGE_ROUTED2(AutomationMsg_RequestData,
956                    int /* request_id */,
957                    std::string /* data */)
958
959IPC_MESSAGE_ROUTED2(AutomationMsg_RequestEnd,
960                    int /* request_id */,
961                    net::URLRequestStatus /* status */)
962
963IPC_MESSAGE_CONTROL1(AutomationMsg_PrintAsync,
964                     int /* tab_handle */)
965
966IPC_MESSAGE_ROUTED2(AutomationMsg_SetCookieAsync,
967                    GURL /* url */,
968                    std::string /* cookie */)
969
970IPC_MESSAGE_CONTROL1(AutomationMsg_SelectAll,
971                    int /* tab handle */)
972
973IPC_MESSAGE_CONTROL1(AutomationMsg_Cut,
974                     int /* tab handle */)
975
976IPC_MESSAGE_CONTROL1(AutomationMsg_Copy,
977                     int /* tab handle */)
978
979IPC_MESSAGE_CONTROL1(AutomationMsg_Paste,
980                     int /* tab handle */)
981
982IPC_MESSAGE_CONTROL1(AutomationMsg_ReloadAsync,
983                     int /* tab handle */)
984
985IPC_MESSAGE_CONTROL1(AutomationMsg_StopAsync,
986                     int /* tab handle */)
987
988// Returns the number of times a filter was used to service an URL request.
989// See AutomationMsg_SetFilteredInet.
990IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetFilteredInetHitCount,
991                            int /* hit_count */)
992
993// Is the browser in fullscreen mode?
994IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreen,
995                            int /* browser_handle */,
996                            bool /* is_fullscreen */)
997
998// Is the fullscreen bubble visible?
999IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreenBubbleVisible,
1000                            int /* browser_handle */,
1001                            bool /* is_visible */)
1002
1003// This message notifies the AutomationProvider to navigate to a specified
1004// url in the tab with given handle. The first parameter is the handle to
1005// the tab resource. The second parameter is the target url.  The third
1006// parameter is the number of navigations that are required for a successful
1007// return value. See AutomationMsg_NavigationResponseValues for the return
1008// value.
1009IPC_SYNC_MESSAGE_CONTROL3_1(
1010    AutomationMsg_NavigateToURLBlockUntilNavigationsComplete,
1011    int,
1012    GURL,
1013    int,
1014    AutomationMsg_NavigationResponseValues)
1015
1016// This message notifies the AutomationProvider to navigate to a specified
1017// navigation entry index in the external tab with given handle. The first
1018// parameter is the handle to the tab resource. The second parameter is the
1019// index of navigation entry.
1020// The return value contains a status code which is nonnegative on success.
1021// see AutomationMsg_NavigationResponseValues for the navigation response.
1022IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigateExternalTabAtIndex,
1023                            int,
1024                            int,
1025                            AutomationMsg_NavigationResponseValues)
1026
1027// This message requests the provider to wait until the window count
1028// reached the specified value.
1029// Request:
1030//  - int: target browser window count
1031// Response:
1032//  - bool: whether the operation was successful.
1033IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBrowserWindowCountToBecome,
1034                           int,
1035                           bool)
1036
1037// This message requests the provider to wait until an application modal
1038// dialog is shown.
1039// Response:
1040//  - bool: whether the operation was successful
1041IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForAppModalDialogToBeShown,
1042                            bool)
1043
1044// This message notifies the AutomationProvider to navigate back in session
1045// history in the tab with given handle. The first parameter is the handle
1046// to the tab resource. The second parameter is the number of navigations the
1047// provider will wait for.
1048// See AutomationMsg_NavigationResponseValues for the navigation response
1049// values.
1050IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete,
1051                            int,
1052                            int,
1053                            AutomationMsg_NavigationResponseValues)
1054
1055// This message notifies the AutomationProvider to navigate forward in session
1056// history in the tab with given handle. The first parameter is the handle
1057// to the tab resource. The second parameter is the number of navigations
1058// the provider will wait for.
1059// See AutomationMsg_NavigationResponseValues for the navigation response
1060// values.
1061IPC_SYNC_MESSAGE_CONTROL2_1(
1062    AutomationMsg_GoForwardBlockUntilNavigationsComplete,
1063    int,
1064    int,
1065    AutomationMsg_NavigationResponseValues)
1066
1067// This message is used by automation clients to upload histogram data to the
1068// browser process.
1069IPC_MESSAGE_CONTROL1(AutomationMsg_RecordHistograms,
1070                     std::vector<std::string> /* histogram_list */)
1071
1072IPC_MESSAGE_ROUTED1(AutomationMsg_AttachExternalTab,
1073                    AttachExternalTabParams)
1074
1075// Sent when the automation client connects to an existing tab.
1076IPC_SYNC_MESSAGE_CONTROL3_4(AutomationMsg_ConnectExternalTab,
1077                            uint64 /* cookie */,
1078                            bool   /* allow/block tab*/,
1079                            gfx::NativeWindow  /* parent window */,
1080                            gfx::NativeWindow  /* Tab container window */,
1081                            gfx::NativeWindow  /* Tab window */,
1082                            int  /* Handle to the new tab */,
1083                            int  /* Session Id of the new tab */)
1084
1085// This message gets the bounds of the window.
1086// Request:
1087//   int - the handle of the window to query
1088// Response:
1089//   gfx::Rect - the bounds of the window
1090//   bool - true if the query was successful
1091IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetWindowBounds,
1092                            int,
1093                            gfx::Rect,
1094                            bool)
1095
1096// Simulate an end of session. Normally this happens when the user
1097// shuts down the machine or logs off.
1098// Request:
1099//   int - the handle of the browser
1100// Response:
1101//   bool - true if succesful
1102IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TerminateSession,
1103                            int,
1104                            bool)
1105
1106// Returns whether the window is maximized.
1107// Request:
1108//   int - the handle of the window
1109// Response:
1110//   bool - true if the window is maximized
1111//   bool - true if query is successful
1112IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowMaximized,
1113                            int,
1114                            bool,
1115                            bool)
1116
1117IPC_MESSAGE_CONTROL2(AutomationMsg_SetPageFontSize,
1118                     int /* tab_handle */,
1119                     int /* The font size */)
1120
1121// Returns a metric event duration that was last recorded.  Returns -1 if the
1122// event hasn't occurred yet.
1123IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetMetricEventDuration,
1124                            std::string /* event_name */,
1125                            int /* duration ms */)
1126
1127// Sent by automation provider - go to history entry via automation.
1128IPC_MESSAGE_ROUTED1(AutomationMsg_RequestGoToHistoryEntryOffset,
1129                    int)   // numbers of entries (negative or positive)
1130
1131// Silently install the extension in the given crx file.
1132IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_InstallExtension,
1133                            FilePath /* full path to crx file */,
1134                            AutomationMsg_ExtensionResponseValues)
1135
1136// Silently load the extension in the given directory.  This expects an
1137// extension expanded into the directory, not a crx file.
1138IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadExpandedExtension,
1139                            FilePath /* root directory of extension */,
1140                            AutomationMsg_ExtensionResponseValues)
1141
1142// Retrieves a list of the root directories of all enabled extensions
1143// that have been installed into Chrome by dropping a .crx file onto
1144// Chrome or an equivalent action (including loaded extensions).
1145// Other types of extensions are not included on the list (e.g. "component",
1146// "app" or "external" extensions) since since CEEE does not yet support them
1147// (and it actually only support a single extension in its profile for now).
1148IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetEnabledExtensions,
1149                            std::vector<FilePath>)
1150
1151// This message requests the type of the window with the given handle. The
1152// return value contains the type (Browser::Type), or -1 if the request
1153// failed.
1154IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Type,
1155                            int,
1156                            int)
1157
1158// Opens a new browser window of a specific type.
1159IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType,
1160                            int   /* Type (Browser::Type) */,
1161                            bool  /* show */ )
1162
1163// This message requests that the mouse be moved to this location, in
1164// window coordinate space.
1165// Request:
1166//   int - the handle of the window that's the context for this click
1167//   gfx::Point - the location to move to
1168IPC_MESSAGE_CONTROL2(AutomationMsg_WindowMouseMove,
1169                     int,
1170                     gfx::Point)
1171
1172// Called when requests should be downloaded using a host browser's
1173// download mechanism when chrome is being embedded.
1174IPC_MESSAGE_ROUTED1(AutomationMsg_DownloadRequestInHost,
1175                    int /* request_id */)
1176
1177// Shuts down the session service for the browser identified by
1178// |browser_handle|. On success |result| is set to true.
1179IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShutdownSessionService,
1180                            int   /* browser_handle */,
1181                            bool  /* result */)
1182
1183IPC_MESSAGE_CONTROL1(AutomationMsg_SaveAsAsync,
1184                     int /* tab handle */)
1185
1186#if defined(OS_WIN)
1187// An incoming message from an automation host to Chrome.  Signals that
1188// the browser containing |tab_handle| has moved.
1189IPC_MESSAGE_CONTROL1(AutomationMsg_BrowserMove,
1190                     int /* tab handle */)
1191#endif
1192
1193// Used to get cookies for the given URL.
1194IPC_MESSAGE_ROUTED2(AutomationMsg_GetCookiesFromHost,
1195                    GURL /* url */,
1196                    int /* opaque_cookie_id */)
1197
1198IPC_MESSAGE_CONTROL5(AutomationMsg_GetCookiesHostResponse,
1199                     int /* tab_handle */,
1200                     bool /* success */,
1201                     GURL /* url */,
1202                     std::string /* cookies */,
1203                     int /* opaque_cookie_id */)
1204
1205// If the given host is empty, then the default content settings are
1206// modified.
1207IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SetContentSetting,
1208                            int /* browser handle */,
1209                            std::string /* host */,
1210                            ContentSettingsType /* content type */,
1211                            ContentSetting /* setting */,
1212                            bool /* success */)
1213
1214#if defined(OS_CHROMEOS)
1215// Logs in through the browser's login wizard if available.
1216IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_LoginWithUserAndPass,
1217                           std::string /* username*/,
1218                           std::string /* password*/,
1219                           bool /* Whether successful*/)
1220#endif
1221
1222// Return the bookmarks encoded as a JSON string.
1223IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetBookmarksAsJSON,
1224                            int /* browser_handle */,
1225                            std::string /* bookmarks as a JSON string */,
1226                            bool /* success */)
1227
1228// Wait for the bookmark model to load.
1229IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBookmarkModelToLoad,
1230                            int /* browser_handle */,
1231                            bool /* success */)
1232
1233// Bookmark addition, modification, and removal.
1234// Bookmarks are indexed by their id.
1235IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_AddBookmarkGroup,
1236                            int /* browser_handle */,
1237                            int64 /* parent_id */,
1238                            int /* index */,
1239                            std::wstring /* title */,
1240                            bool /* success */)
1241IPC_SYNC_MESSAGE_CONTROL5_1(AutomationMsg_AddBookmarkURL,
1242                            int /* browser_handle */,
1243                            int64 /* parent_id */,
1244                            int /* index */,
1245                            std::wstring /* title */,
1246                            GURL /* url */,
1247                            bool /* success */)
1248IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_ReparentBookmark,
1249                            int /* browser_handle */,
1250                            int64 /* id */,
1251                            int64 /* new_parent_id */,
1252                            int /* index */,
1253                            bool /* success */)
1254IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkTitle,
1255                            int /* browser_handle */,
1256                            int64 /* id */,
1257                            std::wstring /* title */,
1258                            bool /* success */)
1259IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkURL,
1260                            int /* browser_handle */,
1261                            int64 /* id */,
1262                            GURL /* url */,
1263                            bool /* success */)
1264IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_RemoveBookmark,
1265                            int /* browser_handle */,
1266                            int64 /* id */,
1267                            bool /* success */)
1268
1269// This message informs the browser process to remove the history entries
1270// for the specified types across all time ranges. See
1271// browsing_data_remover.h for a list of REMOVE_* types supported in the
1272// remove_mask parameter.
1273IPC_MESSAGE_CONTROL1(AutomationMsg_RemoveBrowsingData,
1274                     int)
1275
1276// Block until the focused view id changes to something other than
1277// |previous_view_id|.
1278IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_WaitForFocusedViewIDToChange,
1279                            int /* window handle */,
1280                            int /* previous_view_id */,
1281                            bool /* success */,
1282                            int /* new_view_id */)
1283
1284// To avoid race conditions, waiting until a popup menu opens is a
1285// three-step process:
1286//   1. Call StartTrackingPopupMenus.
1287//   2. Call an automation method that results in opening the popup menu.
1288//   3. Call WaitForPopupMenuToOpen and check for success.
1289IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_StartTrackingPopupMenus,
1290                            int /* browser handle */,
1291                            bool /* success */)
1292IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForPopupMenuToOpen,
1293                            bool /* success */)
1294
1295// Generic pyauto pattern to help avoid future addition of
1296// automation messages.
1297IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest,
1298                            int /* browser_handle */,
1299                            std::string /* JSON request */,
1300                            std::string /* JSON response */,
1301                            bool /* success */)
1302
1303// Installs an extension from the crx file and returns its id.
1304// On error, |extension handle| will be 0.
1305IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_InstallExtensionAndGetHandle,
1306                            FilePath     /* full path to crx file */,
1307                            bool         /* with UI */,
1308                            int          /* extension handle */)
1309
1310// Waits for the next extension test result. Sets |test result| as the
1311// received result and |message| as any accompanying message with the
1312// result, which could be the empty string.
1313IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_WaitForExtensionTestResult,
1314                            bool         /* test result */,
1315                            std::string  /* message */)
1316
1317// Uninstalls an extension. On success |success| is true.
1318IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_UninstallExtension,
1319                            int   /* extension handle */,
1320                            bool  /* success */)
1321
1322// Enables an extension. On success |success| is true.
1323IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_EnableExtension,
1324                           int   /* extension handle */,
1325                           bool  /* success */)
1326
1327// Disables an extension. On success |success| is true.
1328IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DisableExtension,
1329                            int   /* extension handle */,
1330                            bool  /* success */)
1331
1332// Executes the action associated with the given extension. This executes
1333// the extension's page or browser action in the given browser, but does
1334// not open popups. On success |success| is true.
1335IPC_SYNC_MESSAGE_CONTROL2_1(
1336    AutomationMsg_ExecuteExtensionActionInActiveTabAsync,
1337    int   /* extension handle */,
1338    int   /* browser handle */,
1339    bool  /* success */)
1340
1341// Moves the browser action to the given index in the browser action toolbar.
1342// On success |success| is true.
1343IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_MoveExtensionBrowserAction,
1344                            int   /* extension handle */,
1345                            int   /* index */,
1346                            bool  /* success */)
1347
1348// Gets an extension property |property type|. On success |success| is true,
1349// and |property value| is set.
1350IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetExtensionProperty,
1351    int                              /* extension handle */,
1352    AutomationMsg_ExtensionProperty  /* property type */,
1353    bool                             /* success */,
1354    std::string                      /* property value */)
1355
1356// Resets to the default theme.
1357IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_ResetToDefaultTheme)
1358
1359// Navigates asynchronously to a URL with a certain disposition,
1360// like in a new tab.
1361IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigationAsyncWithDisposition,
1362                            int /* tab handle */,
1363                            GURL,
1364                            WindowOpenDisposition,
1365                            bool /* result */)
1366
1367
1368// This message requests the cookie be deleted for given url in the
1369// profile of the tab identified by the first parameter.  The second
1370// parameter is the cookie name.
1371IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DeleteCookie,
1372                            GURL,
1373                            std::string,
1374                            int /* tab handle */,
1375                            bool /* result */)
1376
1377// This message triggers the collected cookies dialog for a specific tab.
1378IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShowCollectedCookiesDialog,
1379                            int /* tab handle */,
1380                            bool /* result */)
1381
1382// This message requests the external tab identified by the tab handle
1383// passed in be closed.
1384// Request:
1385// Response:
1386//   None expected
1387IPC_MESSAGE_ROUTED0(AutomationMsg_CloseExternalTab)
1388
1389// This message requests that the external tab identified by the tab handle
1390// runs unload handlers if any on the current page.
1391// Request:
1392//   -int: Tab handle
1393//   -bool: result: true->unload, false->don't unload
1394IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_RunUnloadHandlers,
1395                            int,
1396                            bool)
1397
1398// This message sets the current zoom level on the tab
1399// Request:
1400//   -int: Tab handle
1401//   -int: Zoom level. Values ZOOM_OUT = -1, RESET = 0, ZOOM_IN  = 1
1402// Response:
1403//   None expected
1404IPC_MESSAGE_CONTROL2(AutomationMsg_SetZoomLevel,
1405                     int,
1406                     int)
1407
1408// Waits for tab count to reach target value.
1409IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForTabCountToBecome,
1410                            int /* browser handle */,
1411                            int /* target tab count */,
1412                            bool /* success */)
1413
1414// Waits for the infobar count to reach given number.
1415IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForInfoBarCount,
1416                            int /* tab handle */,
1417                            size_t /* target count */,
1418                            bool /* success */)
1419
1420// Waits for the autocomplete edit to receive focus.
1421IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForAutocompleteEditFocus,
1422                            int /* autocomplete edit handle */,
1423                            bool /* success */)
1424
1425// Loads all blocked plug-ins on the page.
1426IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadBlockedPlugins,
1427                            int /* tab handle */,
1428                            bool /* success */)
1429
1430// Captures the entire page for the tab, including those portions not in
1431// view, and saves the image as a PNG in the given file location.
1432// Request:
1433//   -int: Tab handle
1434//   -FilePath: Path to save the captured image to
1435// Response:
1436//   -bool: Whether the method succeeded
1437IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CaptureEntirePageAsPNG,
1438                            int,
1439                            FilePath,
1440                            bool)
1441
1442// Notify the JavaScript engine in the render to change its parameters
1443// while performing stress testing.
1444IPC_MESSAGE_ROUTED3(AutomationMsg_JavaScriptStressTestControl,
1445                    int /* tab handle */,
1446                    int /* command */,
1447                    int /* type or run */)
1448
1449// This message posts a task to the PROCESS_LAUNCHER thread. Once processed
1450// the response is sent back. This is useful when you want to make sure all
1451// changes to the number of processes have completed.
1452IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_WaitForProcessLauncherThreadToGoIdle)
1453