1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpfe/components/windowds/nsWindowDataSource.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,558 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsWindowDataSource.h" 1.10 +#include "nsIXULWindow.h" 1.11 +#include "rdf.h" 1.12 +#include "nsIRDFContainerUtils.h" 1.13 +#include "nsIServiceManager.h" 1.14 +#include "nsReadableUtils.h" 1.15 +#include "nsIObserverService.h" 1.16 +#include "nsIWindowMediator.h" 1.17 +#include "nsXPCOMCID.h" 1.18 +#include "mozilla/ModuleUtils.h" 1.19 +#include "nsString.h" 1.20 + 1.21 +// just to do the reverse-lookup! sheesh. 1.22 +#include "nsIInterfaceRequestorUtils.h" 1.23 +#include "nsIDocShell.h" 1.24 + 1.25 +uint32_t nsWindowDataSource::windowCount = 0; 1.26 + 1.27 +nsIRDFResource* nsWindowDataSource::kNC_Name = nullptr; 1.28 +nsIRDFResource* nsWindowDataSource::kNC_WindowRoot = nullptr; 1.29 +nsIRDFResource* nsWindowDataSource::kNC_KeyIndex = nullptr; 1.30 + 1.31 +nsIRDFService* nsWindowDataSource::gRDFService = nullptr; 1.32 + 1.33 +uint32_t nsWindowDataSource::gRefCnt = 0; 1.34 + 1.35 +static const char kURINC_WindowRoot[] = "NC:WindowMediatorRoot"; 1.36 + 1.37 +DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name); 1.38 +DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, KeyIndex); 1.39 + 1.40 +nsresult 1.41 +nsWindowDataSource::Init() 1.42 +{ 1.43 + nsresult rv; 1.44 + 1.45 + if (gRefCnt++ == 0) { 1.46 + rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService); 1.47 + if (NS_FAILED(rv)) return rv; 1.48 + 1.49 + gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_WindowRoot), &kNC_WindowRoot); 1.50 + gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name), &kNC_Name); 1.51 + gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_KeyIndex), &kNC_KeyIndex); 1.52 + } 1.53 + 1.54 + mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv); 1.55 + if (NS_FAILED(rv)) return rv; 1.56 + 1.57 + nsCOMPtr<nsIRDFContainerUtils> rdfc = 1.58 + do_GetService("@mozilla.org/rdf/container-utils;1", &rv); 1.59 + if (NS_FAILED(rv)) return rv; 1.60 + 1.61 + rv = rdfc->MakeSeq(this, kNC_WindowRoot, getter_AddRefs(mContainer)); 1.62 + if (NS_FAILED(rv)) return rv; 1.63 + 1.64 + nsCOMPtr<nsIWindowMediator> windowMediator = 1.65 + do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv); 1.66 + if (NS_FAILED(rv)) return rv; 1.67 + 1.68 + rv = windowMediator->AddListener(this); 1.69 + if (NS_FAILED(rv)) return rv; 1.70 + 1.71 + nsCOMPtr<nsIObserverService> observerService = 1.72 + do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); 1.73 + if (NS_SUCCEEDED(rv)) { 1.74 + rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, 1.75 + false); 1.76 + } 1.77 + return NS_OK; 1.78 +} 1.79 + 1.80 +nsWindowDataSource::~nsWindowDataSource() 1.81 +{ 1.82 + if (--gRefCnt == 0) { 1.83 + NS_IF_RELEASE(kNC_Name); 1.84 + NS_IF_RELEASE(kNC_KeyIndex); 1.85 + NS_IF_RELEASE(kNC_WindowRoot); 1.86 + NS_IF_RELEASE(gRDFService); 1.87 + } 1.88 +} 1.89 + 1.90 +NS_IMETHODIMP 1.91 +nsWindowDataSource::Observe(nsISupports *aSubject, const char* aTopic, const char16_t *aData) 1.92 +{ 1.93 + if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { 1.94 + // release these objects so that they release their reference 1.95 + // to us 1.96 + mContainer = nullptr; 1.97 + mInner = nullptr; 1.98 + } 1.99 + 1.100 + return NS_OK; 1.101 +} 1.102 + 1.103 +NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowDataSource) 1.104 + 1.105 +NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsWindowDataSource) 1.106 +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowDataSource) 1.107 + // XXX mContainer? 1.108 + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInner) 1.109 +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END 1.110 + 1.111 +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsWindowDataSource) 1.112 +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsWindowDataSource) 1.113 + 1.114 +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowDataSource) 1.115 + NS_INTERFACE_MAP_ENTRY(nsIObserver) 1.116 + NS_INTERFACE_MAP_ENTRY(nsIWindowMediatorListener) 1.117 + NS_INTERFACE_MAP_ENTRY(nsIWindowDataSource) 1.118 + NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource) 1.119 + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) 1.120 +NS_INTERFACE_MAP_END 1.121 + 1.122 +// nsIWindowMediatorListener implementation 1.123 +// handle notifications from the window mediator and reflect them into 1.124 +// RDF 1.125 + 1.126 +/* void onWindowTitleChange (in nsIXULWindow window, in wstring newTitle); */ 1.127 +NS_IMETHODIMP 1.128 +nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window, 1.129 + const char16_t *newTitle) 1.130 +{ 1.131 + nsresult rv; 1.132 + 1.133 + nsCOMPtr<nsIRDFResource> windowResource; 1.134 + mWindowResources.Get(window, getter_AddRefs(windowResource)); 1.135 + 1.136 + // oops, make sure this window is in the hashtable! 1.137 + if (!windowResource) { 1.138 + OnOpenWindow(window); 1.139 + mWindowResources.Get(window, getter_AddRefs(windowResource)); 1.140 + } 1.141 + 1.142 + NS_ENSURE_TRUE(windowResource, NS_ERROR_UNEXPECTED); 1.143 + 1.144 + nsCOMPtr<nsIRDFLiteral> newTitleLiteral; 1.145 + rv = gRDFService->GetLiteral(newTitle, getter_AddRefs(newTitleLiteral)); 1.146 + NS_ENSURE_SUCCESS(rv, rv); 1.147 + 1.148 + // get the old title 1.149 + nsCOMPtr<nsIRDFNode> oldTitleNode; 1.150 + rv = GetTarget(windowResource, kNC_Name, true, 1.151 + getter_AddRefs(oldTitleNode)); 1.152 + 1.153 + // assert the change 1.154 + if (NS_SUCCEEDED(rv) && oldTitleNode) 1.155 + // has an existing window title, update it 1.156 + rv = Change(windowResource, kNC_Name, oldTitleNode, newTitleLiteral); 1.157 + else 1.158 + // removed from the tasklist 1.159 + rv = Assert(windowResource, kNC_Name, newTitleLiteral, true); 1.160 + 1.161 + if (rv != NS_RDF_ASSERTION_ACCEPTED) 1.162 + { 1.163 + NS_ERROR("unable to set window name"); 1.164 + } 1.165 + 1.166 + return NS_OK; 1.167 +} 1.168 + 1.169 +/* void onOpenWindow (in nsIXULWindow window); */ 1.170 +NS_IMETHODIMP 1.171 +nsWindowDataSource::OnOpenWindow(nsIXULWindow *window) 1.172 +{ 1.173 + nsAutoCString windowId(NS_LITERAL_CSTRING("window-")); 1.174 + windowId.AppendInt(windowCount++, 10); 1.175 + 1.176 + nsCOMPtr<nsIRDFResource> windowResource; 1.177 + gRDFService->GetResource(windowId, getter_AddRefs(windowResource)); 1.178 + 1.179 + mWindowResources.Put(window, windowResource); 1.180 + 1.181 + // assert the new window 1.182 + if (mContainer) 1.183 + mContainer->AppendElement(windowResource); 1.184 + 1.185 + return NS_OK; 1.186 +} 1.187 + 1.188 +/* void onCloseWindow (in nsIXULWindow window); */ 1.189 +NS_IMETHODIMP 1.190 +nsWindowDataSource::OnCloseWindow(nsIXULWindow *window) 1.191 +{ 1.192 + nsresult rv; 1.193 + nsCOMPtr<nsIRDFResource> resource; 1.194 + mWindowResources.Get(window, getter_AddRefs(resource)); 1.195 + if (!resource) { 1.196 + return NS_ERROR_UNEXPECTED; 1.197 + } 1.198 + 1.199 + mWindowResources.Remove(window); 1.200 + 1.201 + // make sure we're not shutting down 1.202 + if (!mContainer) return NS_OK; 1.203 + 1.204 + nsCOMPtr<nsIRDFNode> oldKeyNode; 1.205 + nsCOMPtr<nsIRDFInt> oldKeyInt; 1.206 + 1.207 + // get the old keyIndex, if any 1.208 + rv = GetTarget(resource, kNC_KeyIndex, true, 1.209 + getter_AddRefs(oldKeyNode)); 1.210 + if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) 1.211 + oldKeyInt = do_QueryInterface(oldKeyNode); 1.212 + 1.213 + 1.214 + // update RDF and keyindex - from this point forward we'll ignore 1.215 + // errors, because they just indicate some kind of RDF inconsistency 1.216 + int32_t winIndex = -1; 1.217 + rv = mContainer->IndexOf(resource, &winIndex); 1.218 + 1.219 + if (NS_FAILED(rv)) 1.220 + return NS_OK; 1.221 + 1.222 + // unassert the old window, ignore any error 1.223 + mContainer->RemoveElement(resource, true); 1.224 + 1.225 + nsCOMPtr<nsISimpleEnumerator> children; 1.226 + rv = mContainer->GetElements(getter_AddRefs(children)); 1.227 + if (NS_FAILED(rv)) 1.228 + return NS_OK; 1.229 + 1.230 + bool more = false; 1.231 + 1.232 + while (NS_SUCCEEDED(rv = children->HasMoreElements(&more)) && more) { 1.233 + nsCOMPtr<nsISupports> sup; 1.234 + rv = children->GetNext(getter_AddRefs(sup)); 1.235 + if (NS_FAILED(rv)) 1.236 + break; 1.237 + 1.238 + nsCOMPtr<nsIRDFResource> windowResource = do_QueryInterface(sup, &rv); 1.239 + if (NS_FAILED(rv)) 1.240 + continue; 1.241 + 1.242 + int32_t currentIndex = -1; 1.243 + mContainer->IndexOf(windowResource, ¤tIndex); 1.244 + 1.245 + // can skip updating windows with lower indexes 1.246 + // than the window that was removed 1.247 + if (currentIndex < winIndex) 1.248 + continue; 1.249 + 1.250 + nsCOMPtr<nsIRDFNode> newKeyNode; 1.251 + nsCOMPtr<nsIRDFInt> newKeyInt; 1.252 + 1.253 + rv = GetTarget(windowResource, kNC_KeyIndex, true, 1.254 + getter_AddRefs(newKeyNode)); 1.255 + if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) 1.256 + newKeyInt = do_QueryInterface(newKeyNode); 1.257 + 1.258 + // changing from one key index to another 1.259 + if (oldKeyInt && newKeyInt) 1.260 + Change(windowResource, kNC_KeyIndex, oldKeyInt, newKeyInt); 1.261 + // creating a new keyindex - probably window going 1.262 + // from (none) to "9" 1.263 + else if (newKeyInt) 1.264 + Assert(windowResource, kNC_KeyIndex, newKeyInt, true); 1.265 + 1.266 + // somehow inserting a window above this one, 1.267 + // "9" to (none) 1.268 + else if (oldKeyInt) 1.269 + Unassert(windowResource, kNC_KeyIndex, oldKeyInt); 1.270 + 1.271 + } 1.272 + return NS_OK; 1.273 +} 1.274 + 1.275 +struct findWindowClosure { 1.276 + nsIRDFResource* targetResource; 1.277 + nsIXULWindow *resultWindow; 1.278 +}; 1.279 + 1.280 +static PLDHashOperator 1.281 +findWindow(nsIXULWindow* aWindow, nsIRDFResource* aResource, void* aClosure) 1.282 +{ 1.283 + findWindowClosure* closure = static_cast<findWindowClosure*>(aClosure); 1.284 + 1.285 + if (aResource == closure->targetResource) { 1.286 + closure->resultWindow = aWindow; 1.287 + return PL_DHASH_STOP; 1.288 + } 1.289 + return PL_DHASH_NEXT; 1.290 +} 1.291 + 1.292 +// nsIWindowDataSource implementation 1.293 + 1.294 +NS_IMETHODIMP 1.295 +nsWindowDataSource::GetWindowForResource(const char *aResourceString, 1.296 + nsIDOMWindow** aResult) 1.297 +{ 1.298 + nsCOMPtr<nsIRDFResource> windowResource; 1.299 + gRDFService->GetResource(nsDependentCString(aResourceString), 1.300 + getter_AddRefs(windowResource)); 1.301 + 1.302 + // now reverse-lookup in the hashtable 1.303 + findWindowClosure closure = { windowResource.get(), nullptr }; 1.304 + mWindowResources.EnumerateRead(findWindow, &closure); 1.305 + if (closure.resultWindow) { 1.306 + 1.307 + // this sucks, we have to jump through docshell to go from 1.308 + // nsIXULWindow -> nsIDOMWindow 1.309 + nsCOMPtr<nsIDocShell> docShell; 1.310 + closure.resultWindow->GetDocShell(getter_AddRefs(docShell)); 1.311 + 1.312 + if (docShell) { 1.313 + nsCOMPtr<nsIDOMWindow> result = do_GetInterface(docShell); 1.314 + 1.315 + *aResult = result; 1.316 + NS_IF_ADDREF(*aResult); 1.317 + } 1.318 + } 1.319 + 1.320 + return NS_OK; 1.321 +} 1.322 + 1.323 + 1.324 +// nsIRDFDataSource implementation 1.325 +// mostly, we just forward to mInner, except: 1.326 +// GetURI() - need to return "rdf:window-mediator" 1.327 +// GetTarget() - need to handle kNC_KeyIndex 1.328 + 1.329 + 1.330 +/* readonly attribute string URI; */ 1.331 +NS_IMETHODIMP nsWindowDataSource::GetURI(char * *aURI) 1.332 +{ 1.333 + NS_ENSURE_ARG_POINTER(aURI); 1.334 + 1.335 + *aURI = ToNewCString(NS_LITERAL_CSTRING("rdf:window-mediator")); 1.336 + 1.337 + if (!*aURI) 1.338 + return NS_ERROR_OUT_OF_MEMORY; 1.339 + 1.340 + return NS_OK; 1.341 +} 1.342 + 1.343 +/* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */ 1.344 +NS_IMETHODIMP nsWindowDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsIRDFNode **_retval) 1.345 +{ 1.346 + NS_ENSURE_ARG_POINTER(_retval); 1.347 + 1.348 + // add extra nullptr checking for top-crash bug # 146466 1.349 + if (!gRDFService) return NS_RDF_NO_VALUE; 1.350 + if (!mInner) return NS_RDF_NO_VALUE; 1.351 + if (!mContainer) return NS_RDF_NO_VALUE; 1.352 + // special case kNC_KeyIndex before we forward to mInner 1.353 + if (aProperty == kNC_KeyIndex) { 1.354 + 1.355 + int32_t theIndex = 0; 1.356 + nsresult rv = mContainer->IndexOf(aSource, &theIndex); 1.357 + if (NS_FAILED(rv)) return rv; 1.358 + 1.359 + // only allow the range of 1 to 9 for single key access 1.360 + if (theIndex < 1 || theIndex > 9) return(NS_RDF_NO_VALUE); 1.361 + 1.362 + nsCOMPtr<nsIRDFInt> indexInt; 1.363 + rv = gRDFService->GetIntLiteral(theIndex, getter_AddRefs(indexInt)); 1.364 + if (NS_FAILED(rv)) return(rv); 1.365 + if (!indexInt) return(NS_ERROR_FAILURE); 1.366 + 1.367 + return CallQueryInterface(indexInt, _retval); 1.368 + } 1.369 + 1.370 + return mInner->GetTarget(aSource, aProperty, aTruthValue, _retval); 1.371 +} 1.372 + 1.373 +/* nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ 1.374 +NS_IMETHODIMP nsWindowDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsIRDFResource **_retval) 1.375 +{ 1.376 + if (mInner) 1.377 + return mInner->GetSource(aProperty, aTarget, aTruthValue, _retval); 1.378 + return NS_OK; 1.379 +} 1.380 + 1.381 +/* nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ 1.382 +NS_IMETHODIMP nsWindowDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, nsISimpleEnumerator **_retval) 1.383 +{ 1.384 + if (mInner) 1.385 + return mInner->GetSources(aProperty, aTarget, aTruthValue, _retval); 1.386 + return NS_OK; 1.387 +} 1.388 + 1.389 +/* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */ 1.390 +NS_IMETHODIMP nsWindowDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool aTruthValue, nsISimpleEnumerator **_retval) 1.391 +{ 1.392 + if (mInner) 1.393 + return mInner->GetTargets(aSource, aProperty, aTruthValue, _retval); 1.394 + return NS_OK; 1.395 +} 1.396 + 1.397 +/* void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ 1.398 +NS_IMETHODIMP nsWindowDataSource::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue) 1.399 +{ 1.400 + if (mInner) 1.401 + return mInner->Assert(aSource, aProperty, aTarget, aTruthValue); 1.402 + return NS_OK; 1.403 +} 1.404 + 1.405 +/* void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */ 1.406 +NS_IMETHODIMP nsWindowDataSource::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget) 1.407 +{ 1.408 + if (mInner) 1.409 + return mInner->Unassert(aSource, aProperty, aTarget); 1.410 + return NS_OK; 1.411 +} 1.412 + 1.413 +/* void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget); */ 1.414 +NS_IMETHODIMP nsWindowDataSource::Change(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aOldTarget, nsIRDFNode *aNewTarget) 1.415 +{ 1.416 + if (mInner) 1.417 + return mInner->Change(aSource, aProperty, aOldTarget, aNewTarget); 1.418 + return NS_OK; 1.419 +} 1.420 + 1.421 +/* void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget); */ 1.422 +NS_IMETHODIMP nsWindowDataSource::Move(nsIRDFResource *aOldSource, nsIRDFResource *aNewSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget) 1.423 +{ 1.424 + if (mInner) 1.425 + return mInner->Move(aOldSource, aNewSource, aProperty, aTarget); 1.426 + return NS_OK; 1.427 +} 1.428 + 1.429 +/* boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */ 1.430 +NS_IMETHODIMP nsWindowDataSource::HasAssertion(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, bool aTruthValue, bool *_retval) 1.431 +{ 1.432 + if (mInner) 1.433 + return mInner->HasAssertion(aSource, aProperty, aTarget, aTruthValue, _retval); 1.434 + return NS_OK; 1.435 +} 1.436 + 1.437 +/* void AddObserver (in nsIRDFObserver aObserver); */ 1.438 +NS_IMETHODIMP nsWindowDataSource::AddObserver(nsIRDFObserver *aObserver) 1.439 +{ 1.440 + if (mInner) 1.441 + return mInner->AddObserver(aObserver); 1.442 + return NS_OK; 1.443 +} 1.444 + 1.445 +/* void RemoveObserver (in nsIRDFObserver aObserver); */ 1.446 +NS_IMETHODIMP nsWindowDataSource::RemoveObserver(nsIRDFObserver *aObserver) 1.447 +{ 1.448 + if (mInner) 1.449 + return mInner->RemoveObserver(aObserver); 1.450 + return NS_OK; 1.451 +} 1.452 + 1.453 +/* nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode); */ 1.454 +NS_IMETHODIMP nsWindowDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval) 1.455 +{ 1.456 + if (mInner) 1.457 + return mInner->ArcLabelsIn(aNode, _retval); 1.458 + return NS_OK; 1.459 +} 1.460 + 1.461 +/* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */ 1.462 +NS_IMETHODIMP nsWindowDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval) 1.463 +{ 1.464 + if (mInner) 1.465 + return mInner->ArcLabelsOut(aSource, _retval); 1.466 + return NS_OK; 1.467 +} 1.468 + 1.469 +/* nsISimpleEnumerator GetAllResources (); */ 1.470 +NS_IMETHODIMP nsWindowDataSource::GetAllResources(nsISimpleEnumerator **_retval) 1.471 +{ 1.472 + if (mInner) 1.473 + return mInner->GetAllResources(_retval); 1.474 + return NS_OK; 1.475 +} 1.476 + 1.477 +/* boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */ 1.478 +NS_IMETHODIMP nsWindowDataSource::IsCommandEnabled(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, bool *_retval) 1.479 +{ 1.480 + if (mInner) 1.481 + return mInner->IsCommandEnabled(aSources, aCommand, aArguments, _retval); 1.482 + return NS_OK; 1.483 +} 1.484 + 1.485 +/* void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments); */ 1.486 +NS_IMETHODIMP nsWindowDataSource::DoCommand(nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments) 1.487 +{ 1.488 + if (mInner) 1.489 + return mInner->DoCommand(aSources, aCommand, aArguments); 1.490 + return NS_OK; 1.491 +} 1.492 + 1.493 +/* nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource); */ 1.494 +NS_IMETHODIMP nsWindowDataSource::GetAllCmds(nsIRDFResource *aSource, nsISimpleEnumerator **_retval) 1.495 +{ 1.496 + if (mInner) 1.497 + return mInner->GetAllCmds(aSource, _retval); 1.498 + return NS_OK; 1.499 +} 1.500 + 1.501 +/* boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc); */ 1.502 +NS_IMETHODIMP nsWindowDataSource::HasArcIn(nsIRDFNode *aNode, nsIRDFResource *aArc, bool *_retval) 1.503 +{ 1.504 + if (mInner) 1.505 + return mInner->HasArcIn(aNode, aArc, _retval); 1.506 + return NS_OK; 1.507 +} 1.508 + 1.509 +/* boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc); */ 1.510 +NS_IMETHODIMP nsWindowDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, bool *_retval) 1.511 +{ 1.512 + if (mInner) 1.513 + return mInner->HasArcOut(aSource, aArc, _retval); 1.514 + return NS_OK; 1.515 +} 1.516 + 1.517 +/* void beginUpdateBatch (); */ 1.518 +NS_IMETHODIMP nsWindowDataSource::BeginUpdateBatch() 1.519 +{ 1.520 + if (mInner) 1.521 + return mInner->BeginUpdateBatch(); 1.522 + return NS_OK; 1.523 +} 1.524 + 1.525 +/* void endUpdateBatch (); */ 1.526 +NS_IMETHODIMP nsWindowDataSource::EndUpdateBatch() 1.527 +{ 1.528 + if (mInner) 1.529 + return mInner->EndUpdateBatch(); 1.530 + return NS_OK; 1.531 +} 1.532 + 1.533 +// The module goop 1.534 + 1.535 +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowDataSource, Init) 1.536 + 1.537 +NS_DEFINE_NAMED_CID(NS_WINDOWDATASOURCE_CID); 1.538 + 1.539 +static const mozilla::Module::CIDEntry kWindowDSCIDs[] = { 1.540 + { &kNS_WINDOWDATASOURCE_CID, false, nullptr, nsWindowDataSourceConstructor }, 1.541 + { nullptr } 1.542 +}; 1.543 + 1.544 +static const mozilla::Module::ContractIDEntry kWindowDSContracts[] = { 1.545 + { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", &kNS_WINDOWDATASOURCE_CID }, 1.546 + { nullptr } 1.547 +}; 1.548 + 1.549 +static const mozilla::Module::CategoryEntry kWindowDSCategories[] = { 1.550 + { "app-startup", "Window Data Source", "service," NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator" }, 1.551 + { nullptr } 1.552 +}; 1.553 + 1.554 +static const mozilla::Module kWindowDSModule = { 1.555 + mozilla::Module::kVersion, 1.556 + kWindowDSCIDs, 1.557 + kWindowDSContracts, 1.558 + kWindowDSCategories 1.559 +}; 1.560 + 1.561 +NSMODULE_DEFN(nsWindowDataSourceModule) = &kWindowDSModule;