Adding per package skin/locale-switching capabilities.

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

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

@ -1107,39 +1107,74 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const PRUnichar *aThemeFileName,
const PRUnichar *aPackageName,
const PRUnichar *aProviderName)
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCAutoString& aProviderType,
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)

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

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

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

@ -1107,39 +1107,74 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
NS_ERROR("Write me!\n");
return NS_OK;
nsAutoString provider("skin");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const PRUnichar *aThemeFileName,
const PRUnichar *aPackageName,
const PRUnichar *aProviderName)
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCAutoString& aProviderType,
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)

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

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