2009-09-09 15:00:14 -07:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
|
2009-08-18 12:05:15 -07:00
|
|
|
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
|
|
|
|
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
include protocol PContent;
|
|
|
|
include protocol PContentDialog;
|
2010-04-27 00:12:38 -07:00
|
|
|
include protocol PDocumentRenderer;
|
2010-09-09 22:00:08 -07:00
|
|
|
include protocol PContentPermissionRequest;
|
2010-08-20 16:24:41 -07:00
|
|
|
include protocol PRenderFrame;
|
2010-10-20 10:12:32 -07:00
|
|
|
include protocol POfflineCacheUpdate;
|
2012-06-01 10:21:12 -07:00
|
|
|
include protocol PIndexedDB;
|
2009-09-09 15:00:14 -07:00
|
|
|
|
2012-06-07 01:41:59 -07:00
|
|
|
include "mozilla/dom/TabMessageUtils.h";
|
2010-03-24 03:47:18 -07:00
|
|
|
include "gfxMatrix.h";
|
2010-05-13 10:44:51 -07:00
|
|
|
include "mozilla/net/NeckoMessageUtils.h";
|
2010-08-17 01:07:42 -07:00
|
|
|
include "IPC/nsGUIEventIPC.h";
|
2009-11-12 14:20:20 -08:00
|
|
|
|
2010-03-24 03:47:18 -07:00
|
|
|
using gfxMatrix;
|
2010-08-20 16:24:40 -07:00
|
|
|
using IPC::URI;
|
2010-08-17 01:07:42 -07:00
|
|
|
using nsCompositionEvent;
|
2010-10-26 15:20:53 -07:00
|
|
|
using nsIMEUpdatePreference;
|
|
|
|
using nsIntSize;
|
2010-08-17 01:07:42 -07:00
|
|
|
using nsQueryContentEvent;
|
2010-10-26 15:20:53 -07:00
|
|
|
using nsRect;
|
2010-08-17 01:07:42 -07:00
|
|
|
using nsSelectionEvent;
|
2010-10-26 15:20:53 -07:00
|
|
|
using nsTextEvent;
|
2011-06-21 17:32:43 -07:00
|
|
|
using nsMouseEvent;
|
|
|
|
using nsMouseScrollEvent;
|
|
|
|
using nsKeyEvent;
|
2010-08-20 16:24:40 -07:00
|
|
|
using RemoteDOMEvent;
|
2011-07-21 17:49:35 -07:00
|
|
|
using mozilla::WindowsHandle;
|
2011-10-20 15:17:09 -07:00
|
|
|
using nscolor;
|
2009-08-25 16:07:22 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2009-09-09 15:00:14 -07:00
|
|
|
namespace dom {
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
rpc protocol PBrowser
|
2009-08-25 16:07:22 -07:00
|
|
|
{
|
2010-07-19 11:33:33 -07:00
|
|
|
manager PContent;
|
|
|
|
|
|
|
|
manages PContentDialog;
|
2009-10-29 10:58:31 -07:00
|
|
|
manages PDocumentRenderer;
|
2010-09-09 22:00:08 -07:00
|
|
|
manages PContentPermissionRequest;
|
2010-08-20 16:24:41 -07:00
|
|
|
manages PRenderFrame;
|
2010-10-20 10:12:32 -07:00
|
|
|
manages POfflineCacheUpdate;
|
2012-06-01 10:21:12 -07:00
|
|
|
manages PIndexedDB;
|
2010-07-19 11:33:33 -07:00
|
|
|
|
|
|
|
both:
|
|
|
|
AsyncMessage(nsString aMessage, nsString aJSON);
|
2009-09-09 15:00:14 -07:00
|
|
|
|
2009-11-05 10:14:22 -08:00
|
|
|
parent:
|
|
|
|
/**
|
|
|
|
* When child sends this message, parent should move focus to
|
|
|
|
* the next or previous focusable element.
|
|
|
|
*/
|
2010-07-19 11:33:33 -07:00
|
|
|
MoveFocus(bool forward);
|
2009-11-05 10:14:22 -08:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
Event(RemoteDOMEvent aEvent);
|
2009-12-31 17:35:55 -08:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
rpc CreateWindow() returns (PBrowser window);
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
sync SyncMessage(nsString aMessage, nsString aJSON)
|
2010-03-29 13:29:45 -07:00
|
|
|
returns (nsString[] retval);
|
|
|
|
|
2010-10-01 07:17:37 -07:00
|
|
|
/**
|
|
|
|
* The IME sequence number (seqno) parameter is used to make sure
|
|
|
|
* that a notification is discarded if it arrives at the chrome process
|
|
|
|
* too late. If the notification is late and we accept it, we will have
|
|
|
|
* an out-of-date view of the content process, which means events that we
|
|
|
|
* dispatch based on this out-of-date view will be wrong also.
|
|
|
|
* (see Bug 599550 and Bug 591047 comments 44, 50, and 54)
|
|
|
|
*
|
|
|
|
* Chrome increments seqno and includes it in each IME event sent to
|
|
|
|
* content, and content sends its current seqno back to chrome with each
|
|
|
|
* notification. A notification is up-to-date only if the content
|
|
|
|
* seqno is the same as the current chrome seqno, meaning no additional
|
|
|
|
* event was sent to content before the notification was received
|
|
|
|
*
|
|
|
|
* On blur, chrome returns the current seqno to content, and content
|
|
|
|
* uses it to discard subsequent events until the content seqno and
|
|
|
|
* chrome seqno-on-blur match again. These events, meant for the blurred
|
|
|
|
* textfield, are discarded to prevent events going to the wrong target
|
|
|
|
*/
|
|
|
|
|
2010-09-23 20:28:15 -07:00
|
|
|
/**
|
|
|
|
* Notifies chrome that there is a focus change involving an editable
|
|
|
|
* object (input, textarea, document, contentEditable. etc.)
|
|
|
|
*
|
|
|
|
* focus PR_TRUE if editable object is receiving focus
|
|
|
|
* PR_FALSE if losing focus
|
|
|
|
* preference Native widget preference for IME updates
|
2010-10-01 07:17:37 -07:00
|
|
|
* seqno Current seqno value on the chrome side
|
2010-09-23 20:28:15 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
sync NotifyIMEFocus(bool focus)
|
2010-10-01 07:17:37 -07:00
|
|
|
returns (nsIMEUpdatePreference preference, PRUint32 seqno);
|
2010-09-23 20:28:15 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* offset Starting offset of the change
|
|
|
|
* end Ending offset of the range deleted
|
|
|
|
* newEnd New ending offset after insertion
|
|
|
|
*
|
|
|
|
* for insertion, offset == end
|
|
|
|
* for deletion, offset == newEnd
|
|
|
|
*/
|
|
|
|
NotifyIMETextChange(PRUint32 offset, PRUint32 end, PRUint32 newEnd);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies chrome that there has been a change in selection
|
|
|
|
* Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
|
|
|
|
*
|
2010-10-01 07:17:37 -07:00
|
|
|
* seqno Current seqno value on the content side
|
2010-09-23 20:28:15 -07:00
|
|
|
* anchor Offset where the selection started
|
|
|
|
* focus Offset where the caret is
|
|
|
|
*/
|
2010-10-01 07:17:37 -07:00
|
|
|
NotifyIMESelection(PRUint32 seqno, PRUint32 anchor, PRUint32 focus);
|
2010-09-23 20:28:15 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies chrome to refresh its text cache
|
|
|
|
* Only called when NotifyIMEFocus returns PR_TRUE for mWantHints
|
|
|
|
*
|
|
|
|
* text The entire content of the text field
|
|
|
|
*/
|
|
|
|
NotifyIMETextHint(nsString text);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs chrome to end any pending composition
|
|
|
|
*
|
|
|
|
* cancel PR_TRUE if composition should be cancelled
|
|
|
|
* composition Text to commit before ending the composition
|
|
|
|
*
|
|
|
|
* if cancel is PR_TRUE,
|
|
|
|
* widget should return empty string for composition
|
|
|
|
* if cancel is PR_FALSE,
|
|
|
|
* widget should return the current composition text
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
sync EndIMEComposition(bool cancel) returns (nsString composition);
|
2010-09-23 20:28:15 -07:00
|
|
|
|
2011-11-27 03:51:53 -08:00
|
|
|
sync GetInputContext() returns (PRInt32 IMEEnabled, PRInt32 IMEOpen);
|
2010-09-23 20:28:15 -07:00
|
|
|
|
2011-11-27 03:51:53 -08:00
|
|
|
SetInputContext(PRInt32 IMEEnabled,
|
|
|
|
PRInt32 IMEOpen,
|
2011-11-27 03:51:52 -08:00
|
|
|
nsString type,
|
|
|
|
nsString actionHint,
|
|
|
|
PRInt32 cause,
|
|
|
|
PRInt32 focusChange);
|
2010-09-23 20:28:15 -07:00
|
|
|
|
2010-12-02 17:24:04 -08:00
|
|
|
/**
|
|
|
|
* Gets the DPI of the screen corresponding to this browser.
|
|
|
|
*/
|
|
|
|
sync GetDPI() returns (float value);
|
|
|
|
|
2011-07-21 17:49:35 -07:00
|
|
|
/**
|
|
|
|
* Return native data of root widget
|
|
|
|
*/
|
|
|
|
sync GetWidgetNativeData() returns (WindowsHandle value);
|
|
|
|
|
2011-06-21 17:32:43 -07:00
|
|
|
SetCursor(PRUint32 value);
|
2011-10-20 15:17:09 -07:00
|
|
|
SetBackgroundColor(nscolor color);
|
2011-06-21 17:32:43 -07:00
|
|
|
|
2010-09-09 22:00:08 -07:00
|
|
|
PContentPermissionRequest(nsCString aType, URI uri);
|
2010-05-13 10:44:51 -07:00
|
|
|
|
2010-05-17 04:25:22 -07:00
|
|
|
PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
|
|
|
|
PRInt32[] aIntParams, nsString[] aStringParams);
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
/**
|
|
|
|
* Create a layout frame (encapsulating a remote layer tree) for
|
|
|
|
* the page that is currently loaded in the <browser>.
|
|
|
|
*/
|
|
|
|
async PRenderFrame();
|
|
|
|
|
2010-10-20 10:12:32 -07:00
|
|
|
/**
|
|
|
|
* Starts an offline application cache update.
|
|
|
|
* @param manifestURI
|
|
|
|
* URI of the manifest to fetch, the application cache group ID
|
|
|
|
* @param documentURI
|
|
|
|
* URI of the document that referred the manifest
|
|
|
|
* @param clientID
|
|
|
|
* The group cache version identifier to use
|
|
|
|
* @param stickDocument
|
|
|
|
* True if the update was initiated by a document load that referred
|
|
|
|
* a manifest.
|
|
|
|
* False if the update was initiated by applicationCache.update() call.
|
|
|
|
*
|
|
|
|
* Tells the update to carry the documentURI to a potential separate
|
|
|
|
* update of implicit (master) items.
|
|
|
|
*
|
|
|
|
* Why this argument? If the document was not found in an offline cache
|
|
|
|
* before load and refers a manifest and this manifest itself has not
|
|
|
|
* been changed since the last fetch, we will not do the application
|
|
|
|
* cache group update. But we must cache the document (identified by the
|
|
|
|
* documentURI). This argument will ensure that a previously uncached
|
|
|
|
* document will get cached and that we don't re-cache a document that
|
|
|
|
* has already been cached (stickDocument=false).
|
|
|
|
*/
|
|
|
|
POfflineCacheUpdate(URI manifestURI, URI documentURI, nsCString clientID,
|
|
|
|
bool stickDocument);
|
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
sync PIndexedDB(nsCString asciiOrigin)
|
|
|
|
returns (bool allowed);
|
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
__delete__();
|
|
|
|
|
2009-09-09 15:00:14 -07:00
|
|
|
child:
|
2010-08-20 16:24:40 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
Show(nsIntSize size);
|
2009-10-28 13:41:46 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
LoadURL(nsCString uri);
|
2009-09-09 15:00:14 -07:00
|
|
|
|
2011-07-15 14:46:56 -07:00
|
|
|
UpdateDimensions(nsRect rect, nsIntSize size);
|
2009-10-29 10:58:31 -07:00
|
|
|
|
2009-11-05 10:14:22 -08:00
|
|
|
/**
|
|
|
|
* Sending an activate message moves focus to the child.
|
|
|
|
*/
|
2010-07-19 11:33:33 -07:00
|
|
|
Activate();
|
2010-03-18 23:52:18 -07:00
|
|
|
|
2011-06-17 17:08:32 -07:00
|
|
|
Deactivate();
|
|
|
|
|
2009-11-17 06:22:23 -08:00
|
|
|
/**
|
2010-07-19 11:33:33 -07:00
|
|
|
* @see nsIDOMWindowUtils sendMouseEvent.
|
|
|
|
*/
|
|
|
|
MouseEvent(nsString aType,
|
|
|
|
float aX,
|
|
|
|
float aY,
|
|
|
|
PRInt32 aButton,
|
|
|
|
PRInt32 aClickCount,
|
|
|
|
PRInt32 aModifiers,
|
|
|
|
bool aIgnoreRootScrollFrame);
|
|
|
|
|
2011-06-21 17:32:43 -07:00
|
|
|
RealMouseEvent(nsMouseEvent event);
|
|
|
|
RealKeyEvent(nsKeyEvent event);
|
|
|
|
MouseScrollEvent(nsMouseScrollEvent event);
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
/**
|
|
|
|
* @see nsIDOMWindowUtils sendKeyEvent.
|
2009-11-17 06:22:23 -08:00
|
|
|
*/
|
2010-07-19 11:33:33 -07:00
|
|
|
KeyEvent(nsString aType,
|
|
|
|
PRInt32 aKeyCode,
|
|
|
|
PRInt32 aCharCode,
|
|
|
|
PRInt32 aModifiers,
|
|
|
|
bool aPreventDefault);
|
2009-11-17 06:22:23 -08:00
|
|
|
|
2010-08-17 01:07:42 -07:00
|
|
|
CompositionEvent(nsCompositionEvent event);
|
|
|
|
|
|
|
|
TextEvent(nsTextEvent event);
|
|
|
|
|
|
|
|
SelectionEvent(nsSelectionEvent event);
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
/**
|
|
|
|
* Activate event forwarding from client to parent.
|
|
|
|
*/
|
|
|
|
ActivateFrameEvent(nsString aType, bool capture);
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
LoadRemoteScript(nsString aURL);
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2010-10-26 15:20:53 -07:00
|
|
|
/**
|
|
|
|
* Create a asynchronous request to render whatever document is
|
|
|
|
* loaded in the child when this message arrives. When the
|
|
|
|
* request finishes, PDocumentRenderer:__delete__ is sent back to
|
|
|
|
* this side to notify completion.
|
|
|
|
*
|
2010-10-26 15:20:53 -07:00
|
|
|
* |documentRect| is the area of the remote document to draw,
|
|
|
|
* transformed by |transform|. The rendered area will have the
|
|
|
|
* default background color |bgcolor|. |renderFlags| are the
|
|
|
|
* nsIPresShell::RenderDocument() flags to use on the remote side,
|
|
|
|
* and if true, |flushLayout| will do just that before rendering
|
2010-10-26 15:20:53 -07:00
|
|
|
* the document. The rendered image will be of size |renderSize|.
|
2010-10-26 15:20:53 -07:00
|
|
|
*/
|
2010-10-26 15:20:53 -07:00
|
|
|
PDocumentRenderer(nsRect documentRect, gfxMatrix transform,
|
|
|
|
nsString bgcolor,
|
2010-10-26 15:20:53 -07:00
|
|
|
PRUint32 renderFlags, bool flushLayout,
|
|
|
|
nsIntSize renderSize);
|
2010-03-24 03:47:18 -07:00
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
Destroy();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: write protocol!
|
|
|
|
|
|
|
|
state LIVE:
|
|
|
|
send LoadURL goto LIVE;
|
|
|
|
//etc.
|
|
|
|
send Destroy goto DYING;
|
|
|
|
|
|
|
|
state DYING:
|
|
|
|
discard send blah;
|
|
|
|
// etc.
|
|
|
|
recv __delete__;
|
|
|
|
*/
|
2009-08-25 16:07:22 -07:00
|
|
|
};
|
|
|
|
|
2009-09-09 15:00:14 -07:00
|
|
|
}
|
|
|
|
}
|