LCOV - code coverage report
Current view: directory - xpfe/components/windowds - nsWindowDataSource.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 247 2 0.8 %
Date: 2012-06-02 Functions: 40 2 5.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 200
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #include "nsWindowDataSource.h"
      39                 : #include "nsIXULWindow.h"
      40                 : #include "rdf.h"
      41                 : #include "nsIRDFContainerUtils.h"
      42                 : #include "nsIServiceManager.h"
      43                 : #include "nsReadableUtils.h"
      44                 : #include "nsIObserverService.h"
      45                 : #include "nsIWindowMediator.h"
      46                 : #include "nsXPCOMCID.h"
      47                 : #include "mozilla/ModuleUtils.h"
      48                 : 
      49                 : // just to do the reverse-lookup! sheesh.
      50                 : #include "nsIInterfaceRequestorUtils.h"
      51                 : #include "nsIDocShell.h"
      52                 : 
      53                 : PRUint32 nsWindowDataSource::windowCount = 0;
      54                 : 
      55                 : nsIRDFResource* nsWindowDataSource::kNC_Name = nsnull;
      56                 : nsIRDFResource* nsWindowDataSource::kNC_WindowRoot = nsnull;
      57                 : nsIRDFResource* nsWindowDataSource::kNC_KeyIndex = nsnull;
      58                 : 
      59                 : nsIRDFService*  nsWindowDataSource::gRDFService = nsnull;
      60                 : 
      61                 : PRUint32 nsWindowDataSource::gRefCnt = 0;
      62                 : 
      63                 : static const char kURINC_WindowRoot[] = "NC:WindowMediatorRoot";
      64                 : 
      65                 : DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
      66                 : DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, KeyIndex);
      67                 : 
      68                 : nsresult
      69               0 : nsWindowDataSource::Init()
      70                 : {
      71                 :     nsresult rv;
      72                 : 
      73               0 :     if (gRefCnt++ == 0) {
      74               0 :         rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
      75               0 :         if (NS_FAILED(rv)) return rv;
      76                 : 
      77               0 :         gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_WindowRoot), &kNC_WindowRoot);
      78               0 :         gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name),       &kNC_Name);
      79               0 :         gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_KeyIndex),   &kNC_KeyIndex);
      80                 :     }
      81                 : 
      82               0 :     mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv);
      83               0 :     if (NS_FAILED(rv)) return rv;
      84                 : 
      85                 :     nsCOMPtr<nsIRDFContainerUtils> rdfc =
      86               0 :         do_GetService("@mozilla.org/rdf/container-utils;1", &rv);
      87               0 :     if (NS_FAILED(rv)) return rv;
      88                 : 
      89               0 :     rv = rdfc->MakeSeq(this, kNC_WindowRoot, getter_AddRefs(mContainer));
      90               0 :     if (NS_FAILED(rv)) return rv;
      91                 : 
      92                 :     nsCOMPtr<nsIWindowMediator> windowMediator =
      93               0 :         do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv);
      94               0 :     if (NS_FAILED(rv)) return rv;
      95                 : 
      96               0 :     rv = windowMediator->AddListener(this);
      97               0 :     if (NS_FAILED(rv)) return rv;
      98                 : 
      99                 :     nsCOMPtr<nsIObserverService> observerService =
     100               0 :         do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
     101               0 :     if (NS_SUCCEEDED(rv)) {
     102               0 :         rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
     103               0 :                                           false);
     104                 :     }
     105               0 :     return NS_OK;
     106                 : }
     107                 : 
     108               0 : nsWindowDataSource::~nsWindowDataSource()
     109                 : {
     110               0 :     if (--gRefCnt == 0) {
     111               0 :         NS_IF_RELEASE(kNC_Name);
     112               0 :         NS_IF_RELEASE(kNC_KeyIndex);
     113               0 :         NS_IF_RELEASE(kNC_WindowRoot);
     114               0 :         NS_IF_RELEASE(gRDFService);
     115                 :     }
     116               0 : }
     117                 : 
     118                 : NS_IMETHODIMP
     119               0 : nsWindowDataSource::Observe(nsISupports *aSubject, const char* aTopic, const PRUnichar *aData)
     120                 : {
     121               0 :     if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
     122                 :         // release these objects so that they release their reference
     123                 :         // to us
     124               0 :         mContainer = nsnull;
     125               0 :         mInner = nsnull;
     126                 :     }
     127                 : 
     128               0 :     return NS_OK;
     129                 : }
     130                 : 
     131            1464 : NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowDataSource)
     132               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsWindowDataSource)
     133               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowDataSource)
     134                 :     // XXX mContainer?
     135               0 :     NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInner)
     136               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
     137                 : 
     138               0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(nsWindowDataSource)
     139               0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(nsWindowDataSource)
     140                 : 
     141               0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowDataSource)
     142               0 :     NS_INTERFACE_MAP_ENTRY(nsIObserver)
     143               0 :     NS_INTERFACE_MAP_ENTRY(nsIWindowMediatorListener)
     144               0 :     NS_INTERFACE_MAP_ENTRY(nsIWindowDataSource)
     145               0 :     NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
     146               0 :     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
     147               0 : NS_INTERFACE_MAP_END
     148                 : 
     149                 : // nsIWindowMediatorListener implementation
     150                 : // handle notifications from the window mediator and reflect them into
     151                 : // RDF
     152                 : 
     153                 : /* void onWindowTitleChange (in nsIXULWindow window, in wstring newTitle); */
     154                 : NS_IMETHODIMP
     155               0 : nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window,
     156                 :                                         const PRUnichar *newTitle)
     157                 : {
     158                 :     nsresult rv;
     159                 :     
     160               0 :     nsVoidKey key(window);
     161                 : 
     162                 :     nsCOMPtr<nsISupports> sup =
     163               0 :         dont_AddRef(mWindowResources.Get(&key));
     164                 : 
     165                 :     // oops, make sure this window is in the hashtable!
     166               0 :     if (!sup) {
     167               0 :         OnOpenWindow(window);
     168               0 :         sup = dont_AddRef(mWindowResources.Get(&key));
     169                 :     }
     170                 :     
     171               0 :     NS_ENSURE_TRUE(sup, NS_ERROR_UNEXPECTED);
     172                 : 
     173                 :     nsCOMPtr<nsIRDFResource> windowResource =
     174               0 :         do_QueryInterface(sup);
     175                 : 
     176               0 :     nsCOMPtr<nsIRDFLiteral> newTitleLiteral;
     177               0 :     rv = gRDFService->GetLiteral(newTitle, getter_AddRefs(newTitleLiteral));
     178               0 :     NS_ENSURE_SUCCESS(rv, rv);
     179                 : 
     180                 :     // get the old title
     181               0 :     nsCOMPtr<nsIRDFNode> oldTitleNode;
     182                 :     rv = GetTarget(windowResource, kNC_Name, true,
     183               0 :                    getter_AddRefs(oldTitleNode));
     184                 :     
     185                 :     // assert the change
     186               0 :     if (NS_SUCCEEDED(rv) && oldTitleNode)
     187                 :         // has an existing window title, update it
     188               0 :         rv = Change(windowResource, kNC_Name, oldTitleNode, newTitleLiteral);
     189                 :     else
     190                 :         // removed from the tasklist
     191               0 :         rv = Assert(windowResource, kNC_Name, newTitleLiteral, true);
     192                 : 
     193               0 :     if (rv != NS_RDF_ASSERTION_ACCEPTED)
     194                 :     {
     195               0 :       NS_ERROR("unable to set window name");
     196                 :     }
     197                 :     
     198               0 :     return NS_OK;
     199                 : }
     200                 : 
     201                 : /* void onOpenWindow (in nsIXULWindow window); */
     202                 : NS_IMETHODIMP
     203               0 : nsWindowDataSource::OnOpenWindow(nsIXULWindow *window)
     204                 : {
     205               0 :     nsCAutoString windowId(NS_LITERAL_CSTRING("window-"));
     206               0 :     windowId.AppendInt(windowCount++, 10);
     207                 : 
     208               0 :     nsCOMPtr<nsIRDFResource> windowResource;
     209               0 :     gRDFService->GetResource(windowId, getter_AddRefs(windowResource));
     210                 : 
     211               0 :     nsVoidKey key(window);
     212               0 :     mWindowResources.Put(&key, windowResource);
     213                 : 
     214                 :     // assert the new window
     215               0 :     if (mContainer)
     216               0 :         mContainer->AppendElement(windowResource);
     217                 : 
     218               0 :     return NS_OK;
     219                 : }
     220                 : 
     221                 : /* void onCloseWindow (in nsIXULWindow window); */
     222                 : NS_IMETHODIMP
     223               0 : nsWindowDataSource::OnCloseWindow(nsIXULWindow *window)
     224                 : {
     225               0 :     nsVoidKey key(window);
     226               0 :     nsCOMPtr<nsIRDFResource> resource;
     227                 : 
     228                 :     nsresult rv;
     229                 : 
     230               0 :     if (!mWindowResources.Remove(&key, getter_AddRefs(resource)))
     231               0 :         return NS_ERROR_UNEXPECTED;
     232                 : 
     233                 :     // make sure we're not shutting down
     234               0 :     if (!mContainer) return NS_OK;
     235                 :     
     236               0 :     nsCOMPtr<nsIRDFNode> oldKeyNode;
     237               0 :     nsCOMPtr<nsIRDFInt> oldKeyInt;
     238                 :     
     239                 :     // get the old keyIndex, if any
     240                 :     rv = GetTarget(resource, kNC_KeyIndex, true,
     241               0 :                    getter_AddRefs(oldKeyNode));
     242               0 :     if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
     243               0 :         oldKeyInt = do_QueryInterface(oldKeyNode);
     244                 : 
     245                 :     
     246                 :     // update RDF and keyindex - from this point forward we'll ignore
     247                 :     // errors, because they just indicate some kind of RDF inconsistency
     248               0 :     PRInt32 winIndex = -1;
     249               0 :     rv = mContainer->IndexOf(resource, &winIndex);
     250                 :         
     251               0 :     if (NS_FAILED(rv))
     252               0 :         return NS_OK;
     253                 :             
     254                 :     // unassert the old window, ignore any error
     255               0 :     mContainer->RemoveElement(resource, true);
     256                 :     
     257               0 :     nsCOMPtr<nsISimpleEnumerator> children;
     258               0 :     rv = mContainer->GetElements(getter_AddRefs(children));
     259               0 :     if (NS_FAILED(rv))
     260               0 :         return NS_OK;
     261                 : 
     262               0 :     bool more = false;
     263                 : 
     264               0 :     while (NS_SUCCEEDED(rv = children->HasMoreElements(&more)) && more) {
     265               0 :         nsCOMPtr<nsISupports> sup;
     266               0 :         rv = children->GetNext(getter_AddRefs(sup));
     267               0 :         if (NS_FAILED(rv))
     268                 :             break;
     269                 : 
     270               0 :         nsCOMPtr<nsIRDFResource> windowResource = do_QueryInterface(sup, &rv);
     271               0 :         if (NS_FAILED(rv))
     272               0 :             continue;
     273                 : 
     274               0 :         PRInt32 currentIndex = -1;
     275               0 :         mContainer->IndexOf(windowResource, &currentIndex);
     276                 : 
     277                 :         // can skip updating windows with lower indexes
     278                 :         // than the window that was removed
     279               0 :         if (currentIndex < winIndex)
     280               0 :             continue;
     281                 : 
     282               0 :         nsCOMPtr<nsIRDFNode> newKeyNode;
     283               0 :         nsCOMPtr<nsIRDFInt> newKeyInt;
     284                 : 
     285                 :         rv = GetTarget(windowResource, kNC_KeyIndex, true,
     286               0 :                        getter_AddRefs(newKeyNode));
     287               0 :         if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE))
     288               0 :             newKeyInt = do_QueryInterface(newKeyNode);
     289                 : 
     290                 :         // changing from one key index to another
     291               0 :         if (oldKeyInt && newKeyInt)
     292               0 :             Change(windowResource, kNC_KeyIndex, oldKeyInt, newKeyInt);
     293                 :         // creating a new keyindex - probably window going
     294                 :         // from (none) to "9"
     295               0 :         else if (newKeyInt)
     296               0 :             Assert(windowResource, kNC_KeyIndex, newKeyInt, true);
     297                 :         
     298                 :         // somehow inserting a window above this one,
     299                 :         // "9" to (none)
     300               0 :         else if (oldKeyInt)
     301               0 :             Unassert(windowResource, kNC_KeyIndex, oldKeyInt);
     302                 :         
     303                 :     }
     304               0 :     return NS_OK;
     305                 : }
     306                 : 
     307                 : struct findWindowClosure {
     308                 :     nsIRDFResource* targetResource;
     309                 :     nsIXULWindow *resultWindow;
     310                 : };
     311                 : 
     312                 : static bool
     313               0 : findWindow(nsHashKey* aKey, void *aData, void* aClosure)
     314                 : {
     315               0 :     nsVoidKey *thisKey = static_cast<nsVoidKey*>(aKey);
     316                 : 
     317                 :     nsIRDFResource *resource =
     318               0 :         static_cast<nsIRDFResource*>(aData);
     319                 :     
     320                 :     findWindowClosure* closure =
     321               0 :         static_cast<findWindowClosure*>(aClosure);
     322                 : 
     323               0 :     if (resource == closure->targetResource) {
     324                 :         closure->resultWindow =
     325                 :             static_cast<nsIXULWindow*>
     326               0 :                        (thisKey->GetValue());
     327               0 :         return false;         // stop enumerating
     328                 :     }
     329               0 :     return true;
     330                 : }
     331                 : 
     332                 : // nsIWindowDataSource implementation
     333                 : 
     334                 : NS_IMETHODIMP
     335               0 : nsWindowDataSource::GetWindowForResource(const char *aResourceString,
     336                 :                                          nsIDOMWindow** aResult)
     337                 : {
     338               0 :     nsCOMPtr<nsIRDFResource> windowResource;
     339               0 :     gRDFService->GetResource(nsDependentCString(aResourceString),
     340               0 :                              getter_AddRefs(windowResource));
     341                 : 
     342                 :     // now reverse-lookup in the hashtable
     343               0 :     findWindowClosure closure = { windowResource.get(), nsnull };
     344               0 :     mWindowResources.Enumerate(findWindow, (void*)&closure);
     345               0 :     if (closure.resultWindow) {
     346                 : 
     347                 :         // this sucks, we have to jump through docshell to go from
     348                 :         // nsIXULWindow -> nsIDOMWindow
     349               0 :         nsCOMPtr<nsIDocShell> docShell;
     350               0 :         closure.resultWindow->GetDocShell(getter_AddRefs(docShell));
     351                 : 
     352               0 :         if (docShell) {
     353               0 :             nsCOMPtr<nsIDOMWindow> result = do_GetInterface(docShell);
     354                 :         
     355               0 :             *aResult = result;
     356               0 :             NS_IF_ADDREF(*aResult);
     357                 :         }
     358                 :     }
     359                 : 
     360               0 :     return NS_OK;
     361                 : }
     362                 : 
     363                 : 
     364                 : // nsIRDFDataSource implementation
     365                 : // mostly, we just forward to mInner, except:
     366                 : // GetURI() - need to return "rdf:window-mediator"
     367                 : // GetTarget() - need to handle kNC_KeyIndex
     368                 : 
     369                 : 
     370                 : /* readonly attribute string URI; */
     371               0 : NS_IMETHODIMP nsWindowDataSource::GetURI(char * *aURI)
     372                 : {
     373               0 :     NS_ENSURE_ARG_POINTER(aURI);
     374                 :     
     375               0 :     *aURI = ToNewCString(NS_LITERAL_CSTRING("rdf:window-mediator"));
     376                 : 
     377               0 :     if (!*aURI)
     378               0 :         return NS_ERROR_OUT_OF_MEMORY;
     379                 :     
     380               0 :     return NS_OK;
     381                 : }
     382                 : 
     383                 : /* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
     384               0 : NS_IMETHODIMP nsWindowDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsIRDFNode **_retval)
     385                 : {
     386               0 :     NS_ENSURE_ARG_POINTER(_retval);
     387                 : 
     388                 :     // add extra NULL checking for top-crash bug # 146466
     389               0 :     if (!gRDFService) return NS_RDF_NO_VALUE;
     390               0 :     if (!mInner) return NS_RDF_NO_VALUE;
     391               0 :     if (!mContainer) return NS_RDF_NO_VALUE;
     392                 :     // special case kNC_KeyIndex before we forward to mInner
     393               0 :     if (aProperty == kNC_KeyIndex) {
     394                 : 
     395               0 :         PRInt32 theIndex = 0;
     396               0 :         nsresult rv = mContainer->IndexOf(aSource, &theIndex);
     397               0 :         if (NS_FAILED(rv)) return rv;
     398                 : 
     399                 :         // only allow the range of 1 to 9 for single key access
     400               0 :         if (theIndex < 1 || theIndex > 9) return(NS_RDF_NO_VALUE);
     401                 : 
     402               0 :         nsCOMPtr<nsIRDFInt> indexInt;
     403               0 :         rv = gRDFService->GetIntLiteral(theIndex, getter_AddRefs(indexInt));
     404               0 :         if (NS_FAILED(rv)) return(rv);
     405               0 :         if (!indexInt) return(NS_ERROR_FAILURE);
     406                 :         
     407               0 :         return CallQueryInterface(indexInt, _retval);
     408                 :     }
     409                 : 
     410                 :     
     411               0 :     return mInner->GetTarget(aSource, aProperty, aTruthValue, _retval);
     412                 : }
     413                 : 
     414                 : /* nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
     415               0 : NS_IMETHODIMP nsWindowDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsIRDFResource **_retval)
     416                 : {
     417               0 :     if (mInner)
     418               0 :         return mInner->GetSource(aProperty, aTarget, aTruthValue, _retval);
     419               0 :     return NS_OK;
     420                 : }
     421                 : 
     422                 : /* nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
     423               0 : NS_IMETHODIMP nsWindowDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsISimpleEnumerator **_retval)
     424                 : {
     425               0 :     if (mInner)
     426               0 :         return mInner->GetSources(aProperty, aTarget, aTruthValue, _retval);
     427               0 :     return NS_OK;
     428                 : }
     429                 : 
     430                 : /* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
     431               0 : NS_IMETHODIMP nsWindowDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsISimpleEnumerator **_retval)
     432                 : {
     433               0 :     if (mInner)
     434               0 :         return mInner->GetTargets(aSource, aProperty, aTruthValue, _retval);
     435               0 :     return NS_OK;
     436                 : }
     437                 : 
     438                 : /* void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
     439               0 : NS_IMETHODIMP nsWindowDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue)
     440                 : {
     441               0 :     if (mInner)
     442               0 :         return mInner->Assert(aSource, aProperty, aTarget, aTruthValue);
     443               0 :     return NS_OK;
     444                 : }
     445                 : 
     446                 : /* void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */
     447               0 : NS_IMETHODIMP nsWindowDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
     448                 : {
     449               0 :     if (mInner)
     450               0 :         return mInner->Unassert(aSource, aProperty, aTarget);
     451               0 :     return NS_OK;
     452                 : }
     453                 : 
     454                 : /* void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget); */
     455               0 : NS_IMETHODIMP nsWindowDataSource::Change(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aOldTarget, nsIRDFNode *aNewTarget)
     456                 : {
     457               0 :     if (mInner)
     458               0 :         return mInner->Change(aSource, aProperty, aOldTarget, aNewTarget);
     459               0 :     return NS_OK;
     460                 : }
     461                 : 
     462                 : /* void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */
     463               0 : NS_IMETHODIMP nsWindowDataSource::Move(nsIRDFResource *aOldSource, nsIRDFResource *aNewSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
     464                 : {
     465               0 :     if (mInner)
     466               0 :         return mInner->Move(aOldSource, aNewSource, aProperty, aTarget);
     467               0 :     return NS_OK;
     468                 : }
     469                 : 
     470                 : /* boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
     471               0 : NS_IMETHODIMP nsWindowDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, bool *_retval)
     472                 : {
     473               0 :     if (mInner)
     474               0 :         return mInner->HasAssertion(aSource, aProperty, aTarget, aTruthValue, _retval);
     475               0 :     return NS_OK;
     476                 : }
     477                 : 
     478                 : /* void AddObserver (in nsIRDFObserver aObserver); */
     479               0 : NS_IMETHODIMP nsWindowDataSource::AddObserver(nsIRDFObserver *aObserver)
     480                 : {
     481               0 :     if (mInner)
     482               0 :         return mInner->AddObserver(aObserver);
     483               0 :     return NS_OK;
     484                 : }
     485                 : 
     486                 : /* void RemoveObserver (in nsIRDFObserver aObserver); */
     487               0 : NS_IMETHODIMP nsWindowDataSource::RemoveObserver(nsIRDFObserver *aObserver)
     488                 : {
     489               0 :     if (mInner)
     490               0 :         return mInner->RemoveObserver(aObserver);
     491               0 :     return NS_OK;
     492                 : }
     493                 : 
     494                 : /* nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
     495               0 : NS_IMETHODIMP nsWindowDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval)
     496                 : {
     497               0 :     if (mInner)
     498               0 :         return mInner->ArcLabelsIn(aNode, _retval);
     499               0 :     return NS_OK;
     500                 : }
     501                 : 
     502                 : /* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
     503               0 : NS_IMETHODIMP nsWindowDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
     504                 : {
     505               0 :     if (mInner)
     506               0 :         return mInner->ArcLabelsOut(aSource, _retval);
     507               0 :     return NS_OK;
     508                 : }
     509                 : 
     510                 : /* nsISimpleEnumerator GetAllResources (); */
     511               0 : NS_IMETHODIMP nsWindowDataSource::GetAllResources(nsISimpleEnumerator **_retval)
     512                 : {
     513               0 :     if (mInner)
     514               0 :         return mInner->GetAllResources(_retval);
     515               0 :     return NS_OK;
     516                 : }
     517                 : 
     518                 : /* boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */
     519               0 : NS_IMETHODIMP nsWindowDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, bool *_retval)
     520                 : {
     521               0 :     if (mInner)
     522               0 :         return mInner->IsCommandEnabled(aSources, aCommand, aArguments, _retval);
     523               0 :     return NS_OK;
     524                 : }
     525                 : 
     526                 : /* void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */
     527               0 : NS_IMETHODIMP nsWindowDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
     528                 : {
     529               0 :     if (mInner)
     530               0 :         return mInner->DoCommand(aSources, aCommand, aArguments);
     531               0 :     return NS_OK;
     532                 : }
     533                 : 
     534                 : /* nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource); */
     535               0 : NS_IMETHODIMP nsWindowDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
     536                 : {
     537               0 :     if (mInner)
     538               0 :         return mInner->GetAllCmds(aSource, _retval);
     539               0 :     return NS_OK;
     540                 : }
     541                 : 
     542                 : /* boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc); */
     543               0 : NS_IMETHODIMP nsWindowDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, bool *_retval)
     544                 : {
     545               0 :     if (mInner)
     546               0 :         return mInner->HasArcIn(aNode, aArc, _retval);
     547               0 :     return NS_OK;
     548                 : }
     549                 : 
     550                 : /* boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc); */
     551               0 : NS_IMETHODIMP nsWindowDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, bool *_retval)
     552                 : {
     553               0 :     if (mInner)
     554               0 :         return mInner->HasArcOut(aSource, aArc, _retval);
     555               0 :     return NS_OK;
     556                 : }
     557                 : 
     558                 : /* void beginUpdateBatch (); */
     559               0 : NS_IMETHODIMP nsWindowDataSource::BeginUpdateBatch()
     560                 : {
     561               0 :     if (mInner)
     562               0 :         return mInner->BeginUpdateBatch();
     563               0 :     return NS_OK;
     564                 : }
     565                 :                                                                                 
     566                 : /* void endUpdateBatch (); */
     567               0 : NS_IMETHODIMP nsWindowDataSource::EndUpdateBatch()
     568                 : {
     569               0 :     if (mInner)
     570               0 :         return mInner->EndUpdateBatch();
     571               0 :     return NS_OK;
     572                 : }
     573                 : 
     574                 : // The module goop
     575                 : 
     576               0 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowDataSource, Init)
     577                 : 
     578                 : NS_DEFINE_NAMED_CID(NS_WINDOWDATASOURCE_CID);
     579                 : 
     580                 : static const mozilla::Module::CIDEntry kWindowDSCIDs[] = {
     581                 :     { &kNS_WINDOWDATASOURCE_CID, false, NULL, nsWindowDataSourceConstructor },
     582                 :     { NULL }
     583                 : };
     584                 : 
     585                 : static const mozilla::Module::ContractIDEntry kWindowDSContracts[] = {
     586                 :     { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", &kNS_WINDOWDATASOURCE_CID },
     587                 :     { NULL }
     588                 : };
     589                 : 
     590                 : static const mozilla::Module::CategoryEntry kWindowDSCategories[] = {
     591                 :     { "app-startup", "Window Data Source", "service," NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator" },
     592                 :     { NULL }
     593                 : };
     594                 :         
     595                 : static const mozilla::Module kWindowDSModule = {
     596                 :     mozilla::Module::kVersion,
     597                 :     kWindowDSCIDs,
     598                 :     kWindowDSContracts,
     599                 :     kWindowDSCategories
     600                 : };
     601                 : 
     602            4392 : NSMODULE_DEFN(nsWindowDataSourceModule) = &kWindowDSModule;

Generated by: LCOV version 1.7