LCOV - code coverage report
Current view: directory - dom/ipc - ContentChild.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 1 20.0 %
Date: 2012-06-02 Functions: 4 1 25.0 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* vim: set sw=4 ts=8 et tw=80 : */
       3                 : /* ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is Mozilla Content App.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  *   The Mozilla Foundation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   Frederic Plourde <frederic.plourde@collabora.co.uk>
      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 ***** */
      39                 : 
      40                 : #ifndef mozilla_dom_ContentChild_h
      41                 : #define mozilla_dom_ContentChild_h
      42                 : 
      43                 : #include "mozilla/Attributes.h"
      44                 : #include "mozilla/dom/PContentChild.h"
      45                 : 
      46                 : #include "nsTArray.h"
      47                 : #include "nsIConsoleListener.h"
      48                 : 
      49                 : struct ChromePackage;
      50                 : class nsIObserver;
      51                 : struct ResourceMapping;
      52                 : struct OverrideMapping;
      53                 : 
      54                 : namespace mozilla {
      55                 : namespace dom {
      56                 : 
      57                 : class AlertObserver;
      58                 : class PrefObserver;
      59                 : class ConsoleListener;
      60                 : class PStorageChild;
      61                 : 
      62                 : class ContentChild : public PContentChild
      63                 : {
      64                 : public:
      65                 :     ContentChild();
      66                 :     virtual ~ContentChild();
      67                 : 
      68                 :     struct AppInfo
      69               1 :     {
      70                 :         nsCString version;
      71                 :         nsCString buildID;
      72                 :     };
      73                 : 
      74                 :     bool Init(MessageLoop* aIOLoop,
      75                 :               base::ProcessHandle aParentHandle,
      76                 :               IPC::Channel* aChannel);
      77                 :     void InitXPCOM();
      78                 : 
      79               0 :     static ContentChild* GetSingleton() {
      80               0 :         NS_ASSERTION(sSingleton, "not initialized");
      81               0 :         return sSingleton;
      82                 :     }
      83                 : 
      84                 :     const AppInfo& GetAppInfo() {
      85                 :         return mAppInfo;
      86                 :     }
      87                 : 
      88                 :     /* if you remove this, please talk to cjones or dougt */
      89               0 :     virtual bool RecvDummy(Shmem& foo) { return true; }
      90                 : 
      91                 :     virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags);
      92                 :     virtual bool DeallocPBrowser(PBrowserChild*);
      93                 : 
      94                 :     virtual PCrashReporterChild*
      95                 :     AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
      96                 :                         const PRUint32& processType);
      97                 :     virtual bool
      98                 :     DeallocPCrashReporter(PCrashReporterChild*);
      99                 : 
     100                 :     NS_OVERRIDE virtual PHalChild* AllocPHal();
     101                 :     NS_OVERRIDE virtual bool DeallocPHal(PHalChild*);
     102                 : 
     103                 :     virtual PMemoryReportRequestChild*
     104                 :     AllocPMemoryReportRequest();
     105                 : 
     106                 :     virtual bool
     107                 :     DeallocPMemoryReportRequest(PMemoryReportRequestChild* actor);
     108                 : 
     109                 :     virtual bool
     110                 :     RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* child);
     111                 : 
     112                 :     virtual PTestShellChild* AllocPTestShell();
     113                 :     virtual bool DeallocPTestShell(PTestShellChild*);
     114                 :     virtual bool RecvPTestShellConstructor(PTestShellChild*);
     115                 : 
     116                 :     virtual PAudioChild* AllocPAudio(const PRInt32&,
     117                 :                                      const PRInt32&,
     118                 :                                      const PRInt32&);
     119                 :     virtual bool DeallocPAudio(PAudioChild*);
     120                 : 
     121                 :     virtual PNeckoChild* AllocPNecko();
     122                 :     virtual bool DeallocPNecko(PNeckoChild*);
     123                 : 
     124                 :     virtual PExternalHelperAppChild *AllocPExternalHelperApp(
     125                 :             const IPC::URI& uri,
     126                 :             const nsCString& aMimeContentType,
     127                 :             const nsCString& aContentDisposition,
     128                 :             const bool& aForceSave,
     129                 :             const PRInt64& aContentLength,
     130                 :             const IPC::URI& aReferrer);
     131                 :     virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
     132                 : 
     133                 :     virtual PSmsChild* AllocPSms();
     134                 :     virtual bool DeallocPSms(PSmsChild*);
     135                 : 
     136                 :     virtual PStorageChild* AllocPStorage(const StorageConstructData& aData);
     137                 :     virtual bool DeallocPStorage(PStorageChild* aActor);
     138                 : 
     139                 :     virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
     140                 :                                     const InfallibleTArray<ResourceMapping>& resources,
     141                 :                                     const InfallibleTArray<OverrideMapping>& overrides,
     142                 :                                     const nsCString& locale);
     143                 : 
     144                 :     virtual bool RecvSetOffline(const bool& offline);
     145                 : 
     146                 :     virtual bool RecvNotifyVisited(const IPC::URI& aURI);
     147                 :     // auto remove when alertfinished is received.
     148                 :     nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
     149                 : 
     150                 :     virtual bool RecvPreferenceUpdate(const PrefTuple& aPref);
     151                 :     virtual bool RecvClearUserPreference(const nsCString& aPrefName);
     152                 : 
     153                 :     virtual bool RecvNotifyAlertsObserver(const nsCString& aType, const nsString& aData);
     154                 : 
     155                 :     virtual bool RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON);
     156                 : 
     157                 :     virtual bool RecvGeolocationUpdate(const GeoPosition& somewhere);
     158                 : 
     159                 :     virtual bool RecvAddPermission(const IPC::Permission& permission);
     160                 : 
     161                 :     virtual bool RecvDeviceMotionChanged(const long int& type,
     162                 :                                          const double& x, const double& y,
     163                 :                                          const double& z);
     164                 : 
     165                 :     virtual bool RecvScreenSizeChanged(const gfxIntSize &size);
     166                 : 
     167                 :     virtual bool RecvFlushMemory(const nsString& reason);
     168                 : 
     169                 :     virtual bool RecvActivateA11y();
     170                 : 
     171                 :     virtual bool RecvGarbageCollect();
     172                 :     virtual bool RecvCycleCollect();
     173                 : 
     174                 :     virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID);
     175                 :     virtual bool RecvSetID(const PRUint64 &id);
     176                 : 
     177                 : #ifdef ANDROID
     178                 :     gfxIntSize GetScreenSize() { return mScreenSize; }
     179                 : #endif
     180                 : 
     181                 :     // Get the directory for IndexedDB files. We query the parent for this and
     182                 :     // cache the value
     183                 :     nsString &GetIndexedDBPath();
     184                 : 
     185                 :     PRUint64 GetID() { return mID; }
     186                 : 
     187                 : private:
     188                 :     NS_OVERRIDE
     189                 :     virtual void ActorDestroy(ActorDestroyReason why);
     190                 : 
     191                 :     NS_OVERRIDE
     192                 :     virtual void ProcessingError(Result what);
     193                 : 
     194                 :     /**
     195                 :      * Exit *now*.  Do not shut down XPCOM, do not pass Go, do not run
     196                 :      * static destructors, do not collect $200.
     197                 :      */
     198                 :     MOZ_NORETURN void QuickExit();
     199                 : 
     200                 :     InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
     201                 :     nsRefPtr<ConsoleListener> mConsoleListener;
     202                 : #ifdef ANDROID
     203                 :     gfxIntSize mScreenSize;
     204                 : #endif
     205                 : 
     206                 :     AppInfo mAppInfo;
     207                 : 
     208                 :     /**
     209                 :      * An ID unique to the process containing our corresponding
     210                 :      * content parent.
     211                 :      *
     212                 :      * We expect our content parent to set this ID immediately after opening a
     213                 :      * channel to us.
     214                 :      */
     215                 :     PRUint64 mID;
     216                 : 
     217                 :     static ContentChild* sSingleton;
     218                 : 
     219                 :     DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
     220                 : };
     221                 : 
     222                 : } // namespace dom
     223                 : } // namespace mozilla
     224                 : 
     225                 : #endif

Generated by: LCOV version 1.7