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: /* 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 PAsmJSCacheEntry; michael@0: include protocol PBackground; michael@0: include protocol PBlob; michael@0: include protocol PBluetooth; michael@0: include protocol PBrowser; michael@0: include protocol PCompositor; michael@0: include protocol PCrashReporter; michael@0: include protocol PExternalHelperApp; michael@0: include protocol PDeviceStorageRequest; michael@0: include protocol PFileDescriptorSet; michael@0: include protocol PFMRadio; michael@0: include protocol PFileSystemRequest; michael@0: include protocol PHal; michael@0: include protocol PImageBridge; michael@0: include protocol PIndexedDB; michael@0: include protocol PMemoryReportRequest; michael@0: include protocol PNecko; michael@0: include protocol PSms; michael@0: include protocol PSpeechSynthesis; michael@0: include protocol PStorage; michael@0: include protocol PTelephony; michael@0: include protocol PTestShell; michael@0: include protocol PJavaScript; michael@0: include DOMTypes; michael@0: include JavaScriptTypes; michael@0: include InputStreamParams; michael@0: include PTabContext; michael@0: include URIParams; michael@0: include ProtocolTypes; michael@0: michael@0: using GeoPosition from "nsGeoPositionIPCSerialiser.h"; michael@0: michael@0: using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h"; michael@0: using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h"; michael@0: using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h"; michael@0: using base::ChildPrivileges from "base/process_util.h"; michael@0: using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h"; michael@0: using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; michael@0: using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; michael@0: using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; michael@0: using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h"; michael@0: using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h"; michael@0: using mozilla::dom::AudioChannel from "mozilla/dom/AudioChannelBinding.h"; michael@0: using mozilla::dom::AudioChannelState from "AudioChannelCommon.h"; michael@0: using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; michael@0: using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; michael@0: using gfxIntSize from "nsSize.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: struct FontListEntry { michael@0: nsString familyName; michael@0: nsString faceName; michael@0: nsCString filepath; michael@0: uint16_t weight; michael@0: int16_t stretch; michael@0: uint8_t italic; michael@0: uint8_t index; michael@0: }; michael@0: michael@0: struct DeviceStorageFreeSpaceParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageUsedSpaceParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageAvailableParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageStatusParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageFormatParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageMountParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageUnmountParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: }; michael@0: michael@0: struct DeviceStorageAddParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: nsString relpath; michael@0: PBlob blob; michael@0: }; michael@0: michael@0: struct DeviceStorageCreateFdParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: nsString relpath; michael@0: }; michael@0: michael@0: struct DeviceStorageGetParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: nsString rootDir; michael@0: nsString relpath; michael@0: }; michael@0: michael@0: struct DeviceStorageDeleteParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: nsString relpath; michael@0: }; michael@0: michael@0: struct DeviceStorageEnumerationParams michael@0: { michael@0: nsString type; michael@0: nsString storageName; michael@0: nsString rootdir; michael@0: uint64_t since; michael@0: }; michael@0: michael@0: union DeviceStorageParams michael@0: { michael@0: DeviceStorageAddParams; michael@0: DeviceStorageCreateFdParams; michael@0: DeviceStorageGetParams; michael@0: DeviceStorageDeleteParams; michael@0: DeviceStorageEnumerationParams; michael@0: DeviceStorageFreeSpaceParams; michael@0: DeviceStorageUsedSpaceParams; michael@0: DeviceStorageAvailableParams; michael@0: DeviceStorageStatusParams; michael@0: DeviceStorageFormatParams; michael@0: DeviceStorageMountParams; michael@0: DeviceStorageUnmountParams; michael@0: }; michael@0: michael@0: struct FMRadioRequestEnableParams michael@0: { michael@0: double frequency; michael@0: }; michael@0: michael@0: struct FMRadioRequestDisableParams michael@0: { michael@0: michael@0: }; michael@0: michael@0: struct FMRadioRequestSetFrequencyParams michael@0: { michael@0: double frequency; michael@0: }; michael@0: michael@0: struct FMRadioRequestSeekParams michael@0: { michael@0: bool upward; michael@0: }; michael@0: michael@0: struct FMRadioRequestCancelSeekParams michael@0: { michael@0: michael@0: }; michael@0: michael@0: union FMRadioRequestParams michael@0: { michael@0: FMRadioRequestEnableParams; michael@0: FMRadioRequestDisableParams; michael@0: FMRadioRequestSetFrequencyParams; michael@0: FMRadioRequestSeekParams; michael@0: FMRadioRequestCancelSeekParams; michael@0: }; michael@0: michael@0: struct FileSystemCreateDirectoryParams michael@0: { michael@0: nsString filesystem; michael@0: nsString realPath; michael@0: }; michael@0: michael@0: union FileSystemFileDataValue michael@0: { michael@0: uint8_t[]; michael@0: PBlob; michael@0: }; michael@0: michael@0: struct FileSystemCreateFileParams michael@0: { michael@0: nsString filesystem; michael@0: nsString realPath; michael@0: FileSystemFileDataValue data; michael@0: bool replace; michael@0: }; michael@0: michael@0: struct FileSystemGetFileOrDirectoryParams michael@0: { michael@0: nsString filesystem; michael@0: nsString realPath; michael@0: }; michael@0: michael@0: union FileSystemPathOrFileValue michael@0: { michael@0: nsString; michael@0: PBlob; michael@0: }; michael@0: michael@0: struct FileSystemRemoveParams michael@0: { michael@0: nsString filesystem; michael@0: nsString directory; michael@0: FileSystemPathOrFileValue target; michael@0: bool recursive; michael@0: }; michael@0: michael@0: union FileSystemParams michael@0: { michael@0: FileSystemCreateDirectoryParams; michael@0: FileSystemCreateFileParams; michael@0: FileSystemGetFileOrDirectoryParams; michael@0: FileSystemRemoveParams; michael@0: }; michael@0: michael@0: union PrefValue { michael@0: nsCString; michael@0: int32_t; michael@0: bool; michael@0: }; michael@0: michael@0: union MaybePrefValue { michael@0: PrefValue; michael@0: null_t; michael@0: }; michael@0: michael@0: struct PrefSetting { michael@0: nsCString name; michael@0: MaybePrefValue defaultValue; michael@0: MaybePrefValue userValue; michael@0: }; michael@0: michael@0: intr protocol PContent michael@0: { michael@0: parent opens PCompositor; michael@0: parent opens PImageBridge; michael@0: child opens PBackground; michael@0: michael@0: manages PAsmJSCacheEntry; michael@0: manages PBlob; michael@0: manages PBluetooth; michael@0: manages PBrowser; michael@0: manages PCrashReporter; michael@0: manages PDeviceStorageRequest; michael@0: manages PFileSystemRequest; michael@0: manages PExternalHelperApp; michael@0: manages PFileDescriptorSet; michael@0: manages PFMRadio; michael@0: manages PHal; michael@0: manages PIndexedDB; michael@0: manages PMemoryReportRequest; michael@0: manages PNecko; michael@0: manages PSms; michael@0: manages PSpeechSynthesis; michael@0: manages PStorage; michael@0: manages PTelephony; michael@0: manages PTestShell; michael@0: manages PJavaScript; michael@0: michael@0: both: michael@0: // Depending on exactly how the new browser is being created, it might be michael@0: // created from either the child or parent process! michael@0: // michael@0: // The child creates the PBrowser as part of michael@0: // TabChild::BrowserFrameProvideWindow (which happens when the child's michael@0: // content calls window.open()), and the parent creates the PBrowser as part michael@0: // of ContentParent::CreateBrowserOrApp. michael@0: // michael@0: // When the parent constructs a PBrowser, the child trusts the app token it michael@0: // receives from the parent. In that case, context can be any of the michael@0: // IPCTabContext subtypes. michael@0: // michael@0: // When the child constructs a PBrowser, the parent doesn't trust the app michael@0: // token it receives from the child. In this case, context must have type michael@0: // PopupIPCTabContext. The browser created using a PopupIPCTabContext has michael@0: // the opener PBrowser's app-id and containing-app-id. The parent checks michael@0: // that if the opener is a browser element, the context is also for a michael@0: // browser element. michael@0: // michael@0: // This allows the parent to prevent a malicious child from escalating its michael@0: // privileges by requesting a PBrowser corresponding to a highly-privileged michael@0: // app; the child can only request privileges for an app which the child has michael@0: // access to (in the form of a TabChild). michael@0: async PBrowser(IPCTabContext context, uint32_t chromeFlags); michael@0: michael@0: async PBlob(BlobConstructorParams params); michael@0: michael@0: async PJavaScript(); michael@0: michael@0: PFileDescriptorSet(FileDescriptor fd); michael@0: michael@0: child: michael@0: /** michael@0: * Enable system-level sandboxing features, if available. Can michael@0: * usually only be performed zero or one times. The child may michael@0: * abnormally exit if this fails; the details are OS-specific. michael@0: */ michael@0: async SetProcessSandbox(); michael@0: michael@0: PMemoryReportRequest(uint32_t generation, bool minimizeMemoryUsage, nsString DMDDumpIdent); michael@0: michael@0: /** michael@0: * Notify the AudioChannelService in the child processes. michael@0: */ michael@0: async AudioChannelNotify(); michael@0: michael@0: async SpeakerManagerNotify(); michael@0: michael@0: /** michael@0: * Dump this process's GC and CC logs. michael@0: * michael@0: * For documentation on the args, see dumpGCAndCCLogsToFile in michael@0: * nsIMemoryInfoDumper.idl michael@0: */ michael@0: async DumpGCAndCCLogsToFile(nsString identifier, michael@0: bool dumpAllTraces, michael@0: bool dumpChildProcesses); michael@0: michael@0: PTestShell(); michael@0: michael@0: RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources, michael@0: OverrideMapping[] overrides, nsCString locale); michael@0: michael@0: async SetOffline(bool offline); michael@0: michael@0: async NotifyVisited(URIParams uri); michael@0: michael@0: PreferenceUpdate(PrefSetting pref); michael@0: michael@0: NotifyAlertsObserver(nsCString topic, nsString data); michael@0: michael@0: GeolocationUpdate(GeoPosition somewhere); michael@0: michael@0: // nsIPermissionManager messages michael@0: AddPermission(Permission permission); michael@0: michael@0: ScreenSizeChanged(gfxIntSize size); michael@0: michael@0: FlushMemory(nsString reason); michael@0: michael@0: GarbageCollect(); michael@0: CycleCollect(); michael@0: michael@0: /** michael@0: * Start accessibility engine in content process. michael@0: */ michael@0: ActivateA11y(); michael@0: michael@0: AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName); michael@0: michael@0: // Notify child that last-pb-context-exited notification was observed michael@0: LastPrivateDocShellDestroyed(); michael@0: michael@0: FilePathUpdate(nsString storageType, nsString storageName, nsString filepath, michael@0: nsCString reasons); michael@0: michael@0: FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState, michael@0: int32_t mountGeneration, bool isMediaPresent, michael@0: bool isSharing, bool isFormatting); michael@0: michael@0: // Ask the Nuwa process to create a new child process. michael@0: NuwaFork(); michael@0: michael@0: NotifyProcessPriorityChanged(ProcessPriority priority); michael@0: MinimizeMemoryUsage(); michael@0: michael@0: /** michael@0: * Used to manage nsIStyleSheetService across processes. michael@0: */ michael@0: async LoadAndRegisterSheet(URIParams uri, uint32_t type); michael@0: async UnregisterSheet(URIParams uri, uint32_t type); michael@0: michael@0: NotifyPhoneStateChange(nsString newState); michael@0: michael@0: /** michael@0: * Notify idle observers in the child michael@0: */ michael@0: NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str); michael@0: parent: michael@0: /** michael@0: * Tell the content process some attributes of itself. This is michael@0: * among the first information queried by content processes after michael@0: * startup. (The message is sync to allow the content process to michael@0: * control when it receives the information.) michael@0: * michael@0: * |id| is a unique ID among all subprocesses. When |isForApp && michael@0: * isForBrowser|, we're loading for an app. When michael@0: * |isForBrowser|, we're loading . When |!isForApp && michael@0: * !isForBrowser|, we're probably loading . michael@0: */ michael@0: sync GetProcessAttributes() michael@0: returns (uint64_t id, bool isForApp, bool isForBrowser); michael@0: sync GetXPCOMProcessAttributes() michael@0: returns (bool isOffline); michael@0: michael@0: PDeviceStorageRequest(DeviceStorageParams params); michael@0: michael@0: PFileSystemRequest(FileSystemParams params); michael@0: michael@0: sync PCrashReporter(NativeThreadId tid, uint32_t processType); michael@0: michael@0: sync GetRandomValues(uint32_t length) michael@0: returns (uint8_t[] randomValues); michael@0: michael@0: PHal(); michael@0: michael@0: PIndexedDB(); michael@0: michael@0: PNecko(); michael@0: michael@0: PSms(); michael@0: michael@0: PSpeechSynthesis(); michael@0: michael@0: PStorage(); michael@0: michael@0: PTelephony(); michael@0: michael@0: PBluetooth(); michael@0: michael@0: PFMRadio(); michael@0: michael@0: PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal); michael@0: michael@0: // Services remoting michael@0: michael@0: async StartVisitedQuery(URIParams uri); michael@0: async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags); michael@0: async SetURITitle(URIParams uri, nsString title); michael@0: michael@0: async LoadURIExternal(URIParams uri); michael@0: michael@0: // PrefService message michael@0: sync ReadPrefsArray() returns (PrefSetting[] prefs); michael@0: michael@0: sync ReadFontList() returns (FontListEntry[] retValue); 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: ShowAlertNotification(nsString imageUrl, michael@0: nsString title, michael@0: nsString text, michael@0: bool textClickable, michael@0: nsString cookie, michael@0: nsString name, michael@0: nsString bidi, michael@0: nsString lang, michael@0: Principal principal); michael@0: michael@0: CloseAlert(nsString name, Principal principal); michael@0: michael@0: PExternalHelperApp(OptionalURIParams uri, michael@0: nsCString aMimeContentType, michael@0: nsCString aContentDisposition, michael@0: uint32_t aContentDispositionHint, michael@0: nsString aContentDispositionFilename, michael@0: bool aForceSave, michael@0: int64_t aContentLength, michael@0: OptionalURIParams aReferrer, michael@0: nullable PBrowser aBrowser); michael@0: michael@0: AddGeolocationListener(Principal principal, bool highAccuracy); michael@0: RemoveGeolocationListener(); michael@0: SetGeolocationHigherAccuracy(bool enable); michael@0: michael@0: ConsoleMessage(nsString message); michael@0: ScriptError(nsString message, nsString sourceName, nsString sourceLine, michael@0: uint32_t lineNumber, uint32_t colNumber, uint32_t flags, michael@0: nsCString category); michael@0: michael@0: // nsIPermissionManager messages michael@0: sync ReadPermissions() returns (Permission[] permissions); michael@0: michael@0: SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard); michael@0: sync GetClipboardText(int32_t whichClipboard) michael@0: returns (nsString text); michael@0: EmptyClipboard(int32_t whichClipboard); michael@0: sync ClipboardHasText(int32_t whichClipboard) michael@0: returns (bool hasText); michael@0: michael@0: sync GetSystemColors(uint32_t colorsCount) michael@0: returns (uint32_t[] colors); michael@0: michael@0: sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize) michael@0: returns (uint8_t[] bits); michael@0: michael@0: sync GetShowPasswordSetting() michael@0: returns (bool showPassword); michael@0: michael@0: // Notify the parent of the presence or absence of private docshells michael@0: PrivateDocShellsExist(bool aExist); michael@0: michael@0: // Tell the parent that the child has gone idle for the first time michael@0: async FirstIdle(); michael@0: michael@0: // Get Muted from the main AudioChannelService. michael@0: sync AudioChannelGetState(AudioChannel aChannel, bool aElementHidden, michael@0: bool aElementWasHidden) michael@0: returns (AudioChannelState value); michael@0: michael@0: sync AudioChannelRegisterType(AudioChannel aChannel, bool aWithVideo); michael@0: sync AudioChannelUnregisterType(AudioChannel aChannel, michael@0: bool aElementHidden, michael@0: bool aWithVideo); michael@0: michael@0: async AudioChannelChangedNotification(); michael@0: async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden); michael@0: michael@0: async FilePathUpdateNotify(nsString aType, michael@0: nsString aStorageName, michael@0: nsString aFilepath, michael@0: nsCString aReason); michael@0: // get nsIVolumeService to broadcast volume information michael@0: async BroadcastVolume(nsString volumeName); michael@0: michael@0: // Notify the parent that the child has finished handling a system message. michael@0: async SystemMessageHandled(); michael@0: michael@0: NuwaReady(); michael@0: michael@0: sync AddNewProcess(uint32_t pid, ProtocolFdMapping[] aFds); michael@0: michael@0: // called by the child (test code only) to propagate volume changes to the parent michael@0: async CreateFakeVolume(nsString fsName, nsString mountPoint); michael@0: async SetFakeVolumeState(nsString fsName, int32_t fsState); michael@0: michael@0: sync KeywordToURI(nsCString keyword) michael@0: returns (OptionalInputStreamParams postData, OptionalURIParams uri); michael@0: michael@0: sync SpeakerManagerForceSpeaker(bool aEnable); michael@0: michael@0: sync SpeakerManagerGetSpeakerStatus() michael@0: returns (bool value); michael@0: michael@0: /** michael@0: * Notifies the parent about a recording device is starting or shutdown. michael@0: * @param recordingStatus starting or shutdown michael@0: * @param pageURL URL that request that changing the recording status michael@0: * @param isAudio recording start with microphone michael@0: * @param isVideo recording start with camera michael@0: */ michael@0: async RecordingDeviceEvents(nsString recordingStatus, michael@0: nsString pageURL, michael@0: bool isAudio, michael@0: bool isVideo); michael@0: michael@0: sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess); michael@0: michael@0: AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS); michael@0: RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS); michael@0: michael@0: /** michael@0: * This message is only used on X11 platforms. michael@0: * michael@0: * Send a dup of the plugin process's X socket to the parent michael@0: * process. In theory, this scheme keeps the plugin's X resources michael@0: * around until after both the plugin process shuts down *and* the michael@0: * parent process closes the dup fd. This is used to prevent the michael@0: * parent process from crashing on X errors if, e.g., the plugin michael@0: * crashes *just before* a repaint and the parent process tries to michael@0: * use the newly-invalid surface. michael@0: */ michael@0: BackUpXResources(FileDescriptor aXSocketFd); michael@0: michael@0: both: michael@0: AsyncMessage(nsString aMessage, ClonedMessageData aData, michael@0: CpowEntry[] aCpows, Principal aPrincipal); michael@0: }; michael@0: michael@0: } michael@0: }