Adding per package skin/locale-switching capabilities.

This commit is contained in:
hyatt%netscape.com 2000-03-21 11:01:58 +00:00
Родитель 6e3f4c5b2e
Коммит f6309c86b7
4 изменённых файлов: 108 добавлений и 32 удалений

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

@ -1107,39 +1107,74 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
} }
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale, NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("locale");
return NS_OK; return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
} }
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin, NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
} }
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale, NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
} }
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const PRUnichar *aThemeFileName, NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCAutoString& aProviderType,
const PRUnichar *aPackageName, const PRUnichar *aProviderName,
const PRUnichar *aProviderName) const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
{ {
return NS_OK; nsCAutoString package = "urn:mozilla:package:";
package += aPackageName;
nsCAutoString provider = "urn:mozilla:";
provider += aProviderType;
provider += ":";
provider += aProviderName;
provider += ":";
provider += aPackageName;
// Obtain the package resource.
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFResource> packageResource;
rv = GetResource(package, getter_AddRefs(packageResource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the package resource.");
return rv;
}
if (!packageResource)
return NS_ERROR_FAILURE;
// Obtain the provider resource.
nsCOMPtr<nsIRDFResource> providerResource;
rv = GetResource(provider, getter_AddRefs(providerResource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the provider resource.");
return rv;
}
if (!providerResource)
return NS_ERROR_FAILURE;
return SetProviderForPackage(aProviderType, packageResource, providerResource, aSelectionArc, aUseProfile, aIsAdding);;
} }
NS_IMETHODIMP nsChromeRegistry::InstallSkin(nsIURI* aBaseURL, PRBool aUseProfile) NS_IMETHODIMP nsChromeRegistry::InstallSkin(nsIURI* aBaseURL, PRBool aUseProfile)

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

@ -53,10 +53,6 @@ public:
nsIRDFResource* aProperty); nsIRDFResource* aProperty);
protected: protected:
NS_IMETHOD SelectProviderForPackage(const PRUnichar *aThemeFileName,
const PRUnichar *aPackageName,
const PRUnichar *aProviderName);
NS_IMETHOD GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFDataSource **aResult); NS_IMETHOD GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFDataSource **aResult);
nsresult GetResource(const nsCAutoString& aChromeType, nsIRDFResource** aResult); nsresult GetResource(const nsCAutoString& aChromeType, nsIRDFResource** aResult);
@ -99,6 +95,13 @@ private:
nsIRDFResource* aSelectionArc, nsIRDFResource* aSelectionArc,
PRBool aAllUsers, PRBool aIsAdding); PRBool aAllUsers, PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsCAutoString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
protected: protected:
PRBool mInstallInitialized; PRBool mInstallInitialized;
PRBool mProfileInitialized; PRBool mProfileInitialized;

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

@ -1107,39 +1107,74 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
} }
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale, NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("locale");
return NS_OK; return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
} }
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin, NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
} }
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale, NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName, const PRUnichar *aPackageName,
PRBool aUseProfile) PRBool aUseProfile)
{ {
NS_ERROR("Write me!\n"); nsAutoString provider("skin");
return NS_OK; return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
} }
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const PRUnichar *aThemeFileName, NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCAutoString& aProviderType,
const PRUnichar *aPackageName, const PRUnichar *aProviderName,
const PRUnichar *aProviderName) const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
{ {
return NS_OK; nsCAutoString package = "urn:mozilla:package:";
package += aPackageName;
nsCAutoString provider = "urn:mozilla:";
provider += aProviderType;
provider += ":";
provider += aProviderName;
provider += ":";
provider += aPackageName;
// Obtain the package resource.
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFResource> packageResource;
rv = GetResource(package, getter_AddRefs(packageResource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the package resource.");
return rv;
}
if (!packageResource)
return NS_ERROR_FAILURE;
// Obtain the provider resource.
nsCOMPtr<nsIRDFResource> providerResource;
rv = GetResource(provider, getter_AddRefs(providerResource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the provider resource.");
return rv;
}
if (!providerResource)
return NS_ERROR_FAILURE;
return SetProviderForPackage(aProviderType, packageResource, providerResource, aSelectionArc, aUseProfile, aIsAdding);;
} }
NS_IMETHODIMP nsChromeRegistry::InstallSkin(nsIURI* aBaseURL, PRBool aUseProfile) NS_IMETHODIMP nsChromeRegistry::InstallSkin(nsIURI* aBaseURL, PRBool aUseProfile)

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

@ -53,10 +53,6 @@ public:
nsIRDFResource* aProperty); nsIRDFResource* aProperty);
protected: protected:
NS_IMETHOD SelectProviderForPackage(const PRUnichar *aThemeFileName,
const PRUnichar *aPackageName,
const PRUnichar *aProviderName);
NS_IMETHOD GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFDataSource **aResult); NS_IMETHOD GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFDataSource **aResult);
nsresult GetResource(const nsCAutoString& aChromeType, nsIRDFResource** aResult); nsresult GetResource(const nsCAutoString& aChromeType, nsIRDFResource** aResult);
@ -99,6 +95,13 @@ private:
nsIRDFResource* aSelectionArc, nsIRDFResource* aSelectionArc,
PRBool aAllUsers, PRBool aIsAdding); PRBool aAllUsers, PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsCAutoString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
protected: protected:
PRBool mInstallInitialized; PRBool mInstallInitialized;
PRBool mProfileInitialized; PRBool mProfileInitialized;