From a7e76cba1e5ec57dd64cc583c133fabc43ea45b1 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Tue, 21 Mar 2000 11:57:39 +0000 Subject: [PATCH] Adding support for UI display of installed skins and locales. git-svn-id: svn://10.0.0.236/trunk@63565 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/chrome/src/nsChromeFactory.cpp | 25 -- mozilla/chrome/src/nsChromeRegistry.cpp | 16 +- mozilla/chrome/src/nsChromeRegistry.h | 2 + mozilla/chrome/src/nsChromeUIDataSource.cpp | 395 ++++++++++++++++++ mozilla/chrome/src/nsChromeUIDataSource.h | 59 +++ mozilla/rdf/chrome/build/nsChromeFactory.cpp | 25 -- mozilla/rdf/chrome/public/Makefile.in | 1 - mozilla/rdf/chrome/public/makefile.win | 1 - mozilla/rdf/chrome/public/nsIChromeEntry.idl | 47 --- mozilla/rdf/chrome/src/Makefile.in | 2 +- mozilla/rdf/chrome/src/makefile.win | 4 +- mozilla/rdf/chrome/src/nsChromeEntry.cpp | 95 ----- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 16 +- mozilla/rdf/chrome/src/nsChromeRegistry.h | 2 + .../rdf/chrome/src/nsChromeUIDataSource.cpp | 395 ++++++++++++++++++ mozilla/rdf/chrome/src/nsChromeUIDataSource.h | 59 +++ 16 files changed, 945 insertions(+), 199 deletions(-) create mode 100644 mozilla/chrome/src/nsChromeUIDataSource.cpp create mode 100644 mozilla/chrome/src/nsChromeUIDataSource.h delete mode 100644 mozilla/rdf/chrome/public/nsIChromeEntry.idl delete mode 100644 mozilla/rdf/chrome/src/nsChromeEntry.cpp create mode 100644 mozilla/rdf/chrome/src/nsChromeUIDataSource.cpp create mode 100644 mozilla/rdf/chrome/src/nsChromeUIDataSource.h diff --git a/mozilla/chrome/src/nsChromeFactory.cpp b/mozilla/chrome/src/nsChromeFactory.cpp index 4e3bd4d2e1f..3b0d7d6de0a 100644 --- a/mozilla/chrome/src/nsChromeFactory.cpp +++ b/mozilla/chrome/src/nsChromeFactory.cpp @@ -27,7 +27,6 @@ #include "nsIServiceManager.h" #include "nsIComponentManager.h" #include "nsIChromeRegistry.h" -#include "nsIChromeEntry.h" #include "nscore.h" #include "rdf.h" #include "nsChromeProtocolHandler.h" @@ -49,24 +48,6 @@ NS_ConstructChromeRegistry(nsISupports *aOuter, REFNSIID aIID, void **aResult) return rv; } -static NS_IMETHODIMP -NS_ConstructChromeEntry(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - NS_ASSERTION(aOuter == nsnull, "no aggregation"); - nsIChromeEntry* chromeEntry; - rv = NS_NewChromeEntry(&chromeEntry); - if (NS_FAILED(rv)) { - NS_ERROR("Unable to construct chrome entry"); - return rv; - } - rv = chromeEntry->QueryInterface(aIID, aResult); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface"); - NS_RELEASE(chromeEntry); - return rv; -} - - // The list of components we register static nsModuleComponentInfo components[] = { @@ -76,12 +57,6 @@ static nsModuleComponentInfo components[] = NS_ConstructChromeRegistry }, - { "Chrome Entry", - NS_CHROMEENTRY_CID, - "component://netscape/chrome/chrome-entry", - NS_ConstructChromeEntry - }, - { "Chrome Protocol Handler", NS_CHROMEPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_PROGID_PREFIX "chrome", diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index 5a3aca8122a..365adb2b2d0 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -27,6 +27,7 @@ #include "nsSpecialSystemDirectory.h" #include "nsIChromeRegistry.h" #include "nsChromeRegistry.h" +#include "nsChromeUIDataSource.h" #include "nsIRDFDataSource.h" #include "nsIRDFObserver.h" #include "nsIRDFRemoteDataSource.h" @@ -201,7 +202,12 @@ nsChromeRegistry::nsChromeRegistry() nsChromeRegistry::~nsChromeRegistry() { delete mDataSourceTable; - + + if (mUIDataSource) { + mRDFService->UnregisterDataSource(mUIDataSource); + mUIDataSource = nsnull; + } + if (mRDFService) { nsServiceManager::ReleaseService(kRDFServiceCID, mRDFService); mRDFService = nsnull; @@ -1360,6 +1366,14 @@ nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile) getter_AddRefs(mChromeDataSource)); if (NS_FAILED(rv)) return rv; + + // Also create and hold on to our UI data source. + if (mUIDataSource) { + mRDFService->UnregisterDataSource(mUIDataSource); + mUIDataSource = nsnull; + } + NS_NewChromeUIDataSource(mChromeDataSource, getter_AddRefs(mUIDataSource)); + mRDFService->RegisterDataSource(mUIDataSource, PR_FALSE); } if (aUseProfile) { diff --git a/mozilla/chrome/src/nsChromeRegistry.h b/mozilla/chrome/src/nsChromeRegistry.h index b4966dfcbbb..51bcd338381 100644 --- a/mozilla/chrome/src/nsChromeRegistry.h +++ b/mozilla/chrome/src/nsChromeRegistry.h @@ -109,6 +109,8 @@ protected: nsCAutoString mInstallRoot; nsCOMPtr mChromeDataSource; + nsCOMPtr mUIDataSource; + nsSupportsHashtable* mDataSourceTable; nsIRDFService* mRDFService; diff --git a/mozilla/chrome/src/nsChromeUIDataSource.cpp b/mozilla/chrome/src/nsChromeUIDataSource.cpp new file mode 100644 index 00000000000..d6cb3b27f9c --- /dev/null +++ b/mozilla/chrome/src/nsChromeUIDataSource.cpp @@ -0,0 +1,395 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Original Author: David W. Hyatt (hyatt@netscape.com) + * + * Contributor(s): + */ + +#include "nsCOMPtr.h" +#include "nsChromeUIDataSource.h" +#include "nsIRDFDataSource.h" +#include "nsIRDFObserver.h" +#include "nsIRDFRemoteDataSource.h" +#include "nsCRT.h" +#include "rdf.h" +#include "nsIServiceManager.h" +#include "nsIRDFService.h" +#include "nsRDFCID.h" +#include "nsIRDFResource.h" +#include "nsIRDFDataSource.h" +#include "nsIRDFContainer.h" +#include "nsHashtable.h" +#include "nsString.h" +#include "nsXPIDLString.h" +#include "nsISimpleEnumerator.h" +#include "nsNetUtil.h" +#include "nsISupportsArray.h" +#include "nsIIOService.h" +#include "nsIResProtocolHandler.h" + +//////////////////////////////////////////////////////////////////////////////// + +nsChromeUIDataSource::nsChromeUIDataSource(nsIRDFDataSource* aComposite) +{ + NS_INIT_REFCNT(); + mComposite = aComposite; + mComposite->AddObserver(this); +} + +nsChromeUIDataSource::~nsChromeUIDataSource() +{ + mComposite->RemoveObserver(this); +} + +NS_IMPL_ISUPPORTS2(nsChromeUIDataSource, nsIRDFDataSource, nsIRDFObserver); + + +//---------------------------------------------------------------------- +// +// nsIRDFDataSource interface +// + +NS_IMETHODIMP +nsChromeUIDataSource::GetURI(char** aURI) +{ + *aURI = nsXPIDLCString::Copy("rdf:chrome"); + if (! *aURI) + return NS_ERROR_OUT_OF_MEMORY; + + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetSource(nsIRDFResource* property, + nsIRDFNode* target, + PRBool tv, + nsIRDFResource** source) +{ + return mComposite->GetSource(property, target, tv, source); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetSources(nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue, + nsISimpleEnumerator** aResult) +{ + return mComposite->GetSources(aProperty, aTarget, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetTarget(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + PRBool aTruthValue, + nsIRDFNode** aResult) +{ + return mComposite->GetTarget(aSource, aProperty, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetTargets(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + PRBool aTruthValue, + nsISimpleEnumerator** aResult) +{ + return mComposite->GetTargets(aSource, aProperty, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::Assert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue) +{ + nsresult rv = mComposite->Assert(aSource, aProperty, aTarget, aTruthValue); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnAssert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Unassert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + nsresult rv = mComposite->Unassert(aSource, aProperty, aTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnUnassert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Change(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aOldTarget, + nsIRDFNode* aNewTarget) +{ + nsresult rv = mComposite->Change(aSource, aProperty, aOldTarget, aNewTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnChange(aSource, aProperty, aOldTarget, aNewTarget); + NS_RELEASE(obs); + } + } + + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Move(nsIRDFResource* aOldSource, + nsIRDFResource* aNewSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + nsresult rv = mComposite->Move(aOldSource, aNewSource, aProperty, aTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnMove(aOldSource, aNewSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::HasAssertion(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue, + PRBool* aResult) +{ + return mComposite->HasAssertion(aSource, aProperty, aTarget, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::AddObserver(nsIRDFObserver* aObserver) +{ + NS_PRECONDITION(aObserver != nsnull, "null ptr"); + if (! aObserver) + return NS_ERROR_NULL_POINTER; + + if (!mObservers) { + nsresult rv; + rv = NS_NewISupportsArray(getter_AddRefs(mObservers)); + if (NS_FAILED(rv)) return rv; + } + + // XXX ensure uniqueness? + + mObservers->AppendElement(aObserver); + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::RemoveObserver(nsIRDFObserver* aObserver) +{ + NS_PRECONDITION(aObserver != nsnull, "null ptr"); + if (! aObserver) + return NS_ERROR_NULL_POINTER; + + if (!mObservers) + return NS_OK; + + mObservers->RemoveElement(aObserver); + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::ArcLabelsIn(nsIRDFNode* aTarget, nsISimpleEnumerator** aResult) +{ + return mComposite->ArcLabelsIn(aTarget, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::ArcLabelsOut(nsIRDFResource* aSource, + nsISimpleEnumerator** aResult) +{ + return mComposite->ArcLabelsOut(aSource, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllResources(nsISimpleEnumerator** aResult) +{ + return mComposite->GetAllResources(aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllCommands(nsIRDFResource* source, + nsIEnumerator/**/** result) +{ + return mComposite->GetAllCommands(source, result); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllCmds(nsIRDFResource* source, + nsISimpleEnumerator/**/** result) +{ + return mComposite->GetAllCmds(source, result); +} + +NS_IMETHODIMP +nsChromeUIDataSource::IsCommandEnabled(nsISupportsArray/**/* aSources, + nsIRDFResource* aCommand, + nsISupportsArray/**/* aArguments, + PRBool* aResult) +{ + return mComposite->IsCommandEnabled(aSources, aCommand, aArguments, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::DoCommand(nsISupportsArray/**/* aSources, + nsIRDFResource* aCommand, + nsISupportsArray/**/* aArguments) +{ + return mComposite->DoCommand(aSources, aCommand, aArguments); +} + +////////////////////////////////////////////////////////////////////// + +NS_IMETHODIMP +nsChromeUIDataSource::OnAssert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnAssert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::OnUnassert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnUnassert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::OnChange(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aOldTarget, + nsIRDFNode* aNewTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnChange(aSource, aProperty, aOldTarget, aNewTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::OnMove(nsIRDFResource* aOldSource, + nsIRDFResource* aNewSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnMove(aOldSource, aNewSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +nsresult +NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult) +{ + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) + return NS_ERROR_NULL_POINTER; + + nsChromeUIDataSource* ChromeUIDataSource = new nsChromeUIDataSource(aComposite); + if (ChromeUIDataSource == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(ChromeUIDataSource); + *aResult = ChromeUIDataSource; + return NS_OK; +} diff --git a/mozilla/chrome/src/nsChromeUIDataSource.h b/mozilla/chrome/src/nsChromeUIDataSource.h new file mode 100644 index 00000000000..380ed10af1f --- /dev/null +++ b/mozilla/chrome/src/nsChromeUIDataSource.h @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * + * Original Author: David W. Hyatt (hyatt@netscape.com) + * + * Contributor(s): + */ + +class nsIRDFService; +class nsIRDFDataSource; +class nsIRDFResource; +class nsICSSLoader; +class nsISimpleEnumerator; +class nsSupportsHashtable; +class nsIRDFContainer; +class nsIDOMWindow; +class nsIDocument; + +#include "nsIRDFDataSource.h" +#include "nsIRDFObserver.h" + +class nsChromeUIDataSource : public nsIRDFDataSource, public nsIRDFObserver +{ +public: + NS_DECL_ISUPPORTS + + // nsIRDFDataSource methods + NS_DECL_NSIRDFDATASOURCE + + // nsIRDFObserver methods + NS_DECL_NSIRDFOBSERVER + + // nsChromeUIDataSource methods: + nsChromeUIDataSource(nsIRDFDataSource* aComposite); + virtual ~nsChromeUIDataSource(); + +protected: + nsCOMPtr mComposite; + nsCOMPtr mObservers; +}; + +nsresult NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult); \ No newline at end of file diff --git a/mozilla/rdf/chrome/build/nsChromeFactory.cpp b/mozilla/rdf/chrome/build/nsChromeFactory.cpp index 4e3bd4d2e1f..3b0d7d6de0a 100644 --- a/mozilla/rdf/chrome/build/nsChromeFactory.cpp +++ b/mozilla/rdf/chrome/build/nsChromeFactory.cpp @@ -27,7 +27,6 @@ #include "nsIServiceManager.h" #include "nsIComponentManager.h" #include "nsIChromeRegistry.h" -#include "nsIChromeEntry.h" #include "nscore.h" #include "rdf.h" #include "nsChromeProtocolHandler.h" @@ -49,24 +48,6 @@ NS_ConstructChromeRegistry(nsISupports *aOuter, REFNSIID aIID, void **aResult) return rv; } -static NS_IMETHODIMP -NS_ConstructChromeEntry(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - NS_ASSERTION(aOuter == nsnull, "no aggregation"); - nsIChromeEntry* chromeEntry; - rv = NS_NewChromeEntry(&chromeEntry); - if (NS_FAILED(rv)) { - NS_ERROR("Unable to construct chrome entry"); - return rv; - } - rv = chromeEntry->QueryInterface(aIID, aResult); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface"); - NS_RELEASE(chromeEntry); - return rv; -} - - // The list of components we register static nsModuleComponentInfo components[] = { @@ -76,12 +57,6 @@ static nsModuleComponentInfo components[] = NS_ConstructChromeRegistry }, - { "Chrome Entry", - NS_CHROMEENTRY_CID, - "component://netscape/chrome/chrome-entry", - NS_ConstructChromeEntry - }, - { "Chrome Protocol Handler", NS_CHROMEPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_PROGID_PREFIX "chrome", diff --git a/mozilla/rdf/chrome/public/Makefile.in b/mozilla/rdf/chrome/public/Makefile.in index 0c918a36e8f..b90ca0c804c 100644 --- a/mozilla/rdf/chrome/public/Makefile.in +++ b/mozilla/rdf/chrome/public/Makefile.in @@ -31,7 +31,6 @@ XPIDL_MODULE= chrome XPIDLSRCS = \ nsIChromeRegistry.idl \ - nsIChromeEntry.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/rdf/chrome/public/makefile.win b/mozilla/rdf/chrome/public/makefile.win index 9c82f003f51..cb9b18a6440 100644 --- a/mozilla/rdf/chrome/public/makefile.win +++ b/mozilla/rdf/chrome/public/makefile.win @@ -25,7 +25,6 @@ XPIDL_MODULE=chrome XPIDLSRCS = \ .\nsIChromeRegistry.idl \ - .\nsIChromeEntry.idl \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/rdf/chrome/public/nsIChromeEntry.idl b/mozilla/rdf/chrome/public/nsIChromeEntry.idl deleted file mode 100644 index 676b70a6255..00000000000 --- a/mozilla/rdf/chrome/public/nsIChromeEntry.idl +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Mozilla browser. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): hyatt and pav :) - */ - -#include "nsISupports.idl" -#include "nsIEnumerator.idl" - -[scriptable, uuid(C0E45041-A6C6-11d3-97FB-00400553EEF0)] -interface nsIChromeEntry : nsISupports -{ - attribute wstring path; - attribute wstring name; - attribute wstring version; - attribute wstring author; - attribute wstring siteURL; - attribute wstring previewImageURL; - attribute nsISimpleEnumerator packages; -}; - -%{ C++ - -// {96CF5BC2-A715-11d3-97FB-00400553EEF0} -#define NS_CHROMEENTRY_CID \ -{ 0x96cf5bc2, 0xa715, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } } - -extern nsresult -NS_NewChromeEntry(nsIChromeEntry** aResult); - -%} diff --git a/mozilla/rdf/chrome/src/Makefile.in b/mozilla/rdf/chrome/src/Makefile.in index 81092f0fd42..ab561183d30 100644 --- a/mozilla/rdf/chrome/src/Makefile.in +++ b/mozilla/rdf/chrome/src/Makefile.in @@ -33,7 +33,7 @@ REQUIRES = chrome netlib rdf rdfutil raptor xpcom CPPSRCS = \ nsChromeRegistry.cpp \ - nsChromeEntry.cpp \ + nsChromeUIDataSource.cpp \ nsChromeProtocolHandler.cpp \ $(NULL) diff --git a/mozilla/rdf/chrome/src/makefile.win b/mozilla/rdf/chrome/src/makefile.win index f84fe1184ab..36fa40535e0 100644 --- a/mozilla/rdf/chrome/src/makefile.win +++ b/mozilla/rdf/chrome/src/makefile.win @@ -25,8 +25,8 @@ LIBRARY_NAME=chrome_s CPP_OBJS=\ .\$(OBJDIR)\nsChromeRegistry.obj \ - .\$(OBJDIR)\nsChromeEntry.obj \ - .\$(OBJDIR)\nsChromeProtocolHandler.obj \ + .\$(OBJDIR)\nsChromeProtocolHandler.obj \ + .\$(OBJDIR)\nsChromeUIDataSource.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/rdf/chrome/src/nsChromeEntry.cpp b/mozilla/rdf/chrome/src/nsChromeEntry.cpp deleted file mode 100644 index 8c28b89ab65..00000000000 --- a/mozilla/rdf/chrome/src/nsChromeEntry.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCOMPtr.h" -#include "nsIChromeEntry.h" - -class nsChromeEntry : public nsIChromeEntry -{ -public: - NS_DECL_ISUPPORTS - - // nsIChromeEntry methods: - NS_DECL_NSICHROMEENTRY - - // nsChromeEntry methods: - nsChromeEntry(); - virtual ~nsChromeEntry(); - -protected: - // Member vars -}; - -nsChromeEntry::nsChromeEntry() -{ - NS_INIT_REFCNT(); -} - -nsChromeEntry::~nsChromeEntry() -{} - -NS_IMPL_ISUPPORTS1(nsChromeEntry, nsIChromeEntry) - -/* attribute wstring name; */ -NS_IMETHODIMP nsChromeEntry::GetName(PRUnichar * *aName) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetName(const PRUnichar * aName) { return NS_OK; } - -/* attribute wstring Archive; */ -NS_IMETHODIMP nsChromeEntry::GetPath(PRUnichar * *aName) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetPath(const PRUnichar * aName) { return NS_OK; } - -/* attribute wstring Version; */ -NS_IMETHODIMP nsChromeEntry::GetVersion(PRUnichar * *aVersion) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetVersion(const PRUnichar * aVersion) { return NS_OK; } - -/* attribute wstring author; */ -NS_IMETHODIMP nsChromeEntry::GetAuthor(PRUnichar * *aAuthor) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetAuthor(const PRUnichar * aAuthor) { return NS_OK; } - -/* attribute wstring siteURL; */ -NS_IMETHODIMP nsChromeEntry::GetSiteURL(PRUnichar * *aSiteURL) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetSiteURL(const PRUnichar * aSiteURL) { return NS_OK; } - -/* attribute wstring previewImageURL; */ -NS_IMETHODIMP nsChromeEntry::GetPreviewImageURL(PRUnichar * *aPreviewImageURL) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetPreviewImageURL(const PRUnichar * aPreviewImageURL) { return NS_OK; } - -/* attribute nsISimpleEnumerator components; */ -NS_IMETHODIMP nsChromeEntry::GetPackages(nsISimpleEnumerator** aResult) { return NS_OK; } -NS_IMETHODIMP nsChromeEntry::SetPackages(nsISimpleEnumerator* aComponents) { return NS_OK; } - -////////////////////////////////////////////////////////////////////// - -nsresult -NS_NewChromeEntry(nsIChromeEntry** aResult) -{ - NS_PRECONDITION(aResult != nsnull, "null ptr"); - if (! aResult) - return NS_ERROR_NULL_POINTER; - - nsChromeEntry* chromeEntry = new nsChromeEntry(); - if (chromeEntry == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(chromeEntry); - *aResult = chromeEntry; - return NS_OK; -} diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index 5a3aca8122a..365adb2b2d0 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -27,6 +27,7 @@ #include "nsSpecialSystemDirectory.h" #include "nsIChromeRegistry.h" #include "nsChromeRegistry.h" +#include "nsChromeUIDataSource.h" #include "nsIRDFDataSource.h" #include "nsIRDFObserver.h" #include "nsIRDFRemoteDataSource.h" @@ -201,7 +202,12 @@ nsChromeRegistry::nsChromeRegistry() nsChromeRegistry::~nsChromeRegistry() { delete mDataSourceTable; - + + if (mUIDataSource) { + mRDFService->UnregisterDataSource(mUIDataSource); + mUIDataSource = nsnull; + } + if (mRDFService) { nsServiceManager::ReleaseService(kRDFServiceCID, mRDFService); mRDFService = nsnull; @@ -1360,6 +1366,14 @@ nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile) getter_AddRefs(mChromeDataSource)); if (NS_FAILED(rv)) return rv; + + // Also create and hold on to our UI data source. + if (mUIDataSource) { + mRDFService->UnregisterDataSource(mUIDataSource); + mUIDataSource = nsnull; + } + NS_NewChromeUIDataSource(mChromeDataSource, getter_AddRefs(mUIDataSource)); + mRDFService->RegisterDataSource(mUIDataSource, PR_FALSE); } if (aUseProfile) { diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.h b/mozilla/rdf/chrome/src/nsChromeRegistry.h index b4966dfcbbb..51bcd338381 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.h +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.h @@ -109,6 +109,8 @@ protected: nsCAutoString mInstallRoot; nsCOMPtr mChromeDataSource; + nsCOMPtr mUIDataSource; + nsSupportsHashtable* mDataSourceTable; nsIRDFService* mRDFService; diff --git a/mozilla/rdf/chrome/src/nsChromeUIDataSource.cpp b/mozilla/rdf/chrome/src/nsChromeUIDataSource.cpp new file mode 100644 index 00000000000..d6cb3b27f9c --- /dev/null +++ b/mozilla/rdf/chrome/src/nsChromeUIDataSource.cpp @@ -0,0 +1,395 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Original Author: David W. Hyatt (hyatt@netscape.com) + * + * Contributor(s): + */ + +#include "nsCOMPtr.h" +#include "nsChromeUIDataSource.h" +#include "nsIRDFDataSource.h" +#include "nsIRDFObserver.h" +#include "nsIRDFRemoteDataSource.h" +#include "nsCRT.h" +#include "rdf.h" +#include "nsIServiceManager.h" +#include "nsIRDFService.h" +#include "nsRDFCID.h" +#include "nsIRDFResource.h" +#include "nsIRDFDataSource.h" +#include "nsIRDFContainer.h" +#include "nsHashtable.h" +#include "nsString.h" +#include "nsXPIDLString.h" +#include "nsISimpleEnumerator.h" +#include "nsNetUtil.h" +#include "nsISupportsArray.h" +#include "nsIIOService.h" +#include "nsIResProtocolHandler.h" + +//////////////////////////////////////////////////////////////////////////////// + +nsChromeUIDataSource::nsChromeUIDataSource(nsIRDFDataSource* aComposite) +{ + NS_INIT_REFCNT(); + mComposite = aComposite; + mComposite->AddObserver(this); +} + +nsChromeUIDataSource::~nsChromeUIDataSource() +{ + mComposite->RemoveObserver(this); +} + +NS_IMPL_ISUPPORTS2(nsChromeUIDataSource, nsIRDFDataSource, nsIRDFObserver); + + +//---------------------------------------------------------------------- +// +// nsIRDFDataSource interface +// + +NS_IMETHODIMP +nsChromeUIDataSource::GetURI(char** aURI) +{ + *aURI = nsXPIDLCString::Copy("rdf:chrome"); + if (! *aURI) + return NS_ERROR_OUT_OF_MEMORY; + + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetSource(nsIRDFResource* property, + nsIRDFNode* target, + PRBool tv, + nsIRDFResource** source) +{ + return mComposite->GetSource(property, target, tv, source); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetSources(nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue, + nsISimpleEnumerator** aResult) +{ + return mComposite->GetSources(aProperty, aTarget, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetTarget(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + PRBool aTruthValue, + nsIRDFNode** aResult) +{ + return mComposite->GetTarget(aSource, aProperty, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetTargets(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + PRBool aTruthValue, + nsISimpleEnumerator** aResult) +{ + return mComposite->GetTargets(aSource, aProperty, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::Assert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue) +{ + nsresult rv = mComposite->Assert(aSource, aProperty, aTarget, aTruthValue); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnAssert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Unassert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + nsresult rv = mComposite->Unassert(aSource, aProperty, aTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnUnassert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Change(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aOldTarget, + nsIRDFNode* aNewTarget) +{ + nsresult rv = mComposite->Change(aSource, aProperty, aOldTarget, aNewTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnChange(aSource, aProperty, aOldTarget, aNewTarget); + NS_RELEASE(obs); + } + } + + return rv; +} + +NS_IMETHODIMP +nsChromeUIDataSource::Move(nsIRDFResource* aOldSource, + nsIRDFResource* aNewSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + nsresult rv = mComposite->Move(aOldSource, aNewSource, aProperty, aTarget); + if (mObservers) { + PRUint32 count; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnMove(aOldSource, aNewSource, aProperty, aTarget); + NS_RELEASE(obs); + } + } + return rv; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::HasAssertion(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget, + PRBool aTruthValue, + PRBool* aResult) +{ + return mComposite->HasAssertion(aSource, aProperty, aTarget, aTruthValue, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::AddObserver(nsIRDFObserver* aObserver) +{ + NS_PRECONDITION(aObserver != nsnull, "null ptr"); + if (! aObserver) + return NS_ERROR_NULL_POINTER; + + if (!mObservers) { + nsresult rv; + rv = NS_NewISupportsArray(getter_AddRefs(mObservers)); + if (NS_FAILED(rv)) return rv; + } + + // XXX ensure uniqueness? + + mObservers->AppendElement(aObserver); + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::RemoveObserver(nsIRDFObserver* aObserver) +{ + NS_PRECONDITION(aObserver != nsnull, "null ptr"); + if (! aObserver) + return NS_ERROR_NULL_POINTER; + + if (!mObservers) + return NS_OK; + + mObservers->RemoveElement(aObserver); + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::ArcLabelsIn(nsIRDFNode* aTarget, nsISimpleEnumerator** aResult) +{ + return mComposite->ArcLabelsIn(aTarget, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::ArcLabelsOut(nsIRDFResource* aSource, + nsISimpleEnumerator** aResult) +{ + return mComposite->ArcLabelsOut(aSource, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllResources(nsISimpleEnumerator** aResult) +{ + return mComposite->GetAllResources(aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllCommands(nsIRDFResource* source, + nsIEnumerator/**/** result) +{ + return mComposite->GetAllCommands(source, result); +} + +NS_IMETHODIMP +nsChromeUIDataSource::GetAllCmds(nsIRDFResource* source, + nsISimpleEnumerator/**/** result) +{ + return mComposite->GetAllCmds(source, result); +} + +NS_IMETHODIMP +nsChromeUIDataSource::IsCommandEnabled(nsISupportsArray/**/* aSources, + nsIRDFResource* aCommand, + nsISupportsArray/**/* aArguments, + PRBool* aResult) +{ + return mComposite->IsCommandEnabled(aSources, aCommand, aArguments, aResult); +} + +NS_IMETHODIMP +nsChromeUIDataSource::DoCommand(nsISupportsArray/**/* aSources, + nsIRDFResource* aCommand, + nsISupportsArray/**/* aArguments) +{ + return mComposite->DoCommand(aSources, aCommand, aArguments); +} + +////////////////////////////////////////////////////////////////////// + +NS_IMETHODIMP +nsChromeUIDataSource::OnAssert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnAssert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsChromeUIDataSource::OnUnassert(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv; + rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnUnassert(aSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::OnChange(nsIRDFResource* aSource, + nsIRDFResource* aProperty, + nsIRDFNode* aOldTarget, + nsIRDFNode* aNewTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnChange(aSource, aProperty, aOldTarget, aNewTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + + +NS_IMETHODIMP +nsChromeUIDataSource::OnMove(nsIRDFResource* aOldSource, + nsIRDFResource* aNewSource, + nsIRDFResource* aProperty, + nsIRDFNode* aTarget) +{ + if (mObservers) { + PRUint32 count; + nsresult rv = mObservers->Count(&count); + if (NS_FAILED(rv)) return rv; + + for (PRInt32 i = PRInt32(count) - 1; i >= 0; --i) { + nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); + obs->OnMove(aOldSource, aNewSource, aProperty, aTarget); + NS_RELEASE(obs); + // XXX ignore return value? + } + } + return NS_OK; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +nsresult +NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult) +{ + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) + return NS_ERROR_NULL_POINTER; + + nsChromeUIDataSource* ChromeUIDataSource = new nsChromeUIDataSource(aComposite); + if (ChromeUIDataSource == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(ChromeUIDataSource); + *aResult = ChromeUIDataSource; + return NS_OK; +} diff --git a/mozilla/rdf/chrome/src/nsChromeUIDataSource.h b/mozilla/rdf/chrome/src/nsChromeUIDataSource.h new file mode 100644 index 00000000000..380ed10af1f --- /dev/null +++ b/mozilla/rdf/chrome/src/nsChromeUIDataSource.h @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * + * Original Author: David W. Hyatt (hyatt@netscape.com) + * + * Contributor(s): + */ + +class nsIRDFService; +class nsIRDFDataSource; +class nsIRDFResource; +class nsICSSLoader; +class nsISimpleEnumerator; +class nsSupportsHashtable; +class nsIRDFContainer; +class nsIDOMWindow; +class nsIDocument; + +#include "nsIRDFDataSource.h" +#include "nsIRDFObserver.h" + +class nsChromeUIDataSource : public nsIRDFDataSource, public nsIRDFObserver +{ +public: + NS_DECL_ISUPPORTS + + // nsIRDFDataSource methods + NS_DECL_NSIRDFDATASOURCE + + // nsIRDFObserver methods + NS_DECL_NSIRDFOBSERVER + + // nsChromeUIDataSource methods: + nsChromeUIDataSource(nsIRDFDataSource* aComposite); + virtual ~nsChromeUIDataSource(); + +protected: + nsCOMPtr mComposite; + nsCOMPtr mObservers; +}; + +nsresult NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult); \ No newline at end of file