зеркало из https://github.com/mozilla/pjs.git
Fixing some stuff.
This commit is contained in:
Родитель
d3c8326505
Коммит
27fb6ca58c
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||||
|
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||||
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
||||||
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
|
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
|
||||||
static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
|
static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
|
||||||
|
@ -81,8 +82,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
nsresult EnsureRegistryDataSource();
|
nsresult EnsureRegistryDataSource();
|
||||||
nsresult GetSkinOrContentResource(const nsString& aChromeType, nsIRDFResource** aResult);
|
nsresult GetSkinOrContentResource(const nsString& aChromeType, nsIRDFResource** aResult);
|
||||||
nsresult GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResource);
|
nsresult GetChromeResource(nsString& aResult, nsIRDFResource* aChromeResource,
|
||||||
nsresult GetMainChromeFile(nsString& aResult, nsIRDFResource* aChromeResource);
|
nsIRDFResource* aProperty);
|
||||||
};
|
};
|
||||||
|
|
||||||
PRUint32 nsChromeRegistry::gRefCnt = 0;
|
PRUint32 nsChromeRegistry::gRefCnt = 0;
|
||||||
|
@ -247,7 +248,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsString chromeBase;
|
nsString chromeBase;
|
||||||
if (NS_FAILED(rv = GetChromeBase(chromeBase, chromeResource))) {
|
if (NS_FAILED(rv = GetChromeResource(chromeBase, chromeResource, kCHROME_base))) {
|
||||||
NS_ERROR("Unable to retrieve codebase for chrome entry.");
|
NS_ERROR("Unable to retrieve codebase for chrome entry.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL)
|
||||||
{
|
{
|
||||||
// Append the "main" entry.
|
// Append the "main" entry.
|
||||||
nsString mainFile;
|
nsString mainFile;
|
||||||
if (NS_FAILED(rv = GetMainChromeFile(mainFile, chromeResource))) {
|
if (NS_FAILED(rv = GetChromeResource(mainFile, chromeResource, kCHROME_main))) {
|
||||||
NS_ERROR("Unable to retrieve the main file registry entry for a chrome URL.");
|
NS_ERROR("Unable to retrieve the main file registry entry for a chrome URL.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,9 @@ nsChromeRegistry::GetSkinOrContentResource(const nsString& aChromeType,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsChromeRegistry::GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResource)
|
nsChromeRegistry::GetChromeResource(nsString& aResult,
|
||||||
|
nsIRDFResource* aChromeResource,
|
||||||
|
nsIRDFResource* aProperty)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
@ -345,21 +348,35 @@ nsChromeRegistry::GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResour
|
||||||
return NS_ERROR_FAILURE; // Must have a DB to attempt this operation.
|
return NS_ERROR_FAILURE; // Must have a DB to attempt this operation.
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFNode> chromeBase;
|
nsCOMPtr<nsIRDFNode> chromeBase;
|
||||||
if (NS_FAILED(rv = gRegistryDB->GetTarget(kCHROME_base, aChromeResource, PR_TRUE, getter_AddRefs(chromeBase)))) {
|
if (NS_FAILED(rv = gRegistryDB->GetTarget(aChromeResource, aProperty, PR_TRUE, getter_AddRefs(chromeBase)))) {
|
||||||
NS_ERROR("Unable to obtain a base resource.");
|
NS_ERROR("Unable to obtain a base resource.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now what?
|
nsCOMPtr<nsIRDFResource> resource;
|
||||||
|
nsCOMPtr<nsIRDFLiteral> literal;
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(rv = chromeBase->QueryInterface(kIRDFResourceIID,
|
||||||
|
(void**) getter_AddRefs(resource)))) {
|
||||||
|
nsXPIDLCString uri;
|
||||||
|
resource->GetValue( getter_Copies(uri) );
|
||||||
|
aResult = uri;
|
||||||
|
}
|
||||||
|
else if (NS_SUCCEEDED(rv = chromeBase->QueryInterface(kIRDFLiteralIID,
|
||||||
|
(void**) getter_AddRefs(literal)))) {
|
||||||
|
nsXPIDLString s;
|
||||||
|
literal->GetValue( getter_Copies(s) );
|
||||||
|
aResult = s;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This should _never_ happen.
|
||||||
|
NS_ERROR("uh, this isn't a resource or a literal!");
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsChromeRegistry::GetMainChromeFile(nsString& aResult, nsIRDFResource* aChromeResource)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewChromeRegistry(nsIChromeRegistry** aResult)
|
NS_NewChromeRegistry(nsIChromeRegistry** aResult)
|
||||||
|
|
|
@ -2,14 +2,12 @@
|
||||||
xmlns="http://chrome.mozilla.org/rdf#">
|
xmlns="http://chrome.mozilla.org/rdf#">
|
||||||
|
|
||||||
<chrome r:resource="chrome://navigator/">
|
<chrome r:resource="chrome://navigator/">
|
||||||
<skin r:resource="chrome://navigator/skin/">
|
<skin r:resource="chrome://navigator/skin/"
|
||||||
<base>resource:/res/samples/</base>
|
base="resource:/res/samples/">
|
||||||
<main>navigator.css</main>
|
main="navigator.css"></skin>
|
||||||
</skin>
|
<content r:resource="chrome://navigator/content/"
|
||||||
<content r:resource="chrome://navigator/content/">
|
base="resource:/res/samples/"
|
||||||
<base>resource:/res/samples/</base>
|
main="navigator.xul"></content>
|
||||||
<main>navigator.xul</main>
|
|
||||||
</content>
|
|
||||||
</chrome>
|
</chrome>
|
||||||
|
|
||||||
</r:RDF>
|
</r:RDF>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||||
|
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||||
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
||||||
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
|
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
|
||||||
static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
|
static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
|
||||||
|
@ -81,8 +82,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
nsresult EnsureRegistryDataSource();
|
nsresult EnsureRegistryDataSource();
|
||||||
nsresult GetSkinOrContentResource(const nsString& aChromeType, nsIRDFResource** aResult);
|
nsresult GetSkinOrContentResource(const nsString& aChromeType, nsIRDFResource** aResult);
|
||||||
nsresult GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResource);
|
nsresult GetChromeResource(nsString& aResult, nsIRDFResource* aChromeResource,
|
||||||
nsresult GetMainChromeFile(nsString& aResult, nsIRDFResource* aChromeResource);
|
nsIRDFResource* aProperty);
|
||||||
};
|
};
|
||||||
|
|
||||||
PRUint32 nsChromeRegistry::gRefCnt = 0;
|
PRUint32 nsChromeRegistry::gRefCnt = 0;
|
||||||
|
@ -247,7 +248,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsString chromeBase;
|
nsString chromeBase;
|
||||||
if (NS_FAILED(rv = GetChromeBase(chromeBase, chromeResource))) {
|
if (NS_FAILED(rv = GetChromeResource(chromeBase, chromeResource, kCHROME_base))) {
|
||||||
NS_ERROR("Unable to retrieve codebase for chrome entry.");
|
NS_ERROR("Unable to retrieve codebase for chrome entry.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL)
|
||||||
{
|
{
|
||||||
// Append the "main" entry.
|
// Append the "main" entry.
|
||||||
nsString mainFile;
|
nsString mainFile;
|
||||||
if (NS_FAILED(rv = GetMainChromeFile(mainFile, chromeResource))) {
|
if (NS_FAILED(rv = GetChromeResource(mainFile, chromeResource, kCHROME_main))) {
|
||||||
NS_ERROR("Unable to retrieve the main file registry entry for a chrome URL.");
|
NS_ERROR("Unable to retrieve the main file registry entry for a chrome URL.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,9 @@ nsChromeRegistry::GetSkinOrContentResource(const nsString& aChromeType,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsChromeRegistry::GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResource)
|
nsChromeRegistry::GetChromeResource(nsString& aResult,
|
||||||
|
nsIRDFResource* aChromeResource,
|
||||||
|
nsIRDFResource* aProperty)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
@ -345,21 +348,35 @@ nsChromeRegistry::GetChromeBase(nsString& aResult, nsIRDFResource* aChromeResour
|
||||||
return NS_ERROR_FAILURE; // Must have a DB to attempt this operation.
|
return NS_ERROR_FAILURE; // Must have a DB to attempt this operation.
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFNode> chromeBase;
|
nsCOMPtr<nsIRDFNode> chromeBase;
|
||||||
if (NS_FAILED(rv = gRegistryDB->GetTarget(kCHROME_base, aChromeResource, PR_TRUE, getter_AddRefs(chromeBase)))) {
|
if (NS_FAILED(rv = gRegistryDB->GetTarget(aChromeResource, aProperty, PR_TRUE, getter_AddRefs(chromeBase)))) {
|
||||||
NS_ERROR("Unable to obtain a base resource.");
|
NS_ERROR("Unable to obtain a base resource.");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now what?
|
nsCOMPtr<nsIRDFResource> resource;
|
||||||
|
nsCOMPtr<nsIRDFLiteral> literal;
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(rv = chromeBase->QueryInterface(kIRDFResourceIID,
|
||||||
|
(void**) getter_AddRefs(resource)))) {
|
||||||
|
nsXPIDLCString uri;
|
||||||
|
resource->GetValue( getter_Copies(uri) );
|
||||||
|
aResult = uri;
|
||||||
|
}
|
||||||
|
else if (NS_SUCCEEDED(rv = chromeBase->QueryInterface(kIRDFLiteralIID,
|
||||||
|
(void**) getter_AddRefs(literal)))) {
|
||||||
|
nsXPIDLString s;
|
||||||
|
literal->GetValue( getter_Copies(s) );
|
||||||
|
aResult = s;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This should _never_ happen.
|
||||||
|
NS_ERROR("uh, this isn't a resource or a literal!");
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsChromeRegistry::GetMainChromeFile(nsString& aResult, nsIRDFResource* aChromeResource)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewChromeRegistry(nsIChromeRegistry** aResult)
|
NS_NewChromeRegistry(nsIChromeRegistry** aResult)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче