2009-08-18 23:05:15 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2009-09-10 02:00:14 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Content App.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2010-05-26 04:13:47 +04:00
|
|
|
* Frederic Plourde <frederic.plourde@collabora.co.uk>
|
2009-09-10 02:00:14 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
#ifndef mozilla_dom_ContentChild_h
|
|
|
|
#define mozilla_dom_ContentChild_h
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
#include "mozilla/dom/PContentChild.h"
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2009-08-26 03:07:22 +04:00
|
|
|
#include "nsTArray.h"
|
2010-09-24 05:39:32 +04:00
|
|
|
#include "nsIConsoleListener.h"
|
2009-08-26 03:07:22 +04:00
|
|
|
|
2010-03-11 08:33:00 +03:00
|
|
|
struct ChromePackage;
|
2010-07-21 22:42:32 +04:00
|
|
|
class nsIObserver;
|
2010-03-11 08:33:00 +03:00
|
|
|
struct ResourceMapping;
|
|
|
|
struct OverrideMapping;
|
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2010-09-15 20:44:57 +04:00
|
|
|
class AlertObserver;
|
2010-07-21 22:42:32 +04:00
|
|
|
class PrefObserver;
|
2010-09-24 05:39:32 +04:00
|
|
|
class ConsoleListener;
|
2010-11-19 04:15:23 +03:00
|
|
|
class PStorageChild;
|
2010-07-21 22:42:32 +04:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
class ContentChild : public PContentChild
|
2009-08-12 20:18:08 +04:00
|
|
|
{
|
|
|
|
public:
|
2010-07-19 22:33:33 +04:00
|
|
|
ContentChild();
|
|
|
|
virtual ~ContentChild();
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2009-10-28 00:52:37 +03:00
|
|
|
bool Init(MessageLoop* aIOLoop,
|
|
|
|
base::ProcessHandle aParentHandle,
|
|
|
|
IPC::Channel* aChannel);
|
2010-09-24 05:39:32 +04:00
|
|
|
void InitXPCOM();
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
static ContentChild* GetSingleton() {
|
2009-08-13 04:32:50 +04:00
|
|
|
NS_ASSERTION(sSingleton, "not initialized");
|
|
|
|
return sSingleton;
|
|
|
|
}
|
|
|
|
|
2010-03-24 13:47:18 +03:00
|
|
|
/* if you remove this, please talk to cjones or dougt */
|
|
|
|
virtual bool RecvDummy(Shmem& foo) { return true; }
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags);
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool DeallocPBrowser(PBrowserChild*);
|
2009-08-12 20:18:08 +04:00
|
|
|
|
2011-06-08 23:56:31 +04:00
|
|
|
virtual PCrashReporterChild*
|
|
|
|
AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
|
|
|
|
const PRUint32& processType);
|
|
|
|
virtual bool
|
|
|
|
DeallocPCrashReporter(PCrashReporterChild*);
|
2010-11-24 17:15:03 +03:00
|
|
|
|
2011-02-16 21:43:23 +03:00
|
|
|
virtual PMemoryReportRequestChild*
|
|
|
|
AllocPMemoryReportRequest();
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPMemoryReportRequest(PMemoryReportRequestChild* actor);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* child);
|
|
|
|
|
2009-09-22 21:31:11 +04:00
|
|
|
virtual PTestShellChild* AllocPTestShell();
|
|
|
|
virtual bool DeallocPTestShell(PTestShellChild*);
|
2009-11-06 23:43:39 +03:00
|
|
|
virtual bool RecvPTestShellConstructor(PTestShellChild*);
|
2009-08-26 03:07:22 +04:00
|
|
|
|
2010-11-17 07:14:19 +03:00
|
|
|
virtual PAudioChild* AllocPAudio(const PRInt32&,
|
|
|
|
const PRInt32&,
|
|
|
|
const PRInt32&);
|
|
|
|
virtual bool DeallocPAudio(PAudioChild*);
|
|
|
|
|
2009-09-22 21:31:11 +04:00
|
|
|
virtual PNeckoChild* AllocPNecko();
|
|
|
|
virtual bool DeallocPNecko(PNeckoChild*);
|
2009-08-18 23:05:15 +04:00
|
|
|
|
2010-09-16 02:55:08 +04:00
|
|
|
virtual PExternalHelperAppChild *AllocPExternalHelperApp(
|
|
|
|
const IPC::URI& uri,
|
|
|
|
const nsCString& aMimeContentType,
|
|
|
|
const nsCString& aContentDisposition,
|
|
|
|
const bool& aForceSave,
|
2010-11-21 22:21:59 +03:00
|
|
|
const PRInt64& aContentLength,
|
|
|
|
const IPC::URI& aReferrer);
|
2010-09-16 02:55:08 +04:00
|
|
|
virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
|
|
|
|
|
2010-11-19 04:15:23 +03:00
|
|
|
virtual PStorageChild* AllocPStorage(const StorageConstructData& aData);
|
|
|
|
virtual bool DeallocPStorage(PStorageChild* aActor);
|
|
|
|
|
2010-11-09 05:49:00 +03:00
|
|
|
virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
|
|
|
|
const InfallibleTArray<ResourceMapping>& resources,
|
2011-01-12 00:34:31 +03:00
|
|
|
const InfallibleTArray<OverrideMapping>& overrides,
|
|
|
|
const nsCString& locale);
|
2010-03-11 08:33:00 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool RecvSetOffline(const bool& offline);
|
2010-05-11 16:44:12 +04:00
|
|
|
|
2010-07-02 19:50:41 +04:00
|
|
|
virtual bool RecvNotifyVisited(const IPC::URI& aURI);
|
2010-09-15 20:44:57 +04:00
|
|
|
// auto remove when alertfinished is received.
|
|
|
|
nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
|
|
|
|
|
2010-10-20 00:35:08 +04:00
|
|
|
virtual bool RecvPreferenceUpdate(const PrefTuple& aPref);
|
2011-01-06 07:54:47 +03:00
|
|
|
virtual bool RecvClearUserPreference(const nsCString& aPrefName);
|
2010-10-20 00:35:08 +04:00
|
|
|
|
2010-09-15 20:44:57 +04:00
|
|
|
virtual bool RecvNotifyAlertsObserver(const nsCString& aType, const nsString& aData);
|
|
|
|
|
2010-08-31 22:58:35 +04:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON);
|
2010-05-26 04:13:47 +04:00
|
|
|
|
2010-09-21 08:16:37 +04:00
|
|
|
virtual bool RecvGeolocationUpdate(const GeoPosition& somewhere);
|
|
|
|
|
2010-10-09 22:07:38 +04:00
|
|
|
virtual bool RecvAddPermission(const IPC::Permission& permission);
|
|
|
|
|
2011-06-20 09:36:17 +04:00
|
|
|
virtual bool RecvDeviceMotionChanged(const long int& type,
|
|
|
|
const double& x, const double& y,
|
2010-11-05 20:43:13 +03:00
|
|
|
const double& z);
|
|
|
|
|
2010-11-24 21:22:40 +03:00
|
|
|
virtual bool RecvScreenSizeChanged(const gfxIntSize &size);
|
2010-12-12 01:36:08 +03:00
|
|
|
|
|
|
|
virtual bool RecvFlushMemory(const nsString& reason);
|
|
|
|
|
2011-07-21 08:37:32 +04:00
|
|
|
virtual bool RecvActivateA11y();
|
|
|
|
|
2011-09-13 21:53:51 +04:00
|
|
|
virtual bool RecvGarbageCollect();
|
|
|
|
virtual bool RecvCycleCollect();
|
|
|
|
|
2010-11-24 21:22:40 +03:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize GetScreenSize() { return mScreenSize; }
|
|
|
|
#endif
|
|
|
|
|
2011-04-30 03:46:20 +04:00
|
|
|
// Get the directory for IndexedDB files. We query the parent for this and
|
|
|
|
// cache the value
|
|
|
|
nsString &GetIndexedDBPath();
|
|
|
|
|
2009-12-07 09:03:49 +03:00
|
|
|
private:
|
|
|
|
NS_OVERRIDE
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
NS_OVERRIDE
|
|
|
|
virtual void ProcessingError(Result what);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
|
|
|
|
* static destructors, do not collect $200.
|
|
|
|
*/
|
|
|
|
NS_NORETURN void QuickExit();
|
|
|
|
|
2010-11-09 05:49:00 +03:00
|
|
|
InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
|
2010-09-24 05:39:32 +04:00
|
|
|
nsRefPtr<ConsoleListener> mConsoleListener;
|
2010-11-24 21:22:40 +03:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize mScreenSize;
|
|
|
|
#endif
|
2009-08-13 04:32:50 +04:00
|
|
|
|
2010-07-21 22:42:32 +04:00
|
|
|
static ContentChild* sSingleton;
|
2010-05-26 04:13:47 +04:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
|
2009-08-12 20:18:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|