зеркало из https://github.com/mozilla/pjs.git
Adding support for UI display of installed skins and locales.
This commit is contained in:
Родитель
b452fcb4e8
Коммит
b7194c3d42
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -109,6 +109,8 @@ protected:
|
|||
nsCAutoString mInstallRoot;
|
||||
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mChromeDataSource;
|
||||
nsCOMPtr<nsIRDFDataSource> mUIDataSource;
|
||||
|
||||
nsSupportsHashtable* mDataSourceTable;
|
||||
nsIRDFService* mRDFService;
|
||||
|
||||
|
|
|
@ -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/*<nsIRDFResource>*/** result)
|
||||
{
|
||||
return mComposite->GetAllCommands(source, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::GetAllCmds(nsIRDFResource* source,
|
||||
nsISimpleEnumerator/*<nsIRDFResource>*/** result)
|
||||
{
|
||||
return mComposite->GetAllCmds(source, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments,
|
||||
PRBool* aResult)
|
||||
{
|
||||
return mComposite->IsCommandEnabled(aSources, aCommand, aArguments, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* 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;
|
||||
}
|
|
@ -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<nsIRDFDataSource> mComposite;
|
||||
nsCOMPtr<nsISupportsArray> mObservers;
|
||||
};
|
||||
|
||||
nsresult NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult);
|
|
@ -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",
|
||||
|
|
|
@ -31,7 +31,6 @@ XPIDL_MODULE= chrome
|
|||
|
||||
XPIDLSRCS = \
|
||||
nsIChromeRegistry.idl \
|
||||
nsIChromeEntry.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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):
|
||||
|
||||
DEPTH=..\..\..
|
||||
MODULE=chrome
|
||||
XPIDL_MODULE=chrome
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIChromeRegistry.idl \
|
||||
.\nsIChromeEntry.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -33,7 +33,7 @@ REQUIRES = chrome netlib rdf rdfutil raptor xpcom
|
|||
|
||||
CPPSRCS = \
|
||||
nsChromeRegistry.cpp \
|
||||
nsChromeEntry.cpp \
|
||||
nsChromeUIDataSource.cpp \
|
||||
nsChromeProtocolHandler.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -109,6 +109,8 @@ protected:
|
|||
nsCAutoString mInstallRoot;
|
||||
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mChromeDataSource;
|
||||
nsCOMPtr<nsIRDFDataSource> mUIDataSource;
|
||||
|
||||
nsSupportsHashtable* mDataSourceTable;
|
||||
nsIRDFService* mRDFService;
|
||||
|
||||
|
|
|
@ -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/*<nsIRDFResource>*/** result)
|
||||
{
|
||||
return mComposite->GetAllCommands(source, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::GetAllCmds(nsIRDFResource* source,
|
||||
nsISimpleEnumerator/*<nsIRDFResource>*/** result)
|
||||
{
|
||||
return mComposite->GetAllCmds(source, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments,
|
||||
PRBool* aResult)
|
||||
{
|
||||
return mComposite->IsCommandEnabled(aSources, aCommand, aArguments, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeUIDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* 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;
|
||||
}
|
|
@ -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<nsIRDFDataSource> mComposite;
|
||||
nsCOMPtr<nsISupportsArray> mObservers;
|
||||
};
|
||||
|
||||
nsresult NS_NewChromeUIDataSource(nsIRDFDataSource* aComposite, nsIRDFDataSource** aResult);
|
Загрузка…
Ссылка в новой задаче