Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / common / automation_messages_internal.h
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
70
71
72
73
74
75
76
77
78
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
159
160
161
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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
217
218
219
220
221
222
223
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
232
233
234
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
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
462
463
464
465
466
467
468
469
470
471
472
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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
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
536
537
538
539
540
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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
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
579
580
581
582
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
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
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
675
676
677
678
679
680
681
682
683
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
719
720
721
722
723
724
725
726
727
728
729
730
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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
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
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
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
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
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
919
920
921
922
923
924
925
926
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                             base::FilePath /* result_file_path */,
938                             bool /* success */)
939
940 // Used on Mac OS X to read the number of active Mach ports used in the browser
941 // process.
942 IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetMachPortCount,
943                             int /* number of Mach ports */)
944
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 */,
951                             bool /* success */)