Bumping manifests a=b2g-bump
[gecko.git] / dom / ipc / PContent.ipdl
blobf20d92d3988afd55659475e18a384b8273ddc48d
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 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 include protocol PAsmJSCacheEntry;
8 include protocol PBackground;
9 include protocol PBlob;
10 include protocol PBluetooth;
11 include protocol PBrowser;
12 include protocol PCompositor;
13 include protocol PContentBridge;
14 include protocol PCycleCollectWithLogs;
15 include protocol PCrashReporter;
16 include protocol PExternalHelperApp;
17 include protocol PDeviceStorageRequest;
18 include protocol PFileDescriptorSet;
19 include protocol PFMRadio;
20 include protocol PFileSystemRequest;
21 include protocol PHal;
22 include protocol PImageBridge;
23 include protocol PIndexedDB;
24 include protocol PMemoryReportRequest;
25 include protocol PNecko;
26 include protocol PScreenManager;
27 include protocol PSharedBufferManager;
28 include protocol PSms;
29 include protocol PSpeechSynthesis;
30 include protocol PStorage;
31 include protocol PTelephony;
32 include protocol PTestShell;
33 include protocol PJavaScript;
34 include protocol PRemoteSpellcheckEngine;
35 include DOMTypes;
36 include JavaScriptTypes;
37 include InputStreamParams;
38 include PTabContext;
39 include URIParams;
40 include ProtocolTypes;
42 using GeoPosition from "nsGeoPositionIPCSerialiser.h";
44 using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
45 using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h";
46 using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h";
47 using base::ChildPrivileges from "base/process_util.h";
48 using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
49 using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
50 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
51 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
52 using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h";
53 using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h";
54 using mozilla::dom::AudioChannel from "mozilla/dom/AudioChannelBinding.h";
55 using mozilla::dom::AudioChannelState from "AudioChannelCommon.h";
56 using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
57 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
58 using gfxIntSize from "nsSize.h";
60 union ChromeRegistryItem
62     ChromePackage;
63     OverrideMapping;
66 namespace mozilla {
67 namespace dom {
69 struct FontListEntry {
70     nsString  familyName;
71     nsString  faceName;
72     nsCString filepath;
73     uint16_t  weight;
74     int16_t   stretch;
75     uint8_t   italic;
76     uint8_t   index;
77     bool      isHidden;
80 struct DeviceStorageFreeSpaceParams
82   nsString type;
83   nsString storageName;
86 struct DeviceStorageUsedSpaceParams
88   nsString type;
89   nsString storageName;
92 struct DeviceStorageAvailableParams
94   nsString type;
95   nsString storageName;
98 struct DeviceStorageStatusParams
100   nsString type;
101   nsString storageName;
104 struct DeviceStorageFormatParams
106   nsString type;
107   nsString storageName;
110 struct DeviceStorageMountParams
112   nsString type;
113   nsString storageName;
116 struct DeviceStorageUnmountParams
118   nsString type;
119   nsString storageName;
122 struct DeviceStorageAddParams
124   nsString type;
125   nsString storageName;
126   nsString relpath;
127   PBlob blob;
130 struct DeviceStorageAppendParams
132   nsString type;
133   nsString storageName;
134   nsString relpath;
135   PBlob blob;
138 struct DeviceStorageCreateFdParams
140   nsString type;
141   nsString storageName;
142   nsString relpath;
145 struct DeviceStorageGetParams
147   nsString type;
148   nsString storageName;
149   nsString rootDir;
150   nsString relpath;
153 struct DeviceStorageDeleteParams
155   nsString type;
156   nsString storageName;
157   nsString relpath;
160 struct DeviceStorageEnumerationParams
162   nsString type;
163   nsString storageName;
164   nsString rootdir;
165   uint64_t since;
168 union DeviceStorageParams
170   DeviceStorageAddParams;
171   DeviceStorageAppendParams;
172   DeviceStorageCreateFdParams;
173   DeviceStorageGetParams;
174   DeviceStorageDeleteParams;
175   DeviceStorageEnumerationParams;
176   DeviceStorageFreeSpaceParams;
177   DeviceStorageUsedSpaceParams;
178   DeviceStorageAvailableParams;
179   DeviceStorageStatusParams;
180   DeviceStorageFormatParams;
181   DeviceStorageMountParams;
182   DeviceStorageUnmountParams;
185 struct FMRadioRequestEnableParams
187   double frequency;
190 struct FMRadioRequestDisableParams
195 struct FMRadioRequestSetFrequencyParams
197   double frequency;
200 struct FMRadioRequestSeekParams
202   bool upward;
205 struct FMRadioRequestCancelSeekParams
210 union FMRadioRequestParams
212   FMRadioRequestEnableParams;
213   FMRadioRequestDisableParams;
214   FMRadioRequestSetFrequencyParams;
215   FMRadioRequestSeekParams;
216   FMRadioRequestCancelSeekParams;
219 struct FileSystemCreateDirectoryParams
221   nsString filesystem;
222   nsString realPath;
225 union FileSystemFileDataValue
227   uint8_t[];
228   PBlob;
231 struct FileSystemCreateFileParams
233   nsString filesystem;
234   nsString realPath;
235   FileSystemFileDataValue data;
236   bool replace;
239 struct FileSystemGetFileOrDirectoryParams
241   nsString filesystem;
242   nsString realPath;
245 union FileSystemPathOrFileValue
247   nsString;
248   PBlob;
251 struct FileSystemRemoveParams
253   nsString filesystem;
254   nsString directory;
255   FileSystemPathOrFileValue target;
256   bool recursive;
259 union FileSystemParams
261   FileSystemCreateDirectoryParams;
262   FileSystemCreateFileParams;
263   FileSystemGetFileOrDirectoryParams;
264   FileSystemRemoveParams;
267 union PrefValue {
268   nsCString;
269   int32_t;
270   bool;
273 union MaybePrefValue {
274   PrefValue;
275   null_t;
278 struct PrefSetting {
279   nsCString name;
280   MaybePrefValue defaultValue;
281   MaybePrefValue userValue;
284 struct DataStoreSetting {
285   nsString name;
286   nsString originURL;
287   nsString manifestURL;
288   bool readOnly;
289   bool enabled;
292 // Note: Any changes to this structure should also be changed in
293 // FileSystemUpdate below.
294 struct VolumeInfo {
295   nsString name;
296   nsString mountPoint;
297   int32_t volState;
298   int32_t mountGeneration;
299   bool isMediaPresent;
300   bool isSharing;
301   bool isFormatting;
302   bool isFake;
303   bool isUnmounting;
306 intr protocol PContent
308     parent opens PCompositor;
309     parent opens PSharedBufferManager;
310     parent opens PImageBridge;
311     child opens PBackground;
313     manages PAsmJSCacheEntry;
314     manages PBlob;
315     manages PBluetooth;
316     manages PBrowser;
317     manages PCrashReporter;
318     manages PCycleCollectWithLogs;
319     manages PDeviceStorageRequest;
320     manages PFileSystemRequest;
321     manages PExternalHelperApp;
322     manages PFileDescriptorSet;
323     manages PFMRadio;
324     manages PHal;
325     manages PIndexedDB;
326     manages PMemoryReportRequest;
327     manages PNecko;
328     manages PScreenManager;
329     manages PSms;
330     manages PSpeechSynthesis;
331     manages PStorage;
332     manages PTelephony;
333     manages PTestShell;
334     manages PJavaScript;
335     manages PRemoteSpellcheckEngine;
337 both:
338     // Depending on exactly how the new browser is being created, it might be
339     // created from either the child or parent process!
340     //
341     // The child creates the PBrowser as part of
342     // TabChild::BrowserFrameProvideWindow (which happens when the child's
343     // content calls window.open()), and the parent creates the PBrowser as part
344     // of ContentParent::CreateBrowserOrApp.
345     //
346     // When the parent constructs a PBrowser, the child trusts the app token it
347     // receives from the parent.  In that case, context can be any of the
348     // IPCTabContext subtypes.
349     //
350     // When the child constructs a PBrowser, the parent doesn't trust the app
351     // token it receives from the child.  In this case, context must have type
352     // PopupIPCTabContext.  The browser created using a PopupIPCTabContext has
353     // the opener PBrowser's app-id and containing-app-id.  The parent checks
354     // that if the opener is a browser element, the context is also for a
355     // browser element.
356     //
357     // This allows the parent to prevent a malicious child from escalating its
358     // privileges by requesting a PBrowser corresponding to a highly-privileged
359     // app; the child can only request privileges for an app which the child has
360     // access to (in the form of a TabChild).
361     //
362     // Keep the last 3 attributes in sync with GetProcessAttributes!
363     async PBrowser(IPCTabContext context, uint32_t chromeFlags,
364                    uint64_t id, bool isForApp, bool isForBrowser);
366     async PBlob(BlobConstructorParams params);
368     PFileDescriptorSet(FileDescriptor fd);
370 child:
371     /**
372      * Enable system-level sandboxing features, if available.  Can
373      * usually only be performed zero or one times.  The child may
374      * abnormally exit if this fails; the details are OS-specific.
375      */
376     async SetProcessSandbox();
378     PMemoryReportRequest(uint32_t generation, bool anonymize,
379                          bool minimizeMemoryUsage, FileDescriptor DMDFile);
381     /**
382      * Notify the AudioChannelService in the child processes.
383      */
384     async AudioChannelNotify();
386     async SpeakerManagerNotify();
388     async DataStoreNotify(uint32_t aAppId, nsString aName,
389                           nsString aManifestURL);
391     /**
392      * Dump this process's GC and CC logs to the provided files.
393      *
394      * For documentation on the other args, see dumpGCAndCCLogsToFile in
395      * nsIMemoryInfoDumper.idl
396      */
397     PCycleCollectWithLogs(bool dumpAllTraces,
398                           FileDescriptor gcLog,
399                           FileDescriptor ccLog);
401     PTestShell();
403     RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
404                    OverrideMapping[] overrides, nsCString locale, bool reset);
405     RegisterChromeItem(ChromeRegistryItem item);
407     async SetOffline(bool offline);
409     async NotifyVisited(URIParams uri);
411     async SystemMemoryAvailable(uint64_t getterId, uint32_t memoryAvailable);
413     PreferenceUpdate(PrefSetting pref);
415     NotifyAlertsObserver(nsCString topic, nsString data);
417     GeolocationUpdate(GeoPosition somewhere);
419     // nsIPermissionManager messages
420     AddPermission(Permission permission);
422     ScreenSizeChanged(gfxIntSize size);
424     FlushMemory(nsString reason);
426     GarbageCollect();
427     CycleCollect();
428     
429     /**
430      * Start accessibility engine in content process.
431      */
432     ActivateA11y();
434     AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName);
436     // Notify child that last-pb-context-exited notification was observed
437     LastPrivateDocShellDestroyed();
439     FilePathUpdate(nsString storageType, nsString storageName, nsString filepath,
440                    nsCString reasons);
442     // Note: Any changes to this structure should also be changed in
443     // VolumeInfo above.
444     FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState,
445                      int32_t mountGeneration, bool isMediaPresent,
446                      bool isSharing, bool isFormatting, bool isFake, bool isUnmounting);
448     // Ask the Nuwa process to create a new child process.
449     NuwaFork();
451     NotifyProcessPriorityChanged(ProcessPriority priority);
452     MinimizeMemoryUsage();
454     /**
455      * Used to manage nsIStyleSheetService across processes.
456      */
457     async LoadAndRegisterSheet(URIParams uri, uint32_t type);
458     async UnregisterSheet(URIParams uri, uint32_t type);
460     NotifyPhoneStateChange(nsString newState);
462     /**
463      * Notify idle observers in the child
464      */
465     NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);
467     /**
468      * Notify windows in the child to apply a new app style.
469      */
470     OnAppThemeChanged();
472 parent:
473     /**
474      * Tell the content process some attributes of itself.  This is
475      * among the first information queried by content processes after
476      * startup.  (The message is sync to allow the content process to
477      * control when it receives the information.)
478      *
479      * |id| is a unique ID among all subprocesses.  When |isForApp &&
480      * isForBrowser|, we're loading <browser> for an app.  When
481      * |isForBrowser|, we're loading <browser>.  When |!isForApp &&
482      * !isForBrowser|, we're probably loading <xul:browser remote>.
483      *
484      * Keep the return values in sync with PBrowser()!
485      */
486     sync GetProcessAttributes()
487         returns (uint64_t id, bool isForApp, bool isForBrowser);
488     sync GetXPCOMProcessAttributes()
489         returns (bool isOffline);
491     sync CreateChildProcess(IPCTabContext context,
492                             ProcessPriority priority)
493         returns (uint64_t id, bool isForApp, bool isForBrowser);
494     intr BridgeToChildProcess(uint64_t id);
496     async PJavaScript();
498     sync PRemoteSpellcheckEngine();
499     PDeviceStorageRequest(DeviceStorageParams params);
501     PFileSystemRequest(FileSystemParams params);
503     sync PCrashReporter(NativeThreadId tid, uint32_t processType);
505     sync GetRandomValues(uint32_t length)
506         returns (uint8_t[] randomValues);
508     async GetSystemMemory(uint64_t getterId);
510     sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags)
511         returns (bool isSecureURI);
513     PHal();
515     PIndexedDB();
517     PNecko();
519     rpc PScreenManager()
520         returns (uint32_t numberOfScreens,
521                  float systemDefaultScale,
522                  bool success);
524     PSms();
526     PSpeechSynthesis();
528     PStorage();
530     PTelephony();
532     PBluetooth();
534     PFMRadio();
536     PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal);
538     // Services remoting
540     async StartVisitedQuery(URIParams uri);
541     async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags);
542     async SetURITitle(URIParams uri, nsString title);
544     async LoadURIExternal(URIParams uri);
546     // PrefService message
547     sync ReadPrefsArray() returns (PrefSetting[] prefs);
549     sync ReadFontList() returns (FontListEntry[] retValue);
551     sync SyncMessage(nsString aMessage, ClonedMessageData aData,
552                      CpowEntry[] aCpows, Principal aPrincipal)
553       returns (nsString[] retval);
555     rpc RpcMessage(nsString aMessage, ClonedMessageData aData,
556                    CpowEntry[] aCpows, Principal aPrincipal)
557       returns (nsString[] retval);
559     ShowAlertNotification(nsString imageUrl,
560                           nsString title,
561                           nsString text,
562                           bool textClickable,
563                           nsString cookie,
564                           nsString name,
565                           nsString bidi,
566                           nsString lang,
567                           nsString data,
568                           Principal principal);
570     CloseAlert(nsString name, Principal principal);
572     PExternalHelperApp(OptionalURIParams uri, 
573                        nsCString aMimeContentType,
574                        nsCString aContentDisposition, 
575                        uint32_t aContentDispositionHint, 
576                        nsString aContentDispositionFilename, 
577                        bool aForceSave,
578                        int64_t aContentLength,
579                        OptionalURIParams aReferrer,
580                        nullable PBrowser aBrowser);
582     AddGeolocationListener(Principal principal, bool highAccuracy);
583     RemoveGeolocationListener();
584     SetGeolocationHigherAccuracy(bool enable);
586     ConsoleMessage(nsString message);
587     ScriptError(nsString message, nsString sourceName, nsString sourceLine,
588                 uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
589                 nsCString category); 
591     // nsIPermissionManager messages
592     sync ReadPermissions() returns (Permission[] permissions);
594     SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard);
595     sync GetClipboardText(int32_t whichClipboard)
596         returns (nsString text);
597     EmptyClipboard(int32_t whichClipboard);
598     sync ClipboardHasText(int32_t whichClipboard)
599         returns (bool hasText);
601     sync GetSystemColors(uint32_t colorsCount)
602         returns (uint32_t[] colors);
604     sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
605         returns (uint8_t[] bits);
607     sync GetShowPasswordSetting()
608         returns (bool showPassword);
610     // Notify the parent of the presence or absence of private docshells
611     PrivateDocShellsExist(bool aExist);
613     // Tell the parent that the child has gone idle for the first time
614     async FirstIdle();
616     // Get Muted from the main AudioChannelService.
617     sync AudioChannelGetState(AudioChannel aChannel, bool aElementHidden,
618                               bool aElementWasHidden)
619         returns (AudioChannelState value);
621     sync AudioChannelRegisterType(AudioChannel aChannel, bool aWithVideo);
622     sync AudioChannelUnregisterType(AudioChannel aChannel,
623                                     bool aElementHidden,
624                                     bool aWithVideo);
626     async AudioChannelChangedNotification();
627     async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden);
629     sync DataStoreGetStores(nsString aName, nsString aOwner, Principal aPrincipal)
630         returns (DataStoreSetting[] dataStores);
632     async FilePathUpdateNotify(nsString aType,
633                                nsString aStorageName,
634                                nsString aFilepath,
635                                nsCString aReason);
637     sync GetVolumes() returns (VolumeInfo[] volumes);
639     // Notify the parent that the child has finished handling a system message.
640     async SystemMessageHandled();
642     NuwaReady();
644     sync AddNewProcess(uint32_t pid, ProtocolFdMapping[] aFds);
646     // called by the child (test code only) to propagate volume changes to the parent
647     async CreateFakeVolume(nsString fsName, nsString mountPoint);
648     async SetFakeVolumeState(nsString fsName, int32_t fsState);
650     sync KeywordToURI(nsCString keyword)
651         returns (OptionalInputStreamParams postData, OptionalURIParams uri);
653     // Tell the compositor to allocate a layer tree id for nested remote mozbrowsers.
654     sync AllocateLayerTreeId()
655         returns (uint64_t id);
656     async DeallocateLayerTreeId(uint64_t id);
658     sync SpeakerManagerForceSpeaker(bool aEnable);
660     sync SpeakerManagerGetSpeakerStatus()
661         returns (bool value);
663     /**
664      * Notifies the parent about a recording device is starting or shutdown.
665      * @param recordingStatus starting or shutdown
666      * @param pageURL URL that request that changing the recording status
667      * @param isAudio recording start with microphone
668      * @param isVideo recording start with camera
669      */
670     async RecordingDeviceEvents(nsString recordingStatus,
671                                 nsString pageURL,
672                                 bool isAudio,
673                                 bool isVideo);
675     sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess);
677     AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
678     RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
680     /**
681      * This message is only used on X11 platforms.
682      *
683      * Send a dup of the plugin process's X socket to the parent
684      * process.  In theory, this scheme keeps the plugin's X resources
685      * around until after both the plugin process shuts down *and* the
686      * parent process closes the dup fd.  This is used to prevent the
687      * parent process from crashing on X errors if, e.g., the plugin
688      * crashes *just before* a repaint and the parent process tries to
689      * use the newly-invalid surface.
690      */
691     BackUpXResources(FileDescriptor aXSocketFd);
693     sync OpenAnonymousTemporaryFile() returns (FileDescriptor aFD);
695 both:
696      AsyncMessage(nsString aMessage, ClonedMessageData aData,
697                   CpowEntry[] aCpows, Principal aPrincipal);