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.
5 // Defines the IPC messages used by the automation interface.
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.
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.
20 #define IPC_MESSAGE_START AutomationMsgStart
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
,
32 // This message is fired when the initial tab(s) are finished loading.
33 IPC_MESSAGE_CONTROL0(AutomationMsg_InitialLoadsComplete
)
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
,
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
,
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
,
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
,
80 // This message is used to implement the asynchronous version of
82 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigationAsync
,
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
,
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
95 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BrowserWindow
,
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
102 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabCount
,
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
110 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab
,
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
,
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 */,
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
,
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
,
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
163 // This message requests the bounds of the specified View element in
164 // window coordinates.
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).
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
,
180 // This message sets the bounds of the window.
182 // int - the handle of the window to resize
183 // gfx::Rect - the bounds of the window
185 // bool - true if the resize was successful
186 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds
,
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
,
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
,
236 // This message requests the window associated with the specified browser
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 */)
300 // This message requests that a tab be closed.
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
,
310 // This message requests that the browser be closed.
312 // - int: handle of the browser which contains the tab
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
,
451 // Message to request that a browser window is brought to the front and
454 // - int: handle of the browser window.
456 // - bool: True if the browser is brought to the front.
457 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BringBrowserToFront
,
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
478 // see AutomationMsg_NavigationResponseValues for the navigation response.
479 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Reload
,
481 AutomationMsg_NavigationResponseValues
)
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 */)
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 */)
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.
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 */)
529 // Is the Find window fully visible (and not animating) for the specified
531 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_FindWindowVisibility
,
532 int /* tab_handle */,
533 bool /* is_visible */)
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 */,
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
,
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
,
643 IPC_MESSAGE_CONTROL1(AutomationMsg_SelectAll
,
644 int /* tab handle */)
646 IPC_MESSAGE_CONTROL1(AutomationMsg_Cut
,
647 int /* tab handle */)
649 IPC_MESSAGE_CONTROL1(AutomationMsg_Copy
,
650 int /* tab handle */)
652 IPC_MESSAGE_CONTROL1(AutomationMsg_Paste
,
653 int /* tab handle */)
655 IPC_MESSAGE_CONTROL1(AutomationMsg_ReloadAsync
,
656 int /* tab handle */)
658 IPC_MESSAGE_CONTROL1(AutomationMsg_StopAsync
,
659 int /* tab handle */)
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
667 IPC_SYNC_MESSAGE_CONTROL3_1(
668 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete
,
672 AutomationMsg_NavigationResponseValues
)
685 // This message requests the provider to wait until the window count
686 // reached the specified value.
688 // - int: target browser window count
690 // - bool: whether the operation was successful.
691 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBrowserWindowCountToBecome
,
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
701 IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete
,
704 AutomationMsg_NavigationResponseValues
)
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
712 IPC_SYNC_MESSAGE_CONTROL2_1(
713 AutomationMsg_GoForwardBlockUntilNavigationsComplete
,
716 AutomationMsg_NavigationResponseValues
)
731 // Simulate an end of session. Normally this happens when the user
732 // shuts down the machine or logs off.
734 // int - the handle of the browser
736 // bool - true if succesful
737 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TerminateSession
,
741 IPC_MESSAGE_CONTROL2(AutomationMsg_SetPageFontSize
,
742 int /* tab_handle */,
743 int /* The font size */)
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 */)
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)
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
758 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Type
,
762 // Opens a new browser window of a specific type.
763 IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType
,
764 int /* Type (Browser::Type) */,
809 // Wait for the bookmark model to load.
810 IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBookmarkModelToLoad
,
811 int /* browser_handle */,
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 */,
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 */,
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 */,
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 */,
911 int /* type or run */)
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
)
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 */,
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 base::FilePath
/* result_file_path */,
940 // Used on Mac OS X to read the number of active Mach ports used in the browser
942 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetMachPortCount
,
943 int /* number of Mach ports */)
945 // Generic pyauto pattern to help avoid future addition of
946 // automation messages.
947 IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest
,
948 int /* window_index */,
949 std::string
/* JSON request */,
950 std::string
/* JSON response */,