summaryrefslogtreecommitdiffstats
path: root/dom/ipc/PBrowser.ipdl
blob: f09e484ee452fe89b9d04f6b1a7433e1ef561a47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
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
810
811
812
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
858
859
860
861
862
863
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
895
896
897
898
899
900
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PBlob;
include protocol PColorPicker;
include protocol PContent;
include protocol PContentBridge;
include protocol PDocAccessible;
include protocol PFilePicker;
include protocol PIndexedDBPermissionRequest;
include protocol PRenderFrame;
include protocol PPluginWidget;
include protocol PRemotePrintJob;
include DOMTypes;
include JavaScriptTypes;
include URIParams;
include PPrintingTypes;
include PTabContext;


using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
using class mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
using struct gfxSize from "gfxPoint.h";
using CSSRect from "Units.h";
using CSSSize from "Units.h";
using mozilla::LayoutDeviceIntRect from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDevicePoint from "Units.h";
using mozilla::ScreenIntPoint from "Units.h";
using ScreenIntSize from "Units.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using struct mozilla::layers::ZoomConstraints from "FrameMetrics.h";
using mozilla::layers::MaybeZoomConstraints from "FrameMetrics.h";
using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
using FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "nsIWidget.h";
using struct nsIMEUpdatePreference from "nsIWidget.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::ContentCache from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetDragEvent from "ipc/nsGUIEventIPC.h";
using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetPluginEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CSSToScreenScale from "Units.h";
using mozilla::CommandInt from "mozilla/EventForwards.h";
using mozilla::WritingMode from "mozilla/WritingModes.h";
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
using nsIWidget::TouchPointerState from "nsIWidget.h";
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
using mozilla::EventMessage from "mozilla/EventForwards.h";
using nsEventStatus from "mozilla/EventForwards.h";
using mozilla::Modifiers from "mozilla/EventForwards.h";
using nsSizeMode from "nsIWidgetListener.h";
using mozilla::widget::CandidateWindowPosition from "ipc/nsGUIEventIPC.h";
using class mozilla::NativeEventData from "ipc/nsGUIEventIPC.h";
using mozilla::FontRange from "ipc/nsGUIEventIPC.h";
using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";

namespace mozilla {
namespace dom {

struct NativeKeyBinding
{
  CommandInt[] singleLineCommands;
  CommandInt[] multiLineCommands;
  CommandInt[] richTextCommands;
};

union MaybeNativeKeyBinding
{
  NativeKeyBinding;
  void_t;
};

struct ShowInfo
{
  nsString name;
  bool fullscreenAllowed;
  bool isPrivate;
  bool fakeShowInfo;
  bool isTransparent;
  float dpi;
  int32_t widgetRounding;
  double defaultScale;
};

union OptionalShmem
{
  void_t;
  Shmem;
};

nested(upto inside_cpow) sync protocol PBrowser
{
    manager PContent or PContentBridge;

    manages PColorPicker;
    manages PDocAccessible;
    manages PFilePicker;
    manages PIndexedDBPermissionRequest;
    manages PRenderFrame;
    manages PPluginWidget;

both:
    async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
                       Principal aPrincipal, ClonedMessageData aData);

    /**
     * Create a layout frame (encapsulating a remote layer tree) for
     * the page that is currently loaded in the <browser>.
     */
    async PRenderFrame();

parent:
    /**
     * Tell the parent process a new accessible document has been created.
     * aParentDoc is the accessible document it was created in if any, and
     * aParentAcc is the id of the accessible in that document the new document
     * is a child of. aMsaaID is the MSAA id for this content process, and
     * is only valid on Windows. Set to 0 on other platforms. aDocCOMProxy
     * is also Windows-specific and should be set to 0 on other platforms.
     */
    async PDocAccessible(nullable PDocAccessible aParentDoc, uint64_t aParentAcc,
                         uint32_t aMsaaID, IAccessibleHolder aDocCOMProxy);

    /*
     * Creates a new remoted nsIWidget connection for windowed plugins
     * in e10s mode. This is always initiated from the child in response
     * to windowed plugin creation.
     */
    sync PPluginWidget();

    /**
     * Return native data of root widget
     */
    nested(inside_cpow) sync GetWidgetNativeData() returns (WindowsHandle value);

    /**
     * Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
     * widget's shareable window on the chrome side. Only used on Windows.
     */
    async SetNativeChildOfShareableWindow(uintptr_t childWindow);

    /**
     * When content moves focus from a native plugin window that's a child
     * of the native browser window we need to move native focus to the
     * browser. Otherwise the plugin window will never relinquish focus.
     */
    sync DispatchFocusToTopLevelWindow();

parent:
    /**
     * When child sends this message, parent should move focus to
     * the next or previous focusable element or document.
     */
    async MoveFocus(bool forward, bool forDocumentNavigation);

    /**
     * SizeShellTo request propagation to parent.
     *
     * aFlag            Can indicate if one of the dimensions should be ignored.
     *                  If only one dimension has changed it has to be indicated
     *                  by the nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_* flags.
     * aShellItemWidth,
     * aShellItemHeight On parent side we won't be able to decide the dimensions
     *                  of the shell item parameter in the original SizeShellTo
     *                  call so we send over its dimensions that will be used
     *                  for the actual resize.
     **/
    async SizeShellTo(uint32_t aFlag, int32_t aWidth, int32_t aHeight,
                      int32_t aShellItemWidth, int32_t aShellItemHeight);

    /**
     * Called by the child to inform the parent that links are dropped into
     * content area.
     *
     * aLinks A flat array of url, name, and type for each link
     */
    async DropLinks(nsString[] aLinks);

    async Event(RemoteDOMEvent aEvent);

    sync SyncMessage(nsString aMessage, ClonedMessageData aData,
                     CpowEntry[] aCpows, Principal aPrincipal)
      returns (StructuredCloneData[] retval);

    nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
                                        CpowEntry[] aCpows, Principal aPrincipal)
      returns (StructuredCloneData[] retval);

    /**
     * Notifies chrome that there is a focus change involving an editable
     * object (input, textarea, document, contentEditable. etc.)
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     *  preference   Native widget preference for IME updates
     */
    nested(inside_cpow) sync NotifyIMEFocus(ContentCache contentCache,
                                            IMENotification notification)
      returns (nsIMEUpdatePreference preference);

    /**
     * Notifies chrome that there has been a change in text content
     * One call can encompass both a delete and an insert operation
     * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     */
    nested(inside_cpow) async NotifyIMETextChange(ContentCache contentCache,
                                                  IMENotification notification);

    /**
     * Notifies chrome that there is a IME compostion rect updated
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async NotifyIMECompositionUpdate(ContentCache contentCache,
                                                         IMENotification notification);

    /**
     * Notifies chrome that there has been a change in selection
     * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     */
    nested(inside_cpow) async NotifyIMESelection(ContentCache contentCache,
                                                 IMENotification notification);

    /**
     * Notifies chrome of updating its content cache.
     * This is useful if content is modified but we don't need to notify IME.
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async UpdateContentCache(ContentCache contentCache);

    /**
     * Notifies IME of mouse button event on a character in focused editor.
     *
     * Returns true if the mouse button event is consumd by IME.
     */
    nested(inside_cpow) sync NotifyIMEMouseButtonEvent(IMENotification notification)
      returns (bool consumedByIME);

    /**
     * Notifies chrome to position change
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async NotifyIMEPositionChange(ContentCache contentCache,
                                                      IMENotification notification);

    /**
     * Requests chrome to commit or cancel composition of IME.
     *
     *  cancel                Set true if composition should be cancelled.
     *
     *  isCommitted           Returns true if the request causes composition
     *                        being committed synchronously.
     *  committedString       Returns committed string.  The may be non-empty
     *                        string even if cancel is true because IME may
     *                        try to restore selected string which was
     *                        replaced with the composition.
     */
    nested(inside_cpow) sync RequestIMEToCommitComposition(bool cancel)
                        returns (bool isCommitted, nsString committedString);

    /**
     * OnEventNeedingAckHandled() is called after a child process dispatches a
     * composition event or a selection event which is sent from the parent
     * process.
     *
     * message      The message value of the handled event.
     */
    nested(inside_cpow) async OnEventNeedingAckHandled(EventMessage message);

    /**
     * Tells chrome to start plugin IME.  If this results in a string getting
     * committed, the result is in aCommitted (otherwise aCommitted is empty).
     *
     * aKeyboardEvent     The event with which plugin IME is to be started
     * panelX and panelY  Location in screen coordinates of the IME input panel
     *                    (should be just under the plugin)
     * aCommitted         The string committed during IME -- otherwise empty
     */
    nested(inside_cpow) sync StartPluginIME(WidgetKeyboardEvent aKeyboardEvent,
                                            int32_t panelX, int32_t panelY)
        returns (nsString aCommitted);

    /**
     * Tells chrome (and specifically the appropriate widget) whether or not
     * a plugin (inside the widget) has the keyboard focus.  Should be sent
     * when the keyboard focus changes too or from a plugin.
     *
     * aFocused  Whether or not a plugin is focused
     */
    nested(inside_cpow) async SetPluginFocused(bool aFocused);

    /**
     * Set IME candidate window by windowless plugin if plugin has focus.
     */
    async SetCandidateWindowForPlugin(CandidateWindowPosition aPosition);

    /**
     * Notifies the parent process of native key event data received in a
     * plugin process directly.
     *
     * aKeyEventData    The native key event data.  The actual type copied into
     *                  NativeEventData depending on the caller.  Please check
     *                  PluginInstanceChild.
     */
    nested(inside_cpow) async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData);

    /**
     *  When plugin event isn't consumed, call this
     */
    async DefaultProcOfPluginEvent(WidgetPluginEvent aEvent);

    /**
     * Request that the parent process move focus to the browser's frame. If
     * canRaise is true, the window can be raised if it is inactive.
     */
    async RequestFocus(bool canRaise);

    /**
     * Indicate, based on the current state, that some commands are enabled and
     * some are disabled.
     */
    async EnableDisableCommands(nsString action,
                                nsCString[] enabledCommands,
                                nsCString[] disabledCommands);

    nested(inside_cpow) sync GetInputContext() returns (int32_t IMEEnabled,
                                                        int32_t IMEOpen);

    nested(inside_cpow) async SetInputContext(int32_t IMEEnabled,
                                              int32_t IMEOpen,
                                              nsString type,
                                              nsString inputmode,
                                              nsString actionHint,
                                              int32_t cause,
                                              int32_t focusChange);

    sync IsParentWindowMainWidgetVisible() returns (bool visible);

    /**
     * Gets the DPI of the screen corresponding to this browser.
     */
    sync GetDPI() returns (float value);

    /**
     * Gets the default scaling factor of the screen corresponding to this browser.
     */
    sync GetDefaultScale() returns (double value);

    /**
     * Gets the rounding of coordinates in the widget.
     */
    sync GetWidgetRounding() returns (int32_t value);

    /**
     * Gets maximum of touch points at current device.
     */
    sync GetMaxTouchPoints() returns (uint32_t value);

    /**
     * Set the native cursor.
     * @param value
     *   The widget cursor to set.
     * @param force
     *   Invalidate any locally cached cursor settings and force an
     *   update.
     */
    async SetCursor(uint32_t value, bool force);

    /**
     * Set the native cursor using a custom image.
     * @param cursorData
     *   Serialized image data.
     * @param width
     *   Width of the image.
     * @param height
     *   Height of the image.
     * @param stride
     *   Stride used in the image data.
     * @param format
     *   Image format, see gfx::SurfaceFormat for possible values.
     * @param hotspotX
     *   Horizontal hotspot of the image, as specified by the css cursor property.
     * @param hotspotY
     *   Vertical hotspot of the image, as specified by the css cursor property.
     * @param force
     *   Invalidate any locally cached cursor settings and force an
     *   update.
     */
    async SetCustomCursor(nsCString cursorData, uint32_t width, uint32_t height,
                          uint32_t stride, uint8_t format,
                          uint32_t hotspotX, uint32_t hotspotY, bool force);

    /**
     * Used to set the current text of the status tooltip.
     * Nowadays this is mainly used for link locations on hover.
     */
    async SetStatus(uint32_t type, nsString status);

    /**
     * Show/hide a tooltip when the mouse hovers over an element in the content
     * document.
     */
    async ShowTooltip(uint32_t x, uint32_t y, nsString tooltip, nsString direction);
    async HideTooltip();

    /**
     * Create an asynchronous color picker on the parent side,
     * but don't open it yet.
     */
    async PColorPicker(nsString title, nsString initialColor);

    async PFilePicker(nsString aTitle, int16_t aMode);

    /**
     * Initiates an asynchronous request for one of the special indexedDB
     * permissions for the provided principal.
     *
     * @param principal
     *   The principal of the request.
     *
     * NOTE: The principal is untrusted in the parent process. Only
     *       principals that can live in the content process should
     *       provided.
     */
    async PIndexedDBPermissionRequest(Principal principal);

    /**
     * window.open from inside <iframe mozbrowser> is special.  When the child
     * process calls window.open, it creates a new PBrowser (in its own
     * process), then calls BrowserFrameOpenWindow on it.
     *
     * The parent process gets a chance to accept or reject the window.open
     * call, and windowOpened is set to true if we ended up going through with
     * the window.open.
     *
     * @param opener the PBrowser whose content called window.open.
     */
    sync BrowserFrameOpenWindow(PBrowser opener, PRenderFrame renderFrame,
                                nsString aURL, nsString aName, nsString aFeatures)
      returns (bool windowOpened,
               TextureFactoryIdentifier textureFactoryIdentifier,
               uint64_t layersId);

    /**
     * Tells the containing widget whether the given input block results in a
     * swipe. Should be called in response to a WidgetWheelEvent that has
     * mFlags.mCanTriggerSwipe set on it.
     */
    async RespondStartSwipeEvent(uint64_t aInputBlockId, bool aStartSwipe);

    /**
     * Brings up the auth prompt dialog.
     * Called when this is the PBrowserParent for a nested remote iframe.
     * aCallbackId corresponds to an nsIAuthPromptCallback that lives in the
     * root process.  It will be passed back to the root process with either the
     * OnAuthAvailable or OnAuthCancelled message.
     */
    async AsyncAuthPrompt(nsCString uri, nsString realm, uint64_t aCallbackId);

    /**
     * Look up dictionary by selected word for OSX
     *
     * @param aText       The word to look up
     * @param aFontRange  Text decoration of aText
     * @param aIsVertical true if vertical layout
     */
    async LookUpDictionary(nsString aText, FontRange[] aFontRangeArray,
                           bool aIsVertical, LayoutDeviceIntPoint aPoint);

    async __delete__();

    async ReplyKeyEvent(WidgetKeyboardEvent event);

    async DispatchAfterKeyboardEvent(WidgetKeyboardEvent event);

    sync RequestNativeKeyBindings(WidgetKeyboardEvent event)
        returns (MaybeNativeKeyBinding bindings);

    async SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
                                   int32_t aNativeKeyCode,
                                   uint32_t aModifierFlags,
                                   nsString aCharacters,
                                   nsString aUnmodifiedCharacters,
                                   uint64_t aObserverId);
    async SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
                                     uint32_t aNativeMessage,
                                     uint32_t aModifierFlags,
                                     uint64_t aObserverId);
    async SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
                                    uint64_t aObserverId);
    async SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
                                           uint32_t aNativeMessage,
                                           double aDeltaX,
                                           double aDeltaY,
                                           double aDeltaZ,
                                           uint32_t aModifierFlags,
                                           uint32_t aAdditionalFlags,
                                           uint64_t aObserverId);
    async SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                     TouchPointerState aPointerState,
                                     LayoutDeviceIntPoint aPoint,
                                     double aPointerPressure,
                                     uint32_t aPointerOrientation,
                                     uint64_t aObserverId);
    async SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
                                   bool aLongTap,
                                   uint64_t aObserverId);
    async ClearNativeTouchSequence(uint64_t aObserverId);

    /**
     * Returns the number of tabs in the window via the out parameter.
     * If the number of tabs can't be determined, returns 0.
     *
     * @param aValue where to store the tab count
     */
    sync GetTabCount() returns (uint32_t value);

    async AccessKeyNotHandled(WidgetKeyboardEvent event);

child:
    async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);


parent:

    /**
     * Child informs the parent that the graphics objects are ready for
     * compositing.  This is sent when all pending changes have been
     * sent to the compositor and are ready to be shown on the next composite.
     * @see PCompositor
     * @see RequestNotifyAfterRemotePaint
     */
    async RemotePaintIsReady();

    /**
     * Child informs the parent that the layer tree is already available.
     */
    async ForcePaintNoOp(uint64_t aLayerObserverEpoch);

    /**
     * Sent by the child to the parent to inform it that an update to the
     * dimensions has been requested, likely through win.moveTo or resizeTo
     */
    async SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCx, int32_t aCy);

    nested(inside_sync) sync DispatchWheelEvent(WidgetWheelEvent event);
    nested(inside_sync) sync DispatchMouseEvent(WidgetMouseEvent event);
    nested(inside_sync) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);

    async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
                            OptionalShmem visualData,
                            uint32_t stride, uint8_t format,
                            LayoutDeviceIntRect dragRect);

    async AudioChannelActivityNotification(uint32_t aAudioChannel,
                                           bool aActive);

    // After a compositor reset, it is necessary to reconnect each layers ID to
    // the compositor of the widget that will render those layers. Note that
    // this is sync so we can ensure that messages to the window compositor
    // arrive before the TabChild attempts to use its cross-process compositor
    // bridge.
    sync EnsureLayersConnected();

    /**
     * Notify parent that one or more entries have been added / removed from
     * the child session history.
     *
     * @param aCount the updated number of entries in child session history
     */
    async NotifySessionHistoryChange(uint32_t aCount);

    /**
     * When the session history is across multiple root docshells, this function
     * is used to notify parent that it needs to navigate to an entry out of
     * local index of the child.
     *
     * @param aGlobalIndex The global index of history entry to navigate to.
     */
    async RequestCrossBrowserNavigation(uint32_t aGlobalIndex);

child:
    /**
     * Notify the remote browser that it has been Show()n on this
     * side, with the given |visibleRect|.  This message is expected
     * to trigger creation of the remote browser's "widget".
     *
     * |Show()| and |Move()| take IntSizes rather than Rects because
     * content processes always render to a virtual <0, 0> top-left
     * point.
     */
    async Show(ScreenIntSize size,
               ShowInfo info,
               TextureFactoryIdentifier textureFactoryIdentifier,
               uint64_t layersId,
               nullable PRenderFrame renderFrame,
               bool parentIsActive,
               nsSizeMode sizeMode);

    async LoadURL(nsCString uri, ShowInfo info);

    async UpdateDimensions(CSSRect rect, CSSSize size,
                           ScreenOrientationInternal orientation,
                           LayoutDeviceIntPoint clientOffset,
                           LayoutDeviceIntPoint chromeDisp) compressall;

    async SizeModeChanged(nsSizeMode sizeMode);

    /**
     * Sending an activate message moves focus to the child.
     */
    async Activate();

    async Deactivate();

    async ParentActivated(bool aActivated);

    async SetKeyboardIndicators(UIStateChangeType showAccelerators,
                                UIStateChangeType showFocusRings);

    /**
     * StopIMEStateManagement() is called when the process loses focus and
     * should stop managing IME state.
     */
    async StopIMEStateManagement();

    /**
     * MenuKeyboardListenerInstalled() is called when menu keyboard listener
     * is installed in the parent process.
     */
    async MenuKeyboardListenerInstalled(bool aInstalled);

    /**
     * @see nsIDOMWindowUtils sendMouseEvent.
     */
    async MouseEvent(nsString aType,
                     float aX,
                     float aY,
                     int32_t aButton,
                     int32_t aClickCount,
                     int32_t aModifiers,
                     bool aIgnoreRootScrollFrame);

    /**
     * When two consecutive mouse move events would be added to the message queue,
     * they are 'compressed' by dumping the oldest one.
     */
    async RealMouseMoveEvent(WidgetMouseEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId) compress;
    /**
     * Mouse move events with |reason == eSynthesized| are sent via a separate
     * message because they do not generate DOM 'mousemove' events, and the
     * 'compress' attribute on RealMouseMoveEvent() could result in a
     * |reason == eReal| event being dropped in favour of an |eSynthesized|
     * event, and thus a DOM 'mousemove' event to be lost.
     */
    async SynthMouseMoveEvent(WidgetMouseEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
    async RealMouseButtonEvent(WidgetMouseEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
    async RealKeyEvent(WidgetKeyboardEvent event, MaybeNativeKeyBinding keyBinding);
    async MouseWheelEvent(WidgetWheelEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
    async RealTouchEvent(WidgetTouchEvent aEvent,
                         ScrollableLayerGuid aGuid,
                         uint64_t aInputBlockId,
                         nsEventStatus aApzResponse);
    async HandleTap(TapType aType, LayoutDevicePoint point, Modifiers aModifiers,
                    ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
    async RealTouchMoveEvent(WidgetTouchEvent aEvent,
                             ScrollableLayerGuid aGuid,
                             uint64_t aInputBlockId,
                             nsEventStatus aApzResponse);
    async RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction, uint32_t aDropEffect);
    async PluginEvent(WidgetPluginEvent aEvent);

    /**
     * @see nsIDOMWindowUtils sendKeyEvent.
     */
    async KeyEvent(nsString aType,
                   int32_t aKeyCode,
                   int32_t aCharCode,
                   int32_t aModifiers,
                   bool aPreventDefault);

    async CompositionEvent(WidgetCompositionEvent event);

    async SelectionEvent(WidgetSelectionEvent event);

    /**
     * Call PasteTransferable via a controller on the content process
     * to handle the command content event, "pasteTransferable".
     */
    async PasteTransferable(IPCDataTransfer aDataTransfer,
                            bool aIsPrivateData,
                            Principal aRequestingPrincipal);

    /**
     * Activate event forwarding from client to parent.
     */
    async ActivateFrameEvent(nsString aType, bool capture);

    async LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);

    /**
     * Sent by the chrome process when it no longer wants this remote
     * <browser>.  The child side cleans up in response, then
     * finalizing its death by sending back __delete__() to the
     * parent.
     */
    async Destroy();

    /**
     * Update the child side docShell active (resource use) state.
     *
     * @param aIsActive
     *        Whether to activate or deactivate the docshell.
     * @param aPreserveLayers
     *        Whether layer trees should be preserved for inactive docshells.
     * @param aLayerObserverEpoch
     *        The layer observer epoch for this activation. This message should be
     *        ignored if this epoch has already been observed (via ForcePaint).
     */
    async SetDocShellIsActive(bool aIsActive, bool aPreserveLayers, uint64_t aLayerObserverEpoch);

    /**
     * Notify the child that it shouldn't paint the offscreen displayport.
     * This is useful to speed up interactive operations over async
     * scrolling performance like resize, tabswitch, pageload.
     *
     * Each enable call must be matched with a disable call. The child
     * will remain in the suppress mode as long as there's
     * a single unmatched call.
     */
    async SuppressDisplayport(bool aEnabled);

    /**
     * Navigate by key (Tab/Shift+Tab/F6/Shift+f6).
     */
    async NavigateByKey(bool aForward, bool aForDocumentNavigation);

    /**
     * The parent (chrome thread) requests that the child inform it when
     * the graphics objects are ready to display.
     * @see PCompositor
     * @see RemotePaintIsReady
     */
    async RequestNotifyAfterRemotePaint();

    /**
     * Tell the child that the UI resolution changed for the containing
     * window.
     * To avoid some sync messages from child to parent, we also send the dpi
     * and default scale with the notification.
     * If we don't know the dpi and default scale, we just pass in a negative
     * value (-1) but in the majority of the cases this saves us from two
     * sync requests from the child to the parent.
     */
    async UIResolutionChanged(float dpi, int32_t rounding, double scale);

    /**
     * Tell the child that the system theme has changed, and that a repaint
     * is necessary.
     */
    async ThemeChanged(LookAndFeelInt[] lookAndFeelIntCache);

    /**
     * Tell the browser that its frame loader has been swapped
     * with another.
     */
    async SwappedWithOtherRemoteLoader(IPCTabContext context);

    /**
     * A potential accesskey was just pressed. Look for accesskey targets
     * using the list of provided charCodes.
     *
     * @param event keyboard event
     * @param isTrusted true if triggered by a trusted key event
     * @param modifierMask indicates which accesskey modifiers are pressed
     */
    async HandleAccessKey(WidgetKeyboardEvent event,
                          uint32_t[] charCodes, int32_t modifierMask);

    /**
     * Propagate a refresh to the child process
     */
    async AudioChannelChangeNotification(uint32_t aAudioChannel,
                                         float aVolume,
                                         bool aMuted);

    /**
     * Tells the root child docShell whether or not to use
     * global history. This is sent right after the PBrowser
     * is bound to a frameloader element.
     */
    async SetUseGlobalHistory(bool aUse);

    /**
     * HandledWindowedPluginKeyEvent() is always called after posting a native
     * key event with OnWindowedPluginKeyEvent().
     *
     * @param aKeyEventData      The key event which was posted to the parent
     *                           process.
     * @param aIsConsumed        true if aKeyEventData is consumed in the
     *                           parent process.  Otherwise, false.
     */
    async HandledWindowedPluginKeyEvent(NativeEventData aKeyEventData,
                                        bool aIsConsumed);

    /**
     * Tell the child to print the current page with the given settings.
     *
     * @param aOuterWindowID the ID of the outer window to print
     * @param aPrintData the serialized settings to print with
     */
    async Print(uint64_t aOuterWindowID, PrintData aPrintData);

    /**
     * Update the child with the tab's current top-level native window handle.
     * This is used by a11y objects who must expose their native window.
     *
     * @param aNewHandle The native window handle of the tab's top-level window.
     */
    async UpdateNativeWindowHandle(uintptr_t aNewHandle);

    /**
     * Called when the session history of this particular PBrowser has been
     * attached to a grouped session history.
     *
     * @param aOffset           The number of entries in the grouped session
     *                          history before this session history object.
     */
    async NotifyAttachGroupedSessionHistory(uint32_t aOffset);

    /**
     * Notify that the session history associated to this PBrowser has become
     * the active history in the grouped session history.
     *
     * @param aGlobalLength      The up-to-date number of entries in the grouped
     *                           session history.
     * @param aTargetLocalIndex  The target local index to navigate to.
     */
    async NotifyPartialSessionHistoryActive(uint32_t aGlobalLength,
                                            uint32_t aTargetLocalIndex);

    /**
     * Notify that the session history asssociates to this PBrowser has become
     * an inactive history in the grouped session history.
     */
    async NotifyPartialSessionHistoryDeactive();

    /**
     * Tell the child that it is a fresh process created for a Large-Allocation
     * load.
     */
    async SetFreshProcess();

/*
 * FIXME: write protocol!

state LIVE:
    send LoadURL goto LIVE;
//etc.
    send Destroy goto DYING;

state DYING:
    discard send blah;
// etc.
    recv __delete__;
 */
};

}
}