2009-08-18 12:05:15 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
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-12 09:18:08 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
#ifndef mozilla_dom_ContentChild_h
|
|
|
|
#define mozilla_dom_ContentChild_h
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2011-12-17 13:45:29 -08:00
|
|
|
#include "mozilla/Attributes.h"
|
2010-07-19 11:33:33 -07:00
|
|
|
#include "mozilla/dom/PContentChild.h"
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-09 16:37:39 -08:00
|
|
|
#include "mozilla/dom/TabContext.h"
|
2012-08-01 23:02:29 -07:00
|
|
|
#include "mozilla/dom/ipc/Blob.h"
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2009-08-25 16:07:22 -07:00
|
|
|
#include "nsTArray.h"
|
2010-09-23 18:39:32 -07:00
|
|
|
#include "nsIConsoleListener.h"
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2010-03-10 21:33:00 -08:00
|
|
|
struct ChromePackage;
|
2012-08-01 23:02:29 -07:00
|
|
|
class nsIDOMBlob;
|
2010-07-21 11:42:32 -07:00
|
|
|
class nsIObserver;
|
2010-03-10 21:33:00 -08:00
|
|
|
struct ResourceMapping;
|
|
|
|
struct OverrideMapping;
|
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace mozilla {
|
2012-07-17 16:59:45 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
namespace ipc {
|
|
|
|
class OptionalURIParams;
|
|
|
|
class URIParams;
|
|
|
|
}// namespace ipc
|
|
|
|
|
2012-07-17 16:59:45 -07:00
|
|
|
namespace layers {
|
|
|
|
class PCompositorChild;
|
2012-08-23 12:33:46 -07:00
|
|
|
} // namespace layers
|
2012-07-17 16:59:45 -07:00
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace dom {
|
|
|
|
|
2010-09-15 09:44:57 -07:00
|
|
|
class AlertObserver;
|
2010-07-21 11:42:32 -07:00
|
|
|
class PrefObserver;
|
2010-09-23 18:39:32 -07:00
|
|
|
class ConsoleListener;
|
2010-11-18 17:15:23 -08:00
|
|
|
class PStorageChild;
|
2012-08-01 23:02:29 -07:00
|
|
|
class ClonedMessageData;
|
2010-07-21 11:42:32 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
class ContentChild : public PContentChild
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-09 16:37:39 -08:00
|
|
|
, public TabContext
|
2009-08-12 09:18:08 -07:00
|
|
|
{
|
2012-08-01 23:02:29 -07:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2012-08-23 12:33:46 -07:00
|
|
|
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
|
|
|
|
typedef mozilla::ipc::URIParams URIParams;
|
2012-07-17 16:59:45 -07:00
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
public:
|
2010-07-19 11:33:33 -07:00
|
|
|
ContentChild();
|
|
|
|
virtual ~ContentChild();
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2011-10-04 13:31:00 -07:00
|
|
|
struct AppInfo
|
|
|
|
{
|
|
|
|
nsCString version;
|
|
|
|
nsCString buildID;
|
|
|
|
};
|
|
|
|
|
2009-10-27 14:52:37 -07:00
|
|
|
bool Init(MessageLoop* aIOLoop,
|
|
|
|
base::ProcessHandle aParentHandle,
|
|
|
|
IPC::Channel* aChannel);
|
2010-09-23 18:39:32 -07:00
|
|
|
void InitXPCOM();
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
static ContentChild* GetSingleton() {
|
2009-08-12 17:32:50 -07:00
|
|
|
return sSingleton;
|
|
|
|
}
|
|
|
|
|
2011-10-04 13:31:00 -07:00
|
|
|
const AppInfo& GetAppInfo() {
|
|
|
|
return mAppInfo;
|
|
|
|
}
|
|
|
|
|
2012-10-05 14:54:54 -07:00
|
|
|
void SetProcessName(const nsAString& aName);
|
|
|
|
const void GetProcessName(nsAString& aName);
|
|
|
|
|
2012-08-29 05:24:48 -07:00
|
|
|
PCompositorChild*
|
|
|
|
AllocPCompositor(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
|
|
|
PImageBridgeChild*
|
|
|
|
AllocPImageBridge(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
2010-03-24 03:47:18 -07:00
|
|
|
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-09 16:37:39 -08:00
|
|
|
virtual PBrowserChild* AllocPBrowser(const IPCTabContext &aContext,
|
|
|
|
const uint32_t &chromeFlags);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool DeallocPBrowser(PBrowserChild*);
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2012-06-19 16:14:39 -07:00
|
|
|
virtual PDeviceStorageRequestChild* AllocPDeviceStorageRequest(const DeviceStorageParams&);
|
|
|
|
virtual bool DeallocPDeviceStorageRequest(PDeviceStorageRequestChild*);
|
|
|
|
|
2012-08-01 23:02:29 -07:00
|
|
|
virtual PBlobChild* AllocPBlob(const BlobConstructorParams& aParams);
|
|
|
|
virtual bool DeallocPBlob(PBlobChild*);
|
|
|
|
|
2011-06-08 12:56:31 -07:00
|
|
|
virtual PCrashReporterChild*
|
|
|
|
AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t& processType);
|
2011-06-08 12:56:31 -07:00
|
|
|
virtual bool
|
|
|
|
DeallocPCrashReporter(PCrashReporterChild*);
|
2010-11-24 06:15:03 -08:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual PHalChild* AllocPHal() MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPHal(PHalChild*) MOZ_OVERRIDE;
|
2011-10-05 15:15:45 -07:00
|
|
|
|
2012-07-14 04:24:20 -07:00
|
|
|
virtual PIndexedDBChild* AllocPIndexedDB();
|
|
|
|
virtual bool DeallocPIndexedDB(PIndexedDBChild* aActor);
|
|
|
|
|
2011-02-16 10:43:23 -08:00
|
|
|
virtual PMemoryReportRequestChild*
|
|
|
|
AllocPMemoryReportRequest();
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPMemoryReportRequest(PMemoryReportRequestChild* actor);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* child);
|
|
|
|
|
2012-10-02 18:19:11 -07:00
|
|
|
virtual bool
|
2012-10-15 19:12:14 -07:00
|
|
|
RecvDumpMemoryReportsToFile(const nsString& aIdentifier,
|
2012-10-02 18:19:11 -07:00
|
|
|
const bool& aMinimizeMemoryUsage,
|
|
|
|
const bool& aDumpChildProcesses);
|
2012-10-15 19:12:14 -07:00
|
|
|
virtual bool
|
|
|
|
RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
|
|
|
|
const bool& aDumpChildProcesses);
|
2012-10-02 18:19:11 -07:00
|
|
|
|
2009-09-22 10:31:11 -07:00
|
|
|
virtual PTestShellChild* AllocPTestShell();
|
|
|
|
virtual bool DeallocPTestShell(PTestShellChild*);
|
2009-11-06 12:43:39 -08:00
|
|
|
virtual bool RecvPTestShellConstructor(PTestShellChild*);
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual PAudioChild* AllocPAudio(const int32_t&,
|
|
|
|
const int32_t&);
|
2010-11-16 20:14:19 -08:00
|
|
|
virtual bool DeallocPAudio(PAudioChild*);
|
|
|
|
|
2009-09-22 10:31:11 -07:00
|
|
|
virtual PNeckoChild* AllocPNecko();
|
|
|
|
virtual bool DeallocPNecko(PNeckoChild*);
|
2009-08-18 12:05:15 -07:00
|
|
|
|
2010-09-15 15:55:08 -07:00
|
|
|
virtual PExternalHelperAppChild *AllocPExternalHelperApp(
|
2012-08-23 12:33:46 -07:00
|
|
|
const OptionalURIParams& uri,
|
2010-09-15 15:55:08 -07:00
|
|
|
const nsCString& aMimeContentType,
|
|
|
|
const nsCString& aContentDisposition,
|
|
|
|
const bool& aForceSave,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int64_t& aContentLength,
|
2012-08-23 12:33:46 -07:00
|
|
|
const OptionalURIParams& aReferrer);
|
2010-09-15 15:55:08 -07:00
|
|
|
virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
|
|
|
|
|
2011-11-20 14:40:53 -08:00
|
|
|
virtual PSmsChild* AllocPSms();
|
|
|
|
virtual bool DeallocPSms(PSmsChild*);
|
|
|
|
|
2010-11-18 17:15:23 -08:00
|
|
|
virtual PStorageChild* AllocPStorage(const StorageConstructData& aData);
|
|
|
|
virtual bool DeallocPStorage(PStorageChild* aActor);
|
|
|
|
|
2012-09-13 09:37:14 -07:00
|
|
|
virtual PBluetoothChild* AllocPBluetooth();
|
|
|
|
virtual bool DeallocPBluetooth(PBluetoothChild* aActor);
|
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
|
|
|
|
const InfallibleTArray<ResourceMapping>& resources,
|
2011-01-11 13:34:31 -08:00
|
|
|
const InfallibleTArray<OverrideMapping>& overrides,
|
|
|
|
const nsCString& locale);
|
2010-03-10 21:33:00 -08:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool RecvSetOffline(const bool& offline);
|
2010-05-11 05:44:12 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
virtual bool RecvNotifyVisited(const URIParams& aURI);
|
2010-09-15 09:44:57 -07:00
|
|
|
// auto remove when alertfinished is received.
|
|
|
|
nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
|
|
|
|
|
2012-08-22 13:00:21 -07:00
|
|
|
virtual bool RecvPreferenceUpdate(const PrefSetting& aPref);
|
2010-10-19 13:35:08 -07:00
|
|
|
|
2010-09-15 09:44:57 -07:00
|
|
|
virtual bool RecvNotifyAlertsObserver(const nsCString& aType, const nsString& aData);
|
|
|
|
|
2012-08-01 23:02:29 -07:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData);
|
2010-05-25 17:13:47 -07:00
|
|
|
|
2010-09-20 21:16:37 -07:00
|
|
|
virtual bool RecvGeolocationUpdate(const GeoPosition& somewhere);
|
|
|
|
|
2010-10-09 11:07:38 -07:00
|
|
|
virtual bool RecvAddPermission(const IPC::Permission& permission);
|
|
|
|
|
2010-11-24 10:22:40 -08:00
|
|
|
virtual bool RecvScreenSizeChanged(const gfxIntSize &size);
|
2010-12-11 14:36:08 -08:00
|
|
|
|
|
|
|
virtual bool RecvFlushMemory(const nsString& reason);
|
|
|
|
|
2011-07-20 21:37:32 -07:00
|
|
|
virtual bool RecvActivateA11y();
|
|
|
|
|
2011-09-13 10:53:51 -07:00
|
|
|
virtual bool RecvGarbageCollect();
|
|
|
|
virtual bool RecvCycleCollect();
|
|
|
|
|
2011-10-04 13:31:00 -07:00
|
|
|
virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID);
|
|
|
|
|
2012-04-19 17:13:20 -07:00
|
|
|
virtual bool RecvLastPrivateDocShellDestroyed();
|
|
|
|
|
2012-08-30 15:17:37 -07:00
|
|
|
virtual bool RecvFilePathUpdate(const nsString& type, const nsString& path, const nsCString& reason);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool RecvFileSystemUpdate(const nsString& aFsName, const nsString& aName, const int32_t& aState);
|
2012-08-01 23:32:04 -07:00
|
|
|
|
2010-11-24 10:22:40 -08:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize GetScreenSize() { return mScreenSize; }
|
|
|
|
#endif
|
|
|
|
|
2011-04-29 16:46:20 -07:00
|
|
|
// Get the directory for IndexedDB files. We query the parent for this and
|
|
|
|
// cache the value
|
|
|
|
nsString &GetIndexedDBPath();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t GetID() { return mID; }
|
2011-09-30 00:00:48 -07:00
|
|
|
|
2012-08-01 23:02:29 -07:00
|
|
|
BlobChild* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
|
|
|
|
|
2009-12-06 22:03:49 -08:00
|
|
|
private:
|
2012-07-17 16:59:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2009-12-06 22:03:49 -08:00
|
|
|
|
2012-07-17 16:59:45 -07:00
|
|
|
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
|
2010-08-20 16:24:40 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
|
|
|
|
* static destructors, do not collect $200.
|
|
|
|
*/
|
2011-12-17 13:45:29 -08:00
|
|
|
MOZ_NORETURN void QuickExit();
|
2010-08-20 16:24:40 -07:00
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
|
2010-09-23 18:39:32 -07:00
|
|
|
nsRefPtr<ConsoleListener> mConsoleListener;
|
2009-08-12 17:32:50 -07:00
|
|
|
|
2011-09-30 00:00:48 -07:00
|
|
|
/**
|
|
|
|
* An ID unique to the process containing our corresponding
|
|
|
|
* content parent.
|
|
|
|
*
|
|
|
|
* We expect our content parent to set this ID immediately after opening a
|
|
|
|
* channel to us.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t mID;
|
2011-09-30 00:00:48 -07:00
|
|
|
|
2012-04-25 09:35:58 -07:00
|
|
|
AppInfo mAppInfo;
|
|
|
|
|
2012-08-07 00:06:29 -07:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize mScreenSize;
|
|
|
|
#endif
|
|
|
|
|
2012-08-23 03:23:43 -07:00
|
|
|
bool mIsForApp;
|
|
|
|
bool mIsForBrowser;
|
2012-10-05 14:54:54 -07:00
|
|
|
nsString mProcessName;
|
2012-08-23 03:23:43 -07:00
|
|
|
|
2010-07-21 11:42:32 -07:00
|
|
|
static ContentChild* sSingleton;
|
2010-05-25 17:13:47 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
|
2009-08-12 09:18:08 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|