michael@0: /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ michael@0: /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PBlob; michael@0: include protocol PColorPicker; michael@0: include protocol PContent; michael@0: include protocol PDocumentRenderer; michael@0: include protocol PContentPermissionRequest; michael@0: include protocol PFilePicker; michael@0: include protocol PRenderFrame; michael@0: include protocol POfflineCacheUpdate; michael@0: include protocol PIndexedDB; michael@0: include DOMTypes; michael@0: include JavaScriptTypes; michael@0: include URIParams; michael@0: include PContentPermission; michael@0: michael@0: michael@0: using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; michael@0: using struct mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h"; michael@0: using struct gfxSize from "gfxPoint.h"; michael@0: using CSSRect from "Units.h"; michael@0: using struct mozilla::layers::FrameMetrics from "FrameMetrics.h"; michael@0: using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h"; michael@0: using struct mozilla::layers::ZoomConstraints from "FrameMetrics.h"; michael@0: using FrameMetrics::ViewID from "FrameMetrics.h"; michael@0: using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h"; michael@0: using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; michael@0: using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h"; michael@0: using nscolor from "nsColor.h"; michael@0: using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h"; michael@0: using struct nsIMEUpdatePreference from "nsIWidget.h"; michael@0: using struct nsIntPoint from "nsPoint.h"; michael@0: using struct nsIntRect from "nsRect.h"; michael@0: using struct nsIntSize from "nsSize.h"; michael@0: using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h"; michael@0: using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h"; michael@0: using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h"; michael@0: using struct nsRect from "nsRect.h"; michael@0: using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h"; michael@0: using class mozilla::WidgetTextEvent from "ipc/nsGUIEventIPC.h"; michael@0: using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h"; michael@0: using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h"; michael@0: using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h"; michael@0: using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; michael@0: using mozilla::CSSPoint from "Units.h"; michael@0: using mozilla::CSSToScreenScale from "Units.h"; michael@0: using mozilla::CommandInt from "mozilla/EventForwards.h"; michael@0: using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: struct NativeKeyBinding michael@0: { michael@0: CommandInt[] singleLineCommands; michael@0: CommandInt[] multiLineCommands; michael@0: CommandInt[] richTextCommands; michael@0: }; michael@0: michael@0: union MaybeNativeKeyBinding michael@0: { michael@0: NativeKeyBinding; michael@0: void_t; michael@0: }; michael@0: michael@0: intr protocol PBrowser michael@0: { michael@0: manager PContent; michael@0: michael@0: manages PColorPicker; michael@0: manages PDocumentRenderer; michael@0: manages PContentPermissionRequest; michael@0: manages PFilePicker; michael@0: manages PRenderFrame; michael@0: manages POfflineCacheUpdate; michael@0: manages PIndexedDB; michael@0: michael@0: both: michael@0: AsyncMessage(nsString aMessage, ClonedMessageData aData, CpowEntry[] aCpows, michael@0: Principal aPrincipal); michael@0: michael@0: parent: michael@0: /** michael@0: * When child sends this message, parent should move focus to michael@0: * the next or previous focusable element. michael@0: */ michael@0: MoveFocus(bool forward); michael@0: michael@0: Event(RemoteDOMEvent aEvent); michael@0: michael@0: intr CreateWindow() returns (PBrowser window); michael@0: michael@0: sync SyncMessage(nsString aMessage, ClonedMessageData aData, michael@0: CpowEntry[] aCpows, Principal aPrincipal) michael@0: returns (nsString[] retval); michael@0: michael@0: rpc RpcMessage(nsString aMessage, ClonedMessageData aData, michael@0: CpowEntry[] aCpows, Principal aPrincipal) michael@0: returns (nsString[] retval); michael@0: michael@0: /** michael@0: * The IME sequence number (seqno) parameter is used to make sure michael@0: * that a notification is discarded if it arrives at the chrome process michael@0: * too late. If the notification is late and we accept it, we will have michael@0: * an out-of-date view of the content process, which means events that we michael@0: * dispatch based on this out-of-date view will be wrong also. michael@0: * (see Bug 599550 and Bug 591047 comments 44, 50, and 54) michael@0: * michael@0: * Chrome increments seqno and includes it in each IME event sent to michael@0: * content, and content sends its current seqno back to chrome with each michael@0: * notification. A notification is up-to-date only if the content michael@0: * seqno is the same as the current chrome seqno, meaning no additional michael@0: * event was sent to content before the notification was received michael@0: * michael@0: * On blur, chrome returns the current seqno to content, and content michael@0: * uses it to discard subsequent events until the content seqno and michael@0: * chrome seqno-on-blur match again. These events, meant for the blurred michael@0: * textfield, are discarded to prevent events going to the wrong target michael@0: */ michael@0: michael@0: /** michael@0: * Notifies chrome that there is a focus change involving an editable michael@0: * object (input, textarea, document, contentEditable. etc.) michael@0: * michael@0: * focus PR_TRUE if editable object is receiving focus michael@0: * PR_FALSE if losing focus michael@0: * preference Native widget preference for IME updates michael@0: * seqno Current seqno value on the chrome side michael@0: */ michael@0: sync NotifyIMEFocus(bool focus) michael@0: returns (nsIMEUpdatePreference preference, uint32_t seqno); michael@0: michael@0: /** michael@0: * Notifies chrome that there has been a change in text content michael@0: * One call can encompass both a delete and an insert operation michael@0: * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates michael@0: * michael@0: * offset Starting offset of the change michael@0: * end Ending offset of the range deleted michael@0: * newEnd New ending offset after insertion michael@0: * causedByComposition true if the change is caused by composition michael@0: * michael@0: * for insertion, offset == end michael@0: * for deletion, offset == newEnd michael@0: */ michael@0: NotifyIMETextChange(uint32_t offset, uint32_t end, uint32_t newEnd, michael@0: bool causedByComposition); michael@0: michael@0: /** michael@0: * Notifies chrome that there is a IME compostion rect updated michael@0: * michael@0: * offset The starting offset of this rect michael@0: * rect The rect of first character of selected IME composition michael@0: * caretRect The rect of IME caret michael@0: */ michael@0: NotifyIMESelectedCompositionRect(uint32_t offset, nsIntRect rect, nsIntRect caretRect); michael@0: michael@0: /** michael@0: * Notifies chrome that there has been a change in selection michael@0: * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates michael@0: * michael@0: * seqno Current seqno value on the content side michael@0: * anchor Offset where the selection started michael@0: * focus Offset where the caret is michael@0: * causedByComposition true if the change is caused by composition michael@0: */ michael@0: NotifyIMESelection(uint32_t seqno, uint32_t anchor, uint32_t focus, michael@0: bool causedByComposition); michael@0: michael@0: /** michael@0: * Notifies chrome to refresh its text cache michael@0: * michael@0: * text The entire content of the text field michael@0: */ michael@0: NotifyIMETextHint(nsString text); michael@0: michael@0: /** michael@0: * Instructs chrome to end any pending composition michael@0: * michael@0: * cancel PR_TRUE if composition should be cancelled michael@0: * composition Text to commit before ending the composition michael@0: * michael@0: * if cancel is PR_TRUE, michael@0: * widget should return empty string for composition michael@0: * if cancel is PR_FALSE, michael@0: * widget should return the current composition text michael@0: */ michael@0: sync EndIMEComposition(bool cancel) returns (nsString composition); michael@0: michael@0: /** michael@0: * Request that the parent process move focus to the browser's frame. If michael@0: * canRaise is true, the window can be raised if it is inactive. michael@0: */ michael@0: RequestFocus(bool canRaise); michael@0: michael@0: sync GetInputContext() returns (int32_t IMEEnabled, int32_t IMEOpen, michael@0: intptr_t NativeIMEContext); michael@0: michael@0: SetInputContext(int32_t IMEEnabled, michael@0: int32_t IMEOpen, michael@0: nsString type, michael@0: nsString inputmode, michael@0: nsString actionHint, michael@0: int32_t cause, michael@0: int32_t focusChange); michael@0: michael@0: sync IsParentWindowMainWidgetVisible() returns (bool visible); michael@0: michael@0: /** michael@0: * Gets the DPI of the screen corresponding to this browser. michael@0: */ michael@0: sync GetDPI() returns (float value); michael@0: michael@0: /** michael@0: * Gets the default scaling factor of the screen corresponding to this browser. michael@0: */ michael@0: sync GetDefaultScale() returns (double value); michael@0: michael@0: /** michael@0: * Return native data of root widget michael@0: */ michael@0: sync GetWidgetNativeData() returns (WindowsHandle value); michael@0: michael@0: SetCursor(uint32_t value); michael@0: SetBackgroundColor(nscolor color); michael@0: michael@0: /** michael@0: * Used to set the current text of the status tooltip. michael@0: * Nowadays this is mainly used for link locations on hover. michael@0: */ michael@0: SetStatus(uint32_t type, nsString status); michael@0: michael@0: /** michael@0: * Show/hide a tooltip when the mouse hovers over an element in the content michael@0: * document. michael@0: */ michael@0: ShowTooltip(uint32_t x, uint32_t y, nsString tooltip); michael@0: HideTooltip(); michael@0: michael@0: /** michael@0: * Create an asynchronous color picker on the parent side, michael@0: * but don't open it yet. michael@0: */ michael@0: PColorPicker(nsString title, nsString initialColor); michael@0: michael@0: /** michael@0: * Initiates an asynchronous request for permission for the michael@0: * provided principal. michael@0: * michael@0: * @param aRequests michael@0: * The array of permissions to request. michael@0: * @param aPrincipal michael@0: * The principal of the request. michael@0: * michael@0: * NOTE: The principal is untrusted in the parent process. Only michael@0: * principals that can live in the content process should michael@0: * provided. michael@0: */ michael@0: PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal); michael@0: michael@0: PFilePicker(nsString aTitle, int16_t aMode); michael@0: michael@0: /** michael@0: * Create a layout frame (encapsulating a remote layer tree) for michael@0: * the page that is currently loaded in the . michael@0: */ michael@0: sync PRenderFrame(); michael@0: michael@0: sync InitRenderFrame(PRenderFrame aFrame) michael@0: returns (ScrollingBehavior scrolling, michael@0: TextureFactoryIdentifier textureFactoryIdentifier, uint64_t layersId, michael@0: bool success); michael@0: michael@0: /** michael@0: * Starts an offline application cache update. michael@0: * @param manifestURI michael@0: * URI of the manifest to fetch, the application cache group ID michael@0: * @param documentURI michael@0: * URI of the document that referred the manifest michael@0: * @param stickDocument michael@0: * True if the update was initiated by a document load that referred michael@0: * a manifest. michael@0: * False if the update was initiated by applicationCache.update() call. michael@0: * michael@0: * Tells the update to carry the documentURI to a potential separate michael@0: * update of implicit (master) items. michael@0: * michael@0: * Why this argument? If the document was not found in an offline cache michael@0: * before load and refers a manifest and this manifest itself has not michael@0: * been changed since the last fetch, we will not do the application michael@0: * cache group update. But we must cache the document (identified by the michael@0: * documentURI). This argument will ensure that a previously uncached michael@0: * document will get cached and that we don't re-cache a document that michael@0: * has already been cached (stickDocument=false). michael@0: */ michael@0: POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI, michael@0: bool stickDocument); michael@0: michael@0: /** michael@0: * Sets "offline-app" permission for the principal. Called when we hit michael@0: * a web app with the manifest attribute in and michael@0: * offline-apps.allow_by_default is set to true. michael@0: */ michael@0: SetOfflinePermission(Principal principal); michael@0: michael@0: sync PIndexedDB(nsCString group, nsCString asciiOrigin) michael@0: returns (bool allowed); michael@0: michael@0: /** michael@0: * window.open from inside