dom/ipc/PBrowser.ipdl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
     2 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 include protocol PBlob;
     9 include protocol PColorPicker;
    10 include protocol PContent;
    11 include protocol PDocumentRenderer;
    12 include protocol PContentPermissionRequest;
    13 include protocol PFilePicker;
    14 include protocol PRenderFrame;
    15 include protocol POfflineCacheUpdate;
    16 include protocol PIndexedDB;
    17 include DOMTypes;
    18 include JavaScriptTypes;
    19 include URIParams;
    20 include PContentPermission;
    23 using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
    24 using struct mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
    25 using struct gfxSize from "gfxPoint.h";
    26 using CSSRect from "Units.h";
    27 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
    28 using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
    29 using struct mozilla::layers::ZoomConstraints from "FrameMetrics.h";
    30 using FrameMetrics::ViewID from "FrameMetrics.h";
    31 using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h";
    32 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
    33 using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
    34 using nscolor from "nsColor.h";
    35 using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
    36 using struct nsIMEUpdatePreference from "nsIWidget.h";
    37 using struct nsIntPoint from "nsPoint.h";
    38 using struct nsIntRect from "nsRect.h";
    39 using struct nsIntSize from "nsSize.h";
    40 using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
    41 using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
    42 using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
    43 using struct nsRect from "nsRect.h";
    44 using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
    45 using class mozilla::WidgetTextEvent from "ipc/nsGUIEventIPC.h";
    46 using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
    47 using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
    48 using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
    49 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
    50 using mozilla::CSSPoint from "Units.h";
    51 using mozilla::CSSToScreenScale from "Units.h";
    52 using mozilla::CommandInt from "mozilla/EventForwards.h";
    53 using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
    55 namespace mozilla {
    56 namespace dom {
    58 struct NativeKeyBinding
    59 {
    60   CommandInt[] singleLineCommands;
    61   CommandInt[] multiLineCommands;
    62   CommandInt[] richTextCommands;
    63 };
    65 union MaybeNativeKeyBinding
    66 {
    67   NativeKeyBinding;
    68   void_t;
    69 };
    71 intr protocol PBrowser
    72 {
    73     manager PContent;
    75     manages PColorPicker;
    76     manages PDocumentRenderer;
    77     manages PContentPermissionRequest;
    78     manages PFilePicker;
    79     manages PRenderFrame;
    80     manages POfflineCacheUpdate;
    81     manages PIndexedDB;
    83 both:
    84     AsyncMessage(nsString aMessage, ClonedMessageData aData, CpowEntry[] aCpows,
    85                  Principal aPrincipal);
    87 parent:
    88     /**
    89      * When child sends this message, parent should move focus to
    90      * the next or previous focusable element.
    91      */
    92     MoveFocus(bool forward);
    94     Event(RemoteDOMEvent aEvent);
    96     intr CreateWindow() returns (PBrowser window);
    98     sync SyncMessage(nsString aMessage, ClonedMessageData aData,
    99                      CpowEntry[] aCpows, Principal aPrincipal)
   100       returns (nsString[] retval);
   102     rpc RpcMessage(nsString aMessage, ClonedMessageData aData,
   103                    CpowEntry[] aCpows, Principal aPrincipal)
   104       returns (nsString[] retval);
   106     /**
   107      * The IME sequence number (seqno) parameter is used to make sure
   108      * that a notification is discarded if it arrives at the chrome process
   109      * too late. If the notification is late and we accept it, we will have
   110      * an out-of-date view of the content process, which means events that we
   111      * dispatch based on this out-of-date view will be wrong also.
   112      * (see Bug 599550 and Bug 591047 comments 44, 50, and 54)
   113      *
   114      * Chrome increments seqno and includes it in each IME event sent to
   115      * content, and content sends its current seqno back to chrome with each
   116      * notification. A notification is up-to-date only if the content
   117      * seqno is the same as the current chrome seqno, meaning no additional
   118      * event was sent to content before the notification was received
   119      *
   120      * On blur, chrome returns the current seqno to content, and content
   121      * uses it to discard subsequent events until the content seqno and
   122      * chrome seqno-on-blur match again. These events, meant for the blurred
   123      * textfield, are discarded to prevent events going to the wrong target
   124      */
   126     /**
   127      * Notifies chrome that there is a focus change involving an editable
   128      * object (input, textarea, document, contentEditable. etc.)
   129      *
   130      *  focus        PR_TRUE if editable object is receiving focus
   131      *               PR_FALSE if losing focus
   132      *  preference   Native widget preference for IME updates
   133      *  seqno        Current seqno value on the chrome side
   134      */
   135     sync NotifyIMEFocus(bool focus)
   136       returns (nsIMEUpdatePreference preference, uint32_t seqno);
   138     /**
   139      * Notifies chrome that there has been a change in text content
   140      * One call can encompass both a delete and an insert operation
   141      * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
   142      *
   143      *  offset       Starting offset of the change
   144      *  end          Ending offset of the range deleted
   145      *  newEnd       New ending offset after insertion
   146      *  causedByComposition true if the change is caused by composition
   147      *
   148      *  for insertion, offset == end
   149      *  for deletion, offset == newEnd
   150      */
   151     NotifyIMETextChange(uint32_t offset, uint32_t end, uint32_t newEnd,
   152                         bool causedByComposition);
   154     /**
   155      * Notifies chrome that there is a IME compostion rect updated
   156      *
   157      *  offset       The starting offset of this rect
   158      *  rect         The rect of first character of selected IME composition
   159      *  caretRect    The rect of IME caret
   160      */
   161     NotifyIMESelectedCompositionRect(uint32_t offset, nsIntRect rect, nsIntRect caretRect);
   163     /**
   164      * Notifies chrome that there has been a change in selection
   165      * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
   166      *
   167      *  seqno        Current seqno value on the content side
   168      *  anchor       Offset where the selection started
   169      *  focus        Offset where the caret is
   170      *  causedByComposition true if the change is caused by composition
   171      */
   172     NotifyIMESelection(uint32_t seqno, uint32_t anchor, uint32_t focus,
   173                        bool causedByComposition);
   175     /**
   176      * Notifies chrome to refresh its text cache 
   177      *
   178      *  text         The entire content of the text field
   179      */
   180     NotifyIMETextHint(nsString text);
   182     /**
   183      * Instructs chrome to end any pending composition
   184      *
   185      *  cancel       PR_TRUE if composition should be cancelled
   186      *  composition  Text to commit before ending the composition
   187      *
   188      *  if cancel is PR_TRUE,
   189      *    widget should return empty string for composition
   190      *  if cancel is PR_FALSE,
   191      *    widget should return the current composition text
   192      */
   193     sync EndIMEComposition(bool cancel) returns (nsString composition);
   195     /**
   196      * Request that the parent process move focus to the browser's frame. If
   197      * canRaise is true, the window can be raised if it is inactive.
   198      */
   199     RequestFocus(bool canRaise);
   201     sync GetInputContext() returns (int32_t IMEEnabled, int32_t IMEOpen,
   202                                     intptr_t NativeIMEContext);
   204     SetInputContext(int32_t IMEEnabled,
   205                     int32_t IMEOpen,
   206                     nsString type,
   207                     nsString inputmode,
   208                     nsString actionHint,
   209                     int32_t cause,
   210                     int32_t focusChange);
   212     sync IsParentWindowMainWidgetVisible() returns (bool visible);
   214     /**
   215      * Gets the DPI of the screen corresponding to this browser.
   216      */
   217     sync GetDPI() returns (float value);
   219     /**
   220      * Gets the default scaling factor of the screen corresponding to this browser.
   221      */
   222     sync GetDefaultScale() returns (double value);
   224     /**
   225      * Return native data of root widget
   226      */
   227     sync GetWidgetNativeData() returns (WindowsHandle value);
   229     SetCursor(uint32_t value);
   230     SetBackgroundColor(nscolor color);
   232     /**
   233      * Used to set the current text of the status tooltip.
   234      * Nowadays this is mainly used for link locations on hover.
   235      */
   236     SetStatus(uint32_t type, nsString status);
   238     /**
   239      * Show/hide a tooltip when the mouse hovers over an element in the content
   240      * document.
   241      */
   242     ShowTooltip(uint32_t x, uint32_t y, nsString tooltip);
   243     HideTooltip();
   245     /**
   246      * Create an asynchronous color picker on the parent side,
   247      * but don't open it yet.
   248      */
   249     PColorPicker(nsString title, nsString initialColor);
   251     /**
   252      * Initiates an asynchronous request for permission for the
   253      * provided principal.
   254      *
   255      * @param aRequests
   256      *   The array of permissions to request.
   257      * @param aPrincipal
   258      *   The principal of the request.
   259      *
   260      * NOTE: The principal is untrusted in the parent process. Only
   261      *       principals that can live in the content process should
   262      *       provided.
   263      */
   264     PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal);
   266     PFilePicker(nsString aTitle, int16_t aMode);
   268     /**
   269      * Create a layout frame (encapsulating a remote layer tree) for
   270      * the page that is currently loaded in the <browser>.
   271      */
   272     sync PRenderFrame();
   274     sync InitRenderFrame(PRenderFrame aFrame)
   275         returns (ScrollingBehavior scrolling,
   276                  TextureFactoryIdentifier textureFactoryIdentifier, uint64_t layersId,
   277                  bool success);
   279     /** 
   280      * Starts an offline application cache update.
   281      * @param manifestURI
   282      *   URI of the manifest to fetch, the application cache group ID
   283      * @param documentURI
   284      *   URI of the document that referred the manifest
   285      * @param stickDocument
   286      *   True if the update was initiated by a document load that referred
   287      *   a manifest.
   288      *   False if the update was initiated by applicationCache.update() call.
   289      *
   290      *   Tells the update to carry the documentURI to a potential separate 
   291      *   update of implicit (master) items.
   292      *
   293      *   Why this argument? If the document was not found in an offline cache 
   294      *   before load and refers a manifest and this manifest itself has not 
   295      *   been changed since the last fetch, we will not do the application 
   296      *   cache group update. But we must cache the document (identified by the
   297      *   documentURI). This argument will ensure that a previously uncached 
   298      *   document will get cached and that we don't re-cache a document that 
   299      *   has already been cached (stickDocument=false).
   300      */
   301     POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI,
   302                         bool stickDocument);
   304     /**
   305      * Sets "offline-app" permission for the principal.  Called when we hit
   306      * a web app with the manifest attribute in <html> and
   307      * offline-apps.allow_by_default is set to true.
   308      */
   309     SetOfflinePermission(Principal principal);
   311     sync PIndexedDB(nsCString group, nsCString asciiOrigin)
   312         returns (bool allowed);
   314     /**
   315      * window.open from inside <iframe mozbrowser> is special.  When the child
   316      * process calls window.open, it creates a new PBrowser (in its own
   317      * process), then calls BrowserFrameOpenWindow on it.
   318      *
   319      * The parent process gets a chance to accept or reject the window.open
   320      * call, and windowOpened is set to true if we ended up going through with
   321      * the window.open.
   322      *
   323      * @param opener the PBrowser whose content called window.open.
   324      */
   325     sync BrowserFrameOpenWindow(PBrowser opener, nsString aURL,
   326                                 nsString aName, nsString aFeatures)
   327       returns (bool windowOpened);
   329     /**
   330      * Instructs the TabParent to forward a request to zoom to a rect given in
   331      * CSS pixels. This rect is relative to the document.
   332      */
   333     ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect);
   335     /**
   336      * We know for sure that content has either preventDefaulted or not
   337      * preventDefaulted. This applies to an entire batch of touch events. It is
   338      * expected that, if there are any DOM touch listeners, touch events will be
   339      * batched and only processed for panning and zooming if content does not
   340      * preventDefault.
   341      */
   342     ContentReceivedTouch(ScrollableLayerGuid aGuid, bool aPreventDefault);
   344     /**
   345      * Updates the zoom constraints for a scrollable frame in this tab.
   346      * The zoom controller code lives on the parent side and so this allows it to
   347      * have up-to-date zoom constraints.
   348      */
   349     UpdateZoomConstraints(uint32_t aPresShellId, ViewID aViewId, bool aIsRoot,
   350                           ZoomConstraints aConstraints);
   352     __delete__();
   354     ReplyKeyEvent(WidgetKeyboardEvent event);
   356     sync RequestNativeKeyBindings(WidgetKeyboardEvent event)
   357         returns (MaybeNativeKeyBinding bindings);
   359 child:
   360     /**
   361      * Notify the remote browser that it has been Show()n on this
   362      * side, with the given |visibleRect|.  This message is expected
   363      * to trigger creation of the remote browser's "widget".
   364      *
   365      * |Show()| and |Move()| take IntSizes rather than Rects because
   366      * content processes always render to a virtual <0, 0> top-left
   367      * point.
   368      */
   369     Show(nsIntSize size);
   371     LoadURL(nsCString uri);
   373     CacheFileDescriptor(nsString path, FileDescriptor fd);
   375     UpdateDimensions(nsRect rect, nsIntSize size, ScreenOrientation orientation) compress;
   377     UpdateFrame(FrameMetrics frame);
   379     /**
   380      * Acknowledge the receipt of a scroll offset update from the content
   381      * process. This is used to manage concurrent scroll updates from many
   382      * sources.
   383      */
   384     AcknowledgeScrollUpdate(ViewID aScrollId, uint32_t aScrollGeneration);
   386     /**
   387      * Requests handling of a double tap. |point| is in CSS pixels, relative to
   388      * the scroll offset. This message is expected to round-trip back to
   389      * ZoomToRect() with a rect indicating where we should zoom to.
   390      */
   391     HandleDoubleTap(CSSPoint point, ScrollableLayerGuid aGuid);
   393     /**
   394      * Requests handling of a single tap. |point| is in CSS pixels, relative to
   395      * the scroll offset. This message is expected to send a "mousedown" and
   396      * "mouseup" series of events at this point.
   397      */
   398     HandleSingleTap(CSSPoint point, ScrollableLayerGuid aGuid);
   400     /**
   401      * Requests handling of a long tap. |point| is in CSS pixels, relative to
   402      * the scroll offset. This message is expected to send a "contextmenu"
   403      * events at this point.
   404      */
   405     HandleLongTap(CSSPoint point, ScrollableLayerGuid aGuid);
   407     /**
   408      * Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
   409      * relative to the current scroll offset. In the case the "contextmenu"
   410      * event generated by the preceding HandleLongTap call was not handled,
   411      * this message is expected to generate a "mousedown" and "mouseup"
   412      * series of events
   413      */
   414     HandleLongTapUp(CSSPoint point, ScrollableLayerGuid aGuid);
   416     /**
   417      * Notifies the child about various APZ state changes.
   418      * See GeckoContentController::NotifyAPZStateChange() for details.
   419      */
   420     NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
   422     /**
   423      * Sending an activate message moves focus to the child.
   424      */
   425     Activate();
   427     Deactivate();
   429     /**
   430      * @see nsIDOMWindowUtils sendMouseEvent.
   431      */
   432     MouseEvent(nsString aType,
   433                float aX,
   434                float aY,
   435                int32_t aButton,
   436                int32_t aClickCount,
   437                int32_t aModifiers,
   438                bool aIgnoreRootScrollFrame);
   440     RealMouseEvent(WidgetMouseEvent event);
   441     RealKeyEvent(WidgetKeyboardEvent event, MaybeNativeKeyBinding keyBinding);
   442     MouseWheelEvent(WidgetWheelEvent event);
   443     RealTouchEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid);
   444     // We use a separate message for touchmove events only to apply
   445     // compression to them.
   446     RealTouchMoveEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid) compress;
   448     /**
   449      * @see nsIDOMWindowUtils sendKeyEvent.
   450      */
   451     KeyEvent(nsString aType,
   452              int32_t aKeyCode,
   453              int32_t aCharCode,
   454              int32_t aModifiers,
   455              bool aPreventDefault);
   457     CompositionEvent(WidgetCompositionEvent event);
   459     TextEvent(WidgetTextEvent event);
   461     SelectionEvent(WidgetSelectionEvent event);
   463     /**
   464      * Activate event forwarding from client to parent.
   465      */
   466     ActivateFrameEvent(nsString aType, bool capture);
   468     LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);
   470     /**
   471      * Create a asynchronous request to render whatever document is
   472      * loaded in the child when this message arrives.  When the
   473      * request finishes, PDocumentRenderer:__delete__ is sent back to
   474      * this side to notify completion.
   475      *
   476      * |documentRect| is the area of the remote document to draw,
   477      * transformed by |transform|.  The rendered area will have the
   478      * default background color |bgcolor|.  |renderFlags| are the
   479      * nsIPresShell::RenderDocument() flags to use on the remote side,
   480      * and if true, |flushLayout| will do just that before rendering
   481      * the document.  The rendered image will be of size |renderSize|.
   482      */
   483     PDocumentRenderer(nsRect documentRect, Matrix transform,
   484                       nsString bgcolor,
   485                       uint32_t renderFlags, bool flushLayout,
   486                       nsIntSize renderSize);
   488     /**
   489      * Sent by the chrome process when it no longer wants this remote
   490      * <browser>.  The child side cleans up in response, then
   491      * finalizing its death by sending back __delete__() to the
   492      * parent.
   493      */
   494     Destroy();
   497     /**
   498      * Tell the child side if it has to update it's touchable region
   499      * to the parent.
   500      */
   501     SetUpdateHitRegion(bool aEnabled);
   503     /**
   504      * Tell the child to update its docShell's active state.
   505      */
   506     SetIsDocShellActive(bool aIsActive);
   508 /*
   509  * FIXME: write protocol!
   511 state LIVE:
   512     send LoadURL goto LIVE;
   513 //etc.
   514     send Destroy goto DYING;
   516 state DYING:
   517     discard send blah;
   518 // etc.
   519     recv __delete__;
   520  */
   521 };
   523 }
   524 }

mercurial