Back out the accidental part of 11094bb03918.
[mozilla-central.git] / dom / ipc / PBrowser.ipdl
bloba64823e644b0c1c7f5cceb246a1c3605102cb515
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 /* ***** BEGIN LICENSE BLOCK *****
5  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is Mozilla Content App.
18  *
19  * The Initial Developer of the Original Code is
20  *   The Mozilla Foundation.
21  * Portions created by the Initial Developer are Copyright (C) 2009
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Alternatively, the contents of this file may be used under the terms of
27  * either the GNU General Public License Version 2 or later (the "GPL"), or
28  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29  * in which case the provisions of the GPL or the LGPL are applicable instead
30  * of those above. If you wish to allow use of your version of this file only
31  * under the terms of either the GPL or the LGPL, and not to allow others to
32  * use your version of this file under the terms of the MPL, indicate your
33  * decision by deleting the provisions above and replace them with the notice
34  * and other provisions required by the GPL or the LGPL. If you do not delete
35  * the provisions above, a recipient may use your version of this file under
36  * the terms of any one of the MPL, the GPL or the LGPL.
37  *
38  * ***** END LICENSE BLOCK ***** */
40 include protocol PContent;
41 include protocol PContentDialog;
42 include protocol PDocumentRenderer;
43 include protocol PContentPermissionRequest;
44 include protocol PRenderFrame;
45 include protocol POfflineCacheUpdate;
47 include "TabMessageUtils.h";
48 include "gfxMatrix.h";
49 include "mozilla/net/NeckoMessageUtils.h";
50 include "IPC/nsGUIEventIPC.h";
52 using gfxMatrix;
53 using IPC::URI;
54 using nsCompositionEvent;
55 using nsIMEUpdatePreference;
56 using nsIntSize;
57 using nsQueryContentEvent;
58 using nsRect;
59 using nsSelectionEvent;
60 using nsTextEvent;
61 using RemoteDOMEvent;
63 namespace mozilla {
64 namespace dom {
66 rpc protocol PBrowser
68     manager PContent;
70     manages PContentDialog;
71     manages PDocumentRenderer;
72     manages PContentPermissionRequest;
73     manages PRenderFrame;
74     manages POfflineCacheUpdate;
76 both:
77     AsyncMessage(nsString aMessage, nsString aJSON);
79 parent:
80     /**
81      * When child sends this message, parent should move focus to
82      * the next or previous focusable element.
83      */
84     MoveFocus(bool forward);
86     Event(RemoteDOMEvent aEvent);
88     rpc CreateWindow() returns (PBrowser window);
90     sync SyncMessage(nsString aMessage, nsString aJSON)
91       returns (nsString[] retval);
93     /**
94      * The IME sequence number (seqno) parameter is used to make sure
95      * that a notification is discarded if it arrives at the chrome process
96      * too late. If the notification is late and we accept it, we will have
97      * an out-of-date view of the content process, which means events that we
98      * dispatch based on this out-of-date view will be wrong also.
99      * (see Bug 599550 and Bug 591047 comments 44, 50, and 54)
100      *
101      * Chrome increments seqno and includes it in each IME event sent to
102      * content, and content sends its current seqno back to chrome with each
103      * notification. A notification is up-to-date only if the content
104      * seqno is the same as the current chrome seqno, meaning no additional
105      * event was sent to content before the notification was received
106      *
107      * On blur, chrome returns the current seqno to content, and content
108      * uses it to discard subsequent events until the content seqno and
109      * chrome seqno-on-blur match again. These events, meant for the blurred
110      * textfield, are discarded to prevent events going to the wrong target
111      */
113     /**
114      * Notifies chrome that there is a focus change involving an editable
115      * object (input, textarea, document, contentEditable. etc.)
116      *
117      *  focus        PR_TRUE if editable object is receiving focus
118      *               PR_FALSE if losing focus
119      *  preference   Native widget preference for IME updates
120      *  seqno        Current seqno value on the chrome side
121      */
122     sync NotifyIMEFocus(PRBool focus)
123       returns (nsIMEUpdatePreference preference, PRUint32 seqno);
125     /**
126      * Notifies chrome that there has been a change in text content
127      * One call can encompass both a delete and an insert operation
128      * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
129      *
130      *  offset       Starting offset of the change
131      *  end          Ending offset of the range deleted
132      *  newEnd       New ending offset after insertion
133      *
134      *  for insertion, offset == end
135      *  for deletion, offset == newEnd
136      */
137     NotifyIMETextChange(PRUint32 offset, PRUint32 end, PRUint32 newEnd);
139     /**
140      * Notifies chrome that there has been a change in selection
141      * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
142      *
143      *  seqno        Current seqno value on the content side
144      *  anchor       Offset where the selection started
145      *  focus        Offset where the caret is
146      */
147     NotifyIMESelection(PRUint32 seqno, PRUint32 anchor, PRUint32 focus);
149     /**
150      * Notifies chrome to refresh its text cache 
151      * Only called when NotifyIMEFocus returns PR_TRUE for mWantHints
152      *
153      *  text         The entire content of the text field
154      */
155     NotifyIMETextHint(nsString text);
157     /**
158      * Instructs chrome to end any pending composition
159      *
160      *  cancel       PR_TRUE if composition should be cancelled
161      *  composition  Text to commit before ending the composition
162      *
163      *  if cancel is PR_TRUE,
164      *    widget should return empty string for composition
165      *  if cancel is PR_FALSE,
166      *    widget should return the current composition text
167      */
168     sync EndIMEComposition(PRBool cancel) returns (nsString composition);
170     sync GetIMEEnabled() returns (PRUint32 value);
172     SetInputMode(PRUint32 value, nsString type, nsString actionHint);
174     sync GetIMEOpenState() returns (PRBool value);
176     SetIMEOpenState(PRBool value);
178     /**
179      * Gets the DPI of the screen corresponding to this browser.
180      */
181     sync GetDPI() returns (float value);
183     PContentPermissionRequest(nsCString aType, URI uri);
185     PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
186                    PRInt32[] aIntParams, nsString[] aStringParams);
188     /**
189      * Create a layout frame (encapsulating a remote layer tree) for
190      * the page that is currently loaded in the <browser>.
191      */
192     async PRenderFrame();
194     /** 
195      * Starts an offline application cache update.
196      * @param manifestURI
197      *   URI of the manifest to fetch, the application cache group ID
198      * @param documentURI
199      *   URI of the document that referred the manifest
200      * @param clientID
201      *   The group cache version identifier to use
202      * @param stickDocument
203      *   True if the update was initiated by a document load that referred
204      *   a manifest.
205      *   False if the update was initiated by applicationCache.update() call.
206      *
207      *   Tells the update to carry the documentURI to a potential separate 
208      *   update of implicit (master) items.
209      *
210      *   Why this argument? If the document was not found in an offline cache 
211      *   before load and refers a manifest and this manifest itself has not 
212      *   been changed since the last fetch, we will not do the application 
213      *   cache group update. But we must cache the document (identified by the
214      *   documentURI). This argument will ensure that a previously uncached 
215      *   document will get cached and that we don't re-cache a document that 
216      *   has already been cached (stickDocument=false).
217      */
218     POfflineCacheUpdate(URI manifestURI, URI documentURI, nsCString clientID,
219                         bool stickDocument);
221     __delete__();
223 child:
224     /**
225      * Notify the remote browser that it has been Show()n on this
226      * side, with the given |visibleRect|.  This message is expected
227      * to trigger creation of the remote browser's "widget".
228      *
229      * |Show()| and |Move()| take IntSizes rather than Rects because
230      * content processes always render to a virtual <0, 0> top-left
231      * point.
232      */
233     Show(nsIntSize size);
235     LoadURL(nsCString uri);
237     Move(nsIntSize size);
239     /**
240      * Sending an activate message moves focus to the child.
241      */
242     Activate();
244     /**
245      * @see nsIDOMWindowUtils sendMouseEvent.
246      */
247     MouseEvent(nsString aType,
248                float aX,
249                float aY,
250                PRInt32 aButton,
251                PRInt32 aClickCount,
252                PRInt32 aModifiers,
253                bool aIgnoreRootScrollFrame);
255     /**
256      * @see nsIDOMWindowUtils sendKeyEvent.
257      */
258     KeyEvent(nsString aType,
259              PRInt32 aKeyCode,
260              PRInt32 aCharCode,
261              PRInt32 aModifiers,
262              bool aPreventDefault);
264     CompositionEvent(nsCompositionEvent event);
266     TextEvent(nsTextEvent event);
268     SelectionEvent(nsSelectionEvent event);
270     /**
271      * Activate event forwarding from client to parent.
272      */
273     ActivateFrameEvent(nsString aType, bool capture);
275     LoadRemoteScript(nsString aURL);
277     /**
278      * Create a asynchronous request to render whatever document is
279      * loaded in the child when this message arrives.  When the
280      * request finishes, PDocumentRenderer:__delete__ is sent back to
281      * this side to notify completion.
282      *
283      * |documentRect| is the area of the remote document to draw,
284      * transformed by |transform|.  The rendered area will have the
285      * default background color |bgcolor|.  |renderFlags| are the
286      * nsIPresShell::RenderDocument() flags to use on the remote side,
287      * and if true, |flushLayout| will do just that before rendering
288      * the document.  The rendered image will be of size |renderSize|.
289      */
290     PDocumentRenderer(nsRect documentRect, gfxMatrix transform,
291                       nsString bgcolor,
292                       PRUint32 renderFlags, bool flushLayout,
293                       nsIntSize renderSize);
295     /**
296      * Sent by the chrome process when it no longer wants this remote
297      * <browser>.  The child side cleans up in response, then
298      * finalizing its death by sending back __delete__() to the
299      * parent.
300      */
301     Destroy();
304  * FIXME: write protocol!
306 state LIVE:
307     send LoadURL goto LIVE;
308 //etc.
309     send Destroy goto DYING;
311 state DYING:
312     discard send blah;
313 // etc.
314     recv __delete__;
315  */