store generated overlays in their own directory. force overlay list node to be a seq. r=hyatt@netscape.com

This commit is contained in:
danm%netscape.com 2000-05-16 03:16:58 +00:00
Родитель 9df7ba78fa
Коммит 69046d3d92
4 изменённых файлов: 40 добавлений и 42 удалений

Просмотреть файл

@ -662,7 +662,8 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFD
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Retrieve the mInner data source. // Retrieve the mInner data source.
nsCAutoString overlayFile = package; nsCAutoString overlayFile = "overlayinfo/";
overlayFile += package;
overlayFile += "/"; overlayFile += "/";
overlayFile += provider; overlayFile += provider;
overlayFile += "/"; overlayFile += "/";
@ -974,8 +975,8 @@ nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocu
return rv; return rv;
} }
NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnichar *aDocURI, NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(char *aDocURI,
char *aOverlayURI, const PRUnichar *aOverlayURI,
PRBool aRemove) PRBool aRemove)
{ {
nsresult rv; nsresult rv;
@ -989,7 +990,7 @@ NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnicha
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_OK; return NS_OK;
nsCAutoString str; str.AssignWithConversion(aDocURI); nsCAutoString str(aDocURI);
url->SetSpec(str); url->SetSpec(str);
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource;
GetOverlayDataSource(url, getter_AddRefs(dataSource)); GetOverlayDataSource(url, getter_AddRefs(dataSource));
@ -998,25 +999,23 @@ NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnicha
return NS_OK; return NS_OK;
nsCOMPtr<nsIRDFResource> resource; nsCOMPtr<nsIRDFResource> resource;
nsCAutoString aDocURIString; aDocURIString.AssignWithConversion(aDocURI); rv = GetResource(str, getter_AddRefs(resource));
rv = GetResource(aDocURIString, getter_AddRefs(resource));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_OK; return NS_OK;
nsCOMPtr<nsIRDFContainer> container; nsCOMPtr<nsIRDFContainer> container;
mRDFContainerUtils->MakeSeq(dataSource, resource, getter_AddRefs(container));
if (!container) {
// Already exists. Create a container instead.
rv = nsComponentManager::CreateInstance("component://netscape/rdf/container",
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
container->Init(dataSource, resource);
}
rv = nsComponentManager::CreateInstance("component://netscape/rdf/container", nsAutoString unistr(aOverlayURI);
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (NS_FAILED(container->Init(dataSource, resource)))
return NS_ERROR_FAILURE;
nsAutoString unistr; unistr.AssignWithConversion(aOverlayURI);
nsCOMPtr<nsIRDFLiteral> literal; nsCOMPtr<nsIRDFLiteral> literal;
mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal)); mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal));
@ -1060,7 +1059,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlay(nsIRDFDataSource *aDataSource, nsI
PRBool moreElements; PRBool moreElements;
arcs->HasMoreElements(&moreElements); arcs->HasMoreElements(&moreElements);
char *value; char *value;
aResource->GetValue(&value); aResource->GetValue(&value);
@ -1078,7 +1077,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlay(nsIRDFDataSource *aDataSource, nsI
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
ReallyUpdateOverlayFromDataSource(valueStr, value, aRemove); ReallyUpdateOverlayFromDataSource(value, valueStr, aRemove);
} }
arcs->HasMoreElements(&moreElements); arcs->HasMoreElements(&moreElements);
} }
@ -1093,7 +1092,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlays(nsIRDFDataSource *aDataSource,
{ {
nsresult rv; nsresult rv;
nsCOMPtr<nsIRDFResource> resource; nsCOMPtr<nsIRDFResource> resource;
rv = GetResource("chrome:overlays", getter_AddRefs(resource)); rv = GetResource("urn:mozilla:overlays", getter_AddRefs(resource));
if (!resource) if (!resource)
return NS_OK; return NS_OK;

Просмотреть файл

@ -67,7 +67,7 @@ protected:
void GetUserSheetURL(nsCString & aURL); void GetUserSheetURL(nsCString & aURL);
private: private:
NS_IMETHOD ReallyUpdateOverlayFromDataSource(const PRUnichar *aDocURI, char *aOverlayURI, NS_IMETHOD ReallyUpdateOverlayFromDataSource(char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aRemove); PRBool aRemove);
NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult, NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE); PRBool aUseProfileDirOnly = PR_FALSE);

Просмотреть файл

@ -662,7 +662,8 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFD
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Retrieve the mInner data source. // Retrieve the mInner data source.
nsCAutoString overlayFile = package; nsCAutoString overlayFile = "overlayinfo/";
overlayFile += package;
overlayFile += "/"; overlayFile += "/";
overlayFile += provider; overlayFile += provider;
overlayFile += "/"; overlayFile += "/";
@ -974,8 +975,8 @@ nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocu
return rv; return rv;
} }
NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnichar *aDocURI, NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(char *aDocURI,
char *aOverlayURI, const PRUnichar *aOverlayURI,
PRBool aRemove) PRBool aRemove)
{ {
nsresult rv; nsresult rv;
@ -989,7 +990,7 @@ NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnicha
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_OK; return NS_OK;
nsCAutoString str; str.AssignWithConversion(aDocURI); nsCAutoString str(aDocURI);
url->SetSpec(str); url->SetSpec(str);
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource;
GetOverlayDataSource(url, getter_AddRefs(dataSource)); GetOverlayDataSource(url, getter_AddRefs(dataSource));
@ -998,25 +999,23 @@ NS_IMETHODIMP nsChromeRegistry::ReallyUpdateOverlayFromDataSource(const PRUnicha
return NS_OK; return NS_OK;
nsCOMPtr<nsIRDFResource> resource; nsCOMPtr<nsIRDFResource> resource;
nsCAutoString aDocURIString; aDocURIString.AssignWithConversion(aDocURI); rv = GetResource(str, getter_AddRefs(resource));
rv = GetResource(aDocURIString, getter_AddRefs(resource));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_OK; return NS_OK;
nsCOMPtr<nsIRDFContainer> container; nsCOMPtr<nsIRDFContainer> container;
mRDFContainerUtils->MakeSeq(dataSource, resource, getter_AddRefs(container));
if (!container) {
// Already exists. Create a container instead.
rv = nsComponentManager::CreateInstance("component://netscape/rdf/container",
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
container->Init(dataSource, resource);
}
rv = nsComponentManager::CreateInstance("component://netscape/rdf/container", nsAutoString unistr(aOverlayURI);
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (NS_FAILED(container->Init(dataSource, resource)))
return NS_ERROR_FAILURE;
nsAutoString unistr; unistr.AssignWithConversion(aOverlayURI);
nsCOMPtr<nsIRDFLiteral> literal; nsCOMPtr<nsIRDFLiteral> literal;
mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal)); mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal));
@ -1060,7 +1059,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlay(nsIRDFDataSource *aDataSource, nsI
PRBool moreElements; PRBool moreElements;
arcs->HasMoreElements(&moreElements); arcs->HasMoreElements(&moreElements);
char *value; char *value;
aResource->GetValue(&value); aResource->GetValue(&value);
@ -1078,7 +1077,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlay(nsIRDFDataSource *aDataSource, nsI
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
ReallyUpdateOverlayFromDataSource(valueStr, value, aRemove); ReallyUpdateOverlayFromDataSource(value, valueStr, aRemove);
} }
arcs->HasMoreElements(&moreElements); arcs->HasMoreElements(&moreElements);
} }
@ -1093,7 +1092,7 @@ NS_IMETHODIMP nsChromeRegistry::UpdateOverlays(nsIRDFDataSource *aDataSource,
{ {
nsresult rv; nsresult rv;
nsCOMPtr<nsIRDFResource> resource; nsCOMPtr<nsIRDFResource> resource;
rv = GetResource("chrome:overlays", getter_AddRefs(resource)); rv = GetResource("urn:mozilla:overlays", getter_AddRefs(resource));
if (!resource) if (!resource)
return NS_OK; return NS_OK;

Просмотреть файл

@ -67,7 +67,7 @@ protected:
void GetUserSheetURL(nsCString & aURL); void GetUserSheetURL(nsCString & aURL);
private: private:
NS_IMETHOD ReallyUpdateOverlayFromDataSource(const PRUnichar *aDocURI, char *aOverlayURI, NS_IMETHOD ReallyUpdateOverlayFromDataSource(char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aRemove); PRBool aRemove);
NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult, NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE); PRBool aUseProfileDirOnly = PR_FALSE);