michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 "nsWindowDataSource.h" michael@0: #include "nsIXULWindow.h" michael@0: #include "rdf.h" michael@0: #include "nsIRDFContainerUtils.h" michael@0: #include "nsIServiceManager.h" michael@0: #include "nsReadableUtils.h" michael@0: #include "nsIObserverService.h" michael@0: #include "nsIWindowMediator.h" michael@0: #include "nsXPCOMCID.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: #include "nsString.h" michael@0: michael@0: // just to do the reverse-lookup! sheesh. michael@0: #include "nsIInterfaceRequestorUtils.h" michael@0: #include "nsIDocShell.h" michael@0: michael@0: uint32_t nsWindowDataSource::windowCount = 0; michael@0: michael@0: nsIRDFResource* nsWindowDataSource::kNC_Name = nullptr; michael@0: nsIRDFResource* nsWindowDataSource::kNC_WindowRoot = nullptr; michael@0: nsIRDFResource* nsWindowDataSource::kNC_KeyIndex = nullptr; michael@0: michael@0: nsIRDFService* nsWindowDataSource::gRDFService = nullptr; michael@0: michael@0: uint32_t nsWindowDataSource::gRefCnt = 0; michael@0: michael@0: static const char kURINC_WindowRoot[] = "NC:WindowMediatorRoot"; michael@0: michael@0: DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name); michael@0: DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, KeyIndex); michael@0: michael@0: nsresult michael@0: nsWindowDataSource::Init() michael@0: { michael@0: nsresult rv; michael@0: michael@0: if (gRefCnt++ == 0) { michael@0: rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_WindowRoot), &kNC_WindowRoot); michael@0: gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name), &kNC_Name); michael@0: gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_KeyIndex), &kNC_KeyIndex); michael@0: } michael@0: michael@0: mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: nsCOMPtr rdfc = michael@0: do_GetService("@mozilla.org/rdf/container-utils;1", &rv); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: rv = rdfc->MakeSeq(this, kNC_WindowRoot, getter_AddRefs(mContainer)); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: nsCOMPtr windowMediator = michael@0: do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: rv = windowMediator->AddListener(this); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: nsCOMPtr observerService = michael@0: do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); michael@0: if (NS_SUCCEEDED(rv)) { michael@0: rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, michael@0: false); michael@0: } michael@0: return NS_OK; michael@0: } michael@0: michael@0: nsWindowDataSource::~nsWindowDataSource() michael@0: { michael@0: if (--gRefCnt == 0) { michael@0: NS_IF_RELEASE(kNC_Name); michael@0: NS_IF_RELEASE(kNC_KeyIndex); michael@0: NS_IF_RELEASE(kNC_WindowRoot); michael@0: NS_IF_RELEASE(gRDFService); michael@0: } michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsWindowDataSource::Observe(nsISupports *aSubject, const char* aTopic, const char16_t *aData) michael@0: { michael@0: if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { michael@0: // release these objects so that they release their reference michael@0: // to us michael@0: mContainer = nullptr; michael@0: mInner = nullptr; michael@0: } michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowDataSource) michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsWindowDataSource) michael@0: NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowDataSource) michael@0: // XXX mContainer? michael@0: NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInner) michael@0: NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END michael@0: michael@0: NS_IMPL_CYCLE_COLLECTING_ADDREF(nsWindowDataSource) michael@0: NS_IMPL_CYCLE_COLLECTING_RELEASE(nsWindowDataSource) michael@0: michael@0: NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowDataSource) michael@0: NS_INTERFACE_MAP_ENTRY(nsIObserver) michael@0: NS_INTERFACE_MAP_ENTRY(nsIWindowMediatorListener) michael@0: NS_INTERFACE_MAP_ENTRY(nsIWindowDataSource) michael@0: NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource) michael@0: NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) michael@0: NS_INTERFACE_MAP_END michael@0: michael@0: // nsIWindowMediatorListener implementation michael@0: // handle notifications from the window mediator and reflect them into michael@0: // RDF michael@0: michael@0: /* void onWindowTitleChange (in nsIXULWindow window, in wstring newTitle); */ michael@0: NS_IMETHODIMP michael@0: nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window, michael@0: const char16_t *newTitle) michael@0: { michael@0: nsresult rv; michael@0: michael@0: nsCOMPtr windowResource; michael@0: mWindowResources.Get(window, getter_AddRefs(windowResource)); michael@0: michael@0: // oops, make sure this window is in the hashtable! michael@0: if (!windowResource) { michael@0: OnOpenWindow(window); michael@0: mWindowResources.Get(window, getter_AddRefs(windowResource)); michael@0: } michael@0: michael@0: NS_ENSURE_TRUE(windowResource, NS_ERROR_UNEXPECTED); michael@0: michael@0: nsCOMPtr newTitleLiteral; michael@0: rv = gRDFService->GetLiteral(newTitle, getter_AddRefs(newTitleLiteral)); michael@0: NS_ENSURE_SUCCESS(rv, rv); michael@0: michael@0: // get the old title michael@0: nsCOMPtr oldTitleNode; michael@0: rv = GetTarget(windowResource, kNC_Name, true, michael@0: getter_AddRefs(oldTitleNode)); michael@0: michael@0: // assert the change michael@0: if (NS_SUCCEEDED(rv) && oldTitleNode) michael@0: // has an existing window title, update it michael@0: rv = Change(windowResource, kNC_Name, oldTitleNode, newTitleLiteral); michael@0: else michael@0: // removed from the tasklist michael@0: rv = Assert(windowResource, kNC_Name, newTitleLiteral, true); michael@0: michael@0: if (rv != NS_RDF_ASSERTION_ACCEPTED) michael@0: { michael@0: NS_ERROR("unable to set window name"); michael@0: } michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onOpenWindow (in nsIXULWindow window); */ michael@0: NS_IMETHODIMP michael@0: nsWindowDataSource::OnOpenWindow(nsIXULWindow *window) michael@0: { michael@0: nsAutoCString windowId(NS_LITERAL_CSTRING("window-")); michael@0: windowId.AppendInt(windowCount++, 10); michael@0: michael@0: nsCOMPtr windowResource; michael@0: gRDFService->GetResource(windowId, getter_AddRefs(windowResource)); michael@0: michael@0: mWindowResources.Put(window, windowResource); michael@0: michael@0: // assert the new window michael@0: if (mContainer) michael@0: mContainer->AppendElement(windowResource); michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onCloseWindow (in nsIXULWindow window); */ michael@0: NS_IMETHODIMP michael@0: nsWindowDataSource::OnCloseWindow(nsIXULWindow *window) michael@0: { michael@0: nsresult rv; michael@0: nsCOMPtr resource; michael@0: mWindowResources.Get(window, getter_AddRefs(resource)); michael@0: if (!resource) { michael@0: return NS_ERROR_UNEXPECTED; michael@0: } michael@0: michael@0: mWindowResources.Remove(window); michael@0: michael@0: // make sure we're not shutting down michael@0: if (!mContainer) return NS_OK; michael@0: michael@0: nsCOMPtr oldKeyNode; michael@0: nsCOMPtr oldKeyInt; michael@0: michael@0: // get the old keyIndex, if any michael@0: rv = GetTarget(resource, kNC_KeyIndex, true, michael@0: getter_AddRefs(oldKeyNode)); michael@0: if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) michael@0: oldKeyInt = do_QueryInterface(oldKeyNode); michael@0: michael@0: michael@0: // update RDF and keyindex - from this point forward we'll ignore michael@0: // errors, because they just indicate some kind of RDF inconsistency michael@0: int32_t winIndex = -1; michael@0: rv = mContainer->IndexOf(resource, &winIndex); michael@0: michael@0: if (NS_FAILED(rv)) michael@0: return NS_OK; michael@0: michael@0: // unassert the old window, ignore any error michael@0: mContainer->RemoveElement(resource, true); michael@0: michael@0: nsCOMPtr children; michael@0: rv = mContainer->GetElements(getter_AddRefs(children)); michael@0: if (NS_FAILED(rv)) michael@0: return NS_OK; michael@0: michael@0: bool more = false; michael@0: michael@0: while (NS_SUCCEEDED(rv = children->HasMoreElements(&more)) && more) { michael@0: nsCOMPtr sup; michael@0: rv = children->GetNext(getter_AddRefs(sup)); michael@0: if (NS_FAILED(rv)) michael@0: break; michael@0: michael@0: nsCOMPtr windowResource = do_QueryInterface(sup, &rv); michael@0: if (NS_FAILED(rv)) michael@0: continue; michael@0: michael@0: int32_t currentIndex = -1; michael@0: mContainer->IndexOf(windowResource, ¤tIndex); michael@0: michael@0: // can skip updating windows with lower indexes michael@0: // than the window that was removed michael@0: if (currentIndex < winIndex) michael@0: continue; michael@0: michael@0: nsCOMPtr newKeyNode; michael@0: nsCOMPtr newKeyInt; michael@0: michael@0: rv = GetTarget(windowResource, kNC_KeyIndex, true, michael@0: getter_AddRefs(newKeyNode)); michael@0: if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) michael@0: newKeyInt = do_QueryInterface(newKeyNode); michael@0: michael@0: // changing from one key index to another michael@0: if (oldKeyInt && newKeyInt) michael@0: Change(windowResource, kNC_KeyIndex, oldKeyInt, newKeyInt); michael@0: // creating a new keyindex - probably window going michael@0: // from (none) to "9" michael@0: else if (newKeyInt) michael@0: Assert(windowResource, kNC_KeyIndex, newKeyInt, true); michael@0: michael@0: // somehow inserting a window above this one, michael@0: // "9" to (none) michael@0: else if (oldKeyInt) michael@0: Unassert(windowResource, kNC_KeyIndex, oldKeyInt); michael@0: michael@0: } michael@0: return NS_OK; michael@0: } michael@0: michael@0: struct findWindowClosure { michael@0: nsIRDFResource* targetResource; michael@0: nsIXULWindow *resultWindow; michael@0: }; michael@0: michael@0: static PLDHashOperator michael@0: findWindow(nsIXULWindow* aWindow, nsIRDFResource* aResource, void* aClosure) michael@0: { michael@0: findWindowClosure* closure = static_cast(aClosure); michael@0: michael@0: if (aResource == closure->targetResource) { michael@0: closure->resultWindow = aWindow; michael@0: return PL_DHASH_STOP; michael@0: } michael@0: return PL_DHASH_NEXT; michael@0: } michael@0: michael@0: // nsIWindowDataSource implementation michael@0: michael@0: NS_IMETHODIMP michael@0: nsWindowDataSource::GetWindowForResource(const char *aResourceString, michael@0: nsIDOMWindow** aResult) michael@0: { michael@0: nsCOMPtr windowResource; michael@0: gRDFService->GetResource(nsDependentCString(aResourceString), michael@0: getter_AddRefs(windowResource)); michael@0: michael@0: // now reverse-lookup in the hashtable michael@0: findWindowClosure closure = { windowResource.get(), nullptr }; michael@0: mWindowResources.EnumerateRead(findWindow, &closure); michael@0: if (closure.resultWindow) { michael@0: michael@0: // this sucks, we have to jump through docshell to go from michael@0: // nsIXULWindow -> nsIDOMWindow michael@0: nsCOMPtr docShell; michael@0: closure.resultWindow->GetDocShell(getter_AddRefs(docShell)); michael@0: michael@0: if (docShell) { michael@0: nsCOMPtr result = do_GetInterface(docShell); michael@0: michael@0: *aResult = result; michael@0: NS_IF_ADDREF(*aResult); michael@0: } michael@0: } michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: michael@0: // nsIRDFDataSource implementation michael@0: // mostly, we just forward to mInner, except: michael@0: // GetURI() - need to return "rdf:window-mediator" michael@0: // GetTarget() - need to handle kNC_KeyIndex michael@0: michael@0: michael@0: /* readonly attribute string URI; */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetURI(char * *aURI) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aURI); michael@0: michael@0: *aURI = ToNewCString(NS_LITERAL_CSTRING("rdf:window-mediator")); michael@0: michael@0: if (!*aURI) michael@0: return NS_ERROR_OUT_OF_MEMORY; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsIRDFNode **_retval) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(_retval); michael@0: michael@0: // add extra nullptr checking for top-crash bug # 146466 michael@0: if (!gRDFService) return NS_RDF_NO_VALUE; michael@0: if (!mInner) return NS_RDF_NO_VALUE; michael@0: if (!mContainer) return NS_RDF_NO_VALUE; michael@0: // special case kNC_KeyIndex before we forward to mInner michael@0: if (aProperty == kNC_KeyIndex) { michael@0: michael@0: int32_t theIndex = 0; michael@0: nsresult rv = mContainer->IndexOf(aSource, &theIndex); michael@0: if (NS_FAILED(rv)) return rv; michael@0: michael@0: // only allow the range of 1 to 9 for single key access michael@0: if (theIndex < 1 || theIndex > 9) return(NS_RDF_NO_VALUE); michael@0: michael@0: nsCOMPtr indexInt; michael@0: rv = gRDFService->GetIntLiteral(theIndex, getter_AddRefs(indexInt)); michael@0: if (NS_FAILED(rv)) return(rv); michael@0: if (!indexInt) return(NS_ERROR_FAILURE); michael@0: michael@0: return CallQueryInterface(indexInt, _retval); michael@0: } michael@0: michael@0: return mInner->GetTarget(aSource, aProperty, aTruthValue, _retval); michael@0: } michael@0: michael@0: /* nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsIRDFResource **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->GetSource(aProperty, aTarget, aTruthValue, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->GetSources(aProperty, aTarget, aTruthValue, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->GetTargets(aSource, aProperty, aTruthValue, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue) michael@0: { michael@0: if (mInner) michael@0: return mInner->Assert(aSource, aProperty, aTarget, aTruthValue); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */ michael@0: NS_IMETHODIMP nsWindowDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget) michael@0: { michael@0: if (mInner) michael@0: return mInner->Unassert(aSource, aProperty, aTarget); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget); */ michael@0: NS_IMETHODIMP nsWindowDataSource::Change(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aOldTarget, nsIRDFNode *aNewTarget) michael@0: { michael@0: if (mInner) michael@0: return mInner->Change(aSource, aProperty, aOldTarget, aNewTarget); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */ michael@0: NS_IMETHODIMP nsWindowDataSource::Move(nsIRDFResource *aOldSource, nsIRDFResource *aNewSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget) michael@0: { michael@0: if (mInner) michael@0: return mInner->Move(aOldSource, aNewSource, aProperty, aTarget); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ michael@0: NS_IMETHODIMP nsWindowDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, bool *_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->HasAssertion(aSource, aProperty, aTarget, aTruthValue, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void AddObserver (in nsIRDFObserver aObserver); */ michael@0: NS_IMETHODIMP nsWindowDataSource::AddObserver(nsIRDFObserver *aObserver) michael@0: { michael@0: if (mInner) michael@0: return mInner->AddObserver(aObserver); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void RemoveObserver (in nsIRDFObserver aObserver); */ michael@0: NS_IMETHODIMP nsWindowDataSource::RemoveObserver(nsIRDFObserver *aObserver) michael@0: { michael@0: if (mInner) michael@0: return mInner->RemoveObserver(aObserver); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode); */ michael@0: NS_IMETHODIMP nsWindowDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->ArcLabelsIn(aNode, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */ michael@0: NS_IMETHODIMP nsWindowDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->ArcLabelsOut(aSource, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator GetAllResources (); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetAllResources(nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->GetAllResources(_retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */ michael@0: NS_IMETHODIMP nsWindowDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, bool *_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->IsCommandEnabled(aSources, aCommand, aArguments, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */ michael@0: NS_IMETHODIMP nsWindowDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments) michael@0: { michael@0: if (mInner) michael@0: return mInner->DoCommand(aSources, aCommand, aArguments); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource); */ michael@0: NS_IMETHODIMP nsWindowDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->GetAllCmds(aSource, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc); */ michael@0: NS_IMETHODIMP nsWindowDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, bool *_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->HasArcIn(aNode, aArc, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc); */ michael@0: NS_IMETHODIMP nsWindowDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, bool *_retval) michael@0: { michael@0: if (mInner) michael@0: return mInner->HasArcOut(aSource, aArc, _retval); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void beginUpdateBatch (); */ michael@0: NS_IMETHODIMP nsWindowDataSource::BeginUpdateBatch() michael@0: { michael@0: if (mInner) michael@0: return mInner->BeginUpdateBatch(); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void endUpdateBatch (); */ michael@0: NS_IMETHODIMP nsWindowDataSource::EndUpdateBatch() michael@0: { michael@0: if (mInner) michael@0: return mInner->EndUpdateBatch(); michael@0: return NS_OK; michael@0: } michael@0: michael@0: // The module goop michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowDataSource, Init) michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_WINDOWDATASOURCE_CID); michael@0: michael@0: static const mozilla::Module::CIDEntry kWindowDSCIDs[] = { michael@0: { &kNS_WINDOWDATASOURCE_CID, false, nullptr, nsWindowDataSourceConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kWindowDSContracts[] = { michael@0: { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", &kNS_WINDOWDATASOURCE_CID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::CategoryEntry kWindowDSCategories[] = { michael@0: { "app-startup", "Window Data Source", "service," NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator" }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module kWindowDSModule = { michael@0: mozilla::Module::kVersion, michael@0: kWindowDSCIDs, michael@0: kWindowDSContracts, michael@0: kWindowDSCategories michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsWindowDataSourceModule) = &kWindowDSModule;