fix bug 162741 - revamp chrome registry interface in preparation for bug 160000 - switch lots of public APIs over to ACString, etc.

r=bryner, sr=hyatt
This commit is contained in:
alecf%netscape.com 2002-08-20 18:12:51 +00:00
Родитель 38003dbcdf
Коммит 5823310245
13 изменённых файлов: 597 добавлений и 513 удалений

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

@ -62,7 +62,7 @@ interface nsIChromeRegistry : nsISupports
*
* @param aChromeURL the URL that is to be converted.
*/
string convertChromeURL(in nsIURI aChromeURL);
AUTF8String convertChromeURL(in nsIURI aChromeURL);
/**
* get the style sheets for a specific chrome URL
@ -89,15 +89,15 @@ interface nsIChromeRegistry : nsISupports
interface nsIXULChromeRegistry : nsIChromeRegistry {
/* Applies a skin or locale to all possible packages */
void selectSkin(in wstring skinName, in boolean useProfile);
void selectLocale(in wstring localeName, in boolean useProfile);
void deselectSkin(in wstring skinName, in boolean useProfile);
void deselectLocale(in wstring localeName, in boolean useProfile);
PRInt32 isSkinSelected(in wstring skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in wstring localeName, in boolean useProfile);
void selectSkin(in ACString skinName, in boolean useProfile);
void selectLocale(in ACString localeName, in boolean useProfile);
void deselectSkin(in ACString skinName, in boolean useProfile);
void deselectLocale(in ACString localeName, in boolean useProfile);
PRInt32 isSkinSelected(in ACString skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in ACString localeName, in boolean useProfile);
// Special additional APIs for locales only.
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
void selectLocaleForProfile(in ACString localeName, in wstring profilePath);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
@ -109,31 +109,33 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
boolean checkLocaleVersion(in wstring localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName,
void selectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in wstring localeName,
void selectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in wstring skinName,
void deselectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName,
void deselectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName,
boolean isSkinSelectedForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName,
boolean isLocaleSelectedForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
wstring getSelectedLocale(in wstring packageName);
ACString getSelectedLocale(in ACString packageName);
ACString getSelectedSkin(in ACString packageName);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/* Should be called when skins change. Reloads only stylesheets. */
@ -146,10 +148,10 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
in boolean useProfile,
in boolean allowScripts);
void uninstallSkin(in wstring skinName, in boolean useProfile);
void uninstallSkin(in ACString skinName, in boolean useProfile);
void installLocale(in string baseURL, in boolean useProfile);
void uninstallLocale(in wstring localeName, in boolean useProfile);
void uninstallLocale(in ACString localeName, in boolean useProfile);
void installPackage(in string baseURL, in boolean useProfile);
void uninstallPackage(in wstring packageName, in boolean useProfile);

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

@ -636,8 +636,8 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
//aURI->GetSpec(getter_Copies(oldSpec));
//printf("*************************** %s\n", (const char*)oldSpec);
nsXPIDLCString spec;
rv = reg->ConvertChromeURL(aURI, getter_Copies(spec));
nsCAutoString spec;
rv = reg->ConvertChromeURL(aURI, spec);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIIOService> ioServ(do_GetService(kIOServiceCID, &rv));

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

@ -246,17 +246,16 @@ NS_IMETHODIMP nsOverlayEnumerator::GetNext(nsISupports **aResult)
////////////////////////////////////////////////////////////////////////////////
nsChromeRegistry::nsChromeRegistry() : mRDFService(nsnull),
mRDFContainerUtils(nsnull)
mRDFContainerUtils(nsnull),
mUseXBLForms(PR_FALSE),
mInstallInitialized(PR_FALSE),
mProfileInitialized(PR_FALSE),
mRuntimeProvider(PR_FALSE),
mBatchInstallFlushes(PR_FALSE),
mSearchedForOverride(PR_FALSE)
{
NS_INIT_REFCNT();
mInstallInitialized = PR_FALSE;
mProfileInitialized = PR_FALSE;
mUseXBLForms = PR_FALSE;
mBatchInstallFlushes = PR_FALSE;
mRuntimeProvider = PR_FALSE;
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID));
if (prefService)
prefService->GetBoolPref(kUseXBLFormsPref, &mUseXBLForms);
@ -511,7 +510,7 @@ nsChromeRegistry::Canonify(nsIURI* aChromeURI)
}
NS_IMETHODIMP
nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult)
nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, nsACString& aResult)
{
nsresult rv = NS_OK;
NS_ASSERTION(aChromeURL, "null url!");
@ -576,14 +575,15 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult)
}
}
*aResult = ToNewCString(finalURL + remaining);
aResult = finalURL + remaining;
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL)
nsresult
nsChromeRegistry::GetBaseURL(const nsACString& aPackage,
const nsACString& aProvider,
nsACString& aBaseURL)
{
nsCOMPtr<nsIRDFResource> resource;
@ -665,7 +665,7 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
}
// locate
NS_IMETHODIMP
nsresult
nsChromeRegistry::FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
@ -717,7 +717,7 @@ nsChromeRegistry::FindProvider(const nsACString& aPackage,
if (kid) {
// get its name
nsCAutoString providerName;
rv = nsChromeRegistry::FollowArc(mChromeDataSource, providerName, kid, mName);
rv = FollowArc(mChromeDataSource, providerName, kid, mName);
if (NS_FAILED(rv)) return rv;
// get its package list
@ -742,7 +742,7 @@ nsChromeRegistry::FindProvider(const nsACString& aPackage,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsACString& aPackage,
const nsACString& aProvider,
@ -793,7 +793,7 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
// get its name
nsCAutoString packageName;
rv = nsChromeRegistry::FollowArc(mChromeDataSource, packageName, package, mName);
rv = FollowArc(mChromeDataSource, packageName, package, mName);
if (NS_FAILED(rv))
continue; // don't fail if package has not yet been installed
@ -803,7 +803,7 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
useProfile = PR_FALSE; // Always force the auto-selection to be in the
// install dir for the packages required to bring up the profile UI.
rv = SelectProviderForPackage(aProvider,
NS_ConvertASCIItoUCS2(aProviderName).get(),
aProviderName,
NS_ConvertASCIItoUCS2(packageName).get(),
aArc, useProfile, PR_TRUE);
if (NS_FAILED(rv))
@ -818,8 +818,11 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile,
PRBool aCreateDS, nsIRDFDataSource **aResult)
nsresult
nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL,
PRBool aIsOverlay, PRBool aUseProfile,
PRBool aCreateDS,
nsIRDFDataSource **aResult)
{
*aResult = nsnull;
@ -879,7 +882,9 @@ NS_IMETHODIMP nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL, PRBool
return LoadDataSource(overlayFile, aResult, aUseProfile, nsnull);
}
NS_IMETHODIMP nsChromeRegistry::GetStyleSheets(nsIURI *aChromeURL, nsISupportsArray **aResult)
nsresult
nsChromeRegistry::GetStyleSheets(nsIURI *aChromeURL,
nsISupportsArray **aResult)
{
*aResult = nsnull;
@ -919,7 +924,9 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlays(nsIURI *aChromeURL, nsISimpleEnumera
return GetDynamicInfo(aChromeURL, PR_TRUE, aResult);
}
NS_IMETHODIMP nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult)
nsresult
nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay,
nsISimpleEnumerator **aResult)
{
*aResult = nsnull;
@ -983,7 +990,8 @@ NS_IMETHODIMP nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOve
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
nsresult
nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
nsIRDFDataSource **aResult,
PRBool aUseProfileDir,
const char *aProfilePath)
@ -1078,7 +1086,7 @@ nsChromeRegistry::GetResource(const nsCString& aURL,
nsresult
nsChromeRegistry::FollowArc(nsIRDFDataSource *aDataSource,
nsCString& aResult,
nsACString& aResult,
nsIRDFResource* aChromeResource,
nsIRDFResource* aProperty)
{
@ -1112,7 +1120,7 @@ nsChromeRegistry::FollowArc(nsIRDFDataSource *aDataSource,
const PRUnichar *s;
rv = literal->GetValueConst(&s);
if (NS_FAILED(rv)) return rv;
aResult.AssignWithConversion(s);
aResult.Assign(NS_ConvertUCS2toUTF8(s));
}
else {
// This should _never_ happen.
@ -1236,7 +1244,7 @@ static PRBool IsChromeURI(nsIURI* aURI)
return PR_FALSE;
}
NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
{
// Deal with our subframes first.
nsCOMPtr<nsIDOMWindowCollection> frames;
@ -1379,7 +1387,8 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
nsresult
nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
const PRUnichar *aOverlayURI,
PRBool aIsOverlay,
PRBool aUseProfile,
@ -1484,8 +1493,11 @@ NS_IMETHODIMP nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
return rv;
}
NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataSource, nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove)
nsresult
nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
nsIRDFResource *aResource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove)
{
nsCOMPtr<nsIRDFContainer> container;
nsresult rv;
@ -1536,8 +1548,10 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataS
}
NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove)
nsresult
nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove)
{
nsresult rv;
nsCOMPtr<nsIRDFResource> resource;
@ -1587,19 +1601,19 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aData
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const nsACString& aSkin,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const nsACString& aLocale,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const nsACString& aLocale,
const PRUnichar *aProfilePath)
{
// to be changed to use given path
@ -1615,9 +1629,30 @@ NS_IMETHODIMP nsChromeRegistry::SetRuntimeProvider(PRBool runtimeProvider)
}
/* wstring getSelectedLocale (); */
NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
PRUnichar **_retval)
/* ACString getSelectedLocale (ACString packageName); */
NS_IMETHODIMP
nsChromeRegistry::GetSelectedLocale(const nsACString& aPackageName,
nsACString& aResult)
{
return GetSelectedProvider(aPackageName,
NS_LITERAL_CSTRING("locale"), mSelectedLocale,
aResult);
}
NS_IMETHODIMP
nsChromeRegistry::GetSelectedSkin(const nsACString& aPackageName,
nsACString& aResult)
{
return GetSelectedProvider(aPackageName,
NS_LITERAL_CSTRING("skin"), mSelectedSkin,
aResult);
}
nsresult
nsChromeRegistry::GetSelectedProvider(const nsACString& aPackageName,
const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
nsACString& _retval)
{
// check if mChromeDataSource is null; do we need to apply this to every instance?
// is there a better way to test if the data source is ready?
@ -1625,9 +1660,8 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
return NS_ERROR_FAILURE;
}
nsString packageStr(aPackageName);
nsCAutoString resourceStr("urn:mozilla:package:");
resourceStr += NS_ConvertUCS2toUTF8(packageStr.get());
resourceStr += aPackageName;
// Obtain the resource.
nsresult rv = NS_OK;
@ -1643,13 +1677,13 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
// Follow the "selectedLocale" arc.
nsCOMPtr<nsIRDFNode> selectedProvider;
if (NS_FAILED(rv = mChromeDataSource->GetTarget(resource, mSelectedLocale, PR_TRUE, getter_AddRefs(selectedProvider)))) {
if (NS_FAILED(rv = mChromeDataSource->GetTarget(resource, aSelectionArc, PR_TRUE, getter_AddRefs(selectedProvider)))) {
NS_ERROR("Unable to obtain the provider.");
return rv;
}
if (!selectedProvider) {
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), NS_LITERAL_CSTRING("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
rv = FindProvider(aPackageName, aProvider, aSelectionArc, getter_AddRefs(selectedProvider));
if (!selectedProvider)
return rv;
}
@ -1664,48 +1698,40 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
return rv;
// trim down to "urn:mozilla:locale:ja-JP"
nsAutoString ustr = NS_ConvertUTF8toUCS2(uri);
nsCAutoString packageStr(":");
packageStr += aPackageName;
packageStr.Insert(PRUnichar(':'), 0);
nsCAutoString ustr(uri);
PRInt32 pos = ustr.RFind(packageStr);
nsString urn;
nsCAutoString urn;
ustr.Left(urn, pos);
rv = GetResource(NS_ConvertUCS2toUTF8(urn.get()), getter_AddRefs(resource));
rv = GetResource(urn, getter_AddRefs(resource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the provider resource.");
return rv;
}
// From this resource, follow the "name" arc.
nsCAutoString lc_name; // is this i18n friendly? RDF now use UTF8 internally
rv = nsChromeRegistry::FollowArc(mChromeDataSource,
lc_name,
resource,
mName);
if (NS_FAILED(rv)) return rv;
// this is not i18n friendly? RDF now use UTF8 internally.
*_retval = ToNewUnicode(lc_name);
return NS_OK;
return FollowArc(mChromeDataSource, _retval, resource, mName);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const nsACString& aSkin,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const nsACString& aLocale,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsresult
nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aUseProfile, const char *aProfilePath,
PRBool aIsAdding)
{
@ -1714,7 +1740,7 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsCAutoString resourceStr( "urn:mozilla:" );
resourceStr += aProvider;
resourceStr += ":";
resourceStr.AppendWithConversion(aProviderName);
resourceStr += aProviderName;
// Obtain the provider resource.
nsresult rv = NS_OK;
@ -1792,7 +1818,7 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
@ -1825,51 +1851,51 @@ nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
return rv;
}
NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
@ -1880,7 +1906,7 @@ nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
nsCAutoString provider( "urn:mozilla:" );
provider += aProviderType;
provider += ":";
provider.AppendWithConversion(aProviderName);
provider += aProviderName;
provider += ":";
provider.AppendWithConversion(aPackageName);
@ -1929,20 +1955,21 @@ nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
aUseProfile, nsnull, aIsAdding);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const nsACString& aSkin,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(NS_LITERAL_CSTRING("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const nsACString& aLocale,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(NS_LITERAL_CSTRING("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsresult
nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult)
{
@ -1952,7 +1979,7 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
nsCAutoString resourceStr( "urn:mozilla:" );
resourceStr += aProvider;
resourceStr += ":";
resourceStr.AppendWithConversion(aProviderName);
resourceStr += aProviderName;
// Obtain the provider resource.
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFResource> resource;
@ -2029,9 +2056,9 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult)
@ -2043,7 +2070,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
nsCAutoString provider( "urn:mozilla:" );
provider += aProviderType;
provider += ":";
provider.AppendWithConversion(aProviderName);
provider += aProviderName;
provider += ":";
provider.AppendWithConversion(aPackageName);
@ -2070,7 +2097,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
aUseProfile, aResult);
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
@ -2096,7 +2123,8 @@ nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
nsresult
nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts,
PRBool aRemove)
@ -2486,7 +2514,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallPackage(const char* aBaseURL, PRBool aUse
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool aUseProfile)
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const nsACString& aSkinName, PRBool aUseProfile)
{
// The skin must first be deselected.
DeselectSkin(aSkinName, aUseProfile);
@ -2495,7 +2523,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool
return UninstallProvider(NS_LITERAL_CSTRING("skin"), aSkinName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PRBool aUseProfile)
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const nsACString& aLocaleName, PRBool aUseProfile)
{
// The locale must first be deselected.
DeselectLocale(aLocaleName, aUseProfile);
@ -2509,9 +2537,9 @@ NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aUseProfile)
{
// XXX We are going to simply do a snip of the arc from the seq ROOT to
@ -2529,8 +2557,7 @@ nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
// Obtain the child we wish to remove.
nsCAutoString specificChild(prefix);
nsCAutoString provName; provName.AssignWithConversion(aProviderName);
specificChild += provName;
specificChild += aProviderName;
// Instantiate the data source we wish to modify.
nsCOMPtr<nsIRDFDataSource> installSource;
@ -2568,8 +2595,8 @@ nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::GetProfileRoot(nsCString& aFileURL)
nsresult
nsChromeRegistry::GetProfileRoot(nsACString& aFileURL)
{
nsresult rv;
nsCOMPtr<nsIFile> userChromeDir;
@ -2622,19 +2649,10 @@ nsChromeRegistry::GetProfileRoot(nsCString& aFileURL)
return NS_GetURLSpecFromFile(userChromeDir, aFileURL);
}
NS_IMETHODIMP
nsChromeRegistry::GetInstallRoot(nsCString& aFileURL)
nsresult
nsChromeRegistry::GetInstallRoot(nsIFile** aFileURL)
{
nsresult rv;
nsCOMPtr<nsIFile> appChromeDir;
// Build a fileSpec that points to the destination
// (bin dir + chrome)
rv = NS_GetSpecialDirectory(NS_APP_CHROME_DIR, getter_AddRefs(appChromeDir));
if (NS_FAILED(rv) || !appChromeDir)
return NS_ERROR_FAILURE;
return NS_GetURLSpecFromFile(appChromeDir, aFileURL);
return NS_GetSpecialDirectory(NS_APP_CHROME_DIR, aFileURL);
}
NS_IMETHODIMP
@ -2693,7 +2711,7 @@ nsChromeRegistry::ReloadChrome()
return rv;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::GetArcs(nsIRDFDataSource* aDataSource,
const nsCString& aType,
nsISimpleEnumerator** aResult)
@ -2728,7 +2746,7 @@ nsChromeRegistry::GetArcs(nsIRDFDataSource* aDataSource,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile)
{
nsresult rv = NS_OK;
@ -2891,7 +2909,7 @@ nsresult nsChromeRegistry::LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet*
return NS_OK;
}
nsresult nsChromeRegistry::GetUserSheetURL(PRBool aIsChrome, nsCString & aURL)
nsresult nsChromeRegistry::GetUserSheetURL(PRBool aIsChrome, nsACString & aURL)
{
aURL = mProfileRoot;
if (aIsChrome)
@ -2910,8 +2928,14 @@ nsresult nsChromeRegistry::GetFormSheetURL(nsCString& aURL)
nsresult nsChromeRegistry::LoadInstallDataSource()
{
nsresult rv = GetInstallRoot(mInstallRoot);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFile> installRootFile;
nsresult rv = GetInstallRoot(getter_AddRefs(installRootFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_GetURLSpecFromFile(installRootFile, mInstallRoot);
NS_ENSURE_SUCCESS(rv, rv);
mInstallInitialized = PR_TRUE;
return AddToCompositeDataSource(PR_FALSE);
}
@ -2932,8 +2956,8 @@ nsresult nsChromeRegistry::LoadProfileDataSource()
// Select and Remove skins based on a pref set in a previous session.
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID));
if (pref) {
nsXPIDLString skinToSelect;
rv = pref->CopyUnicharPref("general.skins.selectedSkin", getter_Copies(skinToSelect));
nsXPIDLCString skinToSelect;
rv = pref->CopyCharPref("general.skins.selectedSkin", getter_Copies(skinToSelect));
if (NS_SUCCEEDED(rv)) {
rv = SelectSkin(skinToSelect, PR_TRUE);
if (NS_SUCCEEDED(rv))
@ -3189,9 +3213,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
// process the line
if (skin.Equals(chromeType)) {
if (isSelection) {
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectSkin(name.get(), isProfile);
rv = SelectSkin(nsDependentCString(chromeLocation), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
#endif
@ -3203,9 +3226,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
rv = InstallPackage(chromeURL.get(), isProfile);
else if (locale.Equals(chromeType)) {
if (isSelection) {
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectLocale(name.get(), isProfile);
rv = SelectLocale(nsDependentCString(chromeLocation), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
#endif
@ -3303,7 +3325,8 @@ NS_IMETHODIMP nsChromeRegistry::CheckLocaleVersion(const PRUnichar *aLocale,
}
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
nsresult
nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible)

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

@ -81,29 +81,36 @@ public:
public:
static nsresult FollowArc(nsIRDFDataSource *aDataSource,
nsCString& aResult, nsIRDFResource* aChromeResource,
nsACString& aResult,
nsIRDFResource* aChromeResource,
nsIRDFResource* aProperty);
static nsresult UpdateArc(nsIRDFDataSource *aDataSource, nsIRDFResource* aSource, nsIRDFResource* aProperty,
nsIRDFNode *aTarget, PRBool aRemove);
protected:
NS_IMETHOD GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
NS_IMETHOD GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
nsresult GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
nsresult GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
nsresult GetResource(const nsCString& aChromeType, nsIRDFResource** aResult);
NS_IMETHOD UpdateDynamicDataSource(nsIRDFDataSource *aDataSource, nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
NS_IMETHOD UpdateDynamicDataSources(nsIRDFDataSource *aDataSource, PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove);
NS_IMETHOD WriteInfoToDataSource(const char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
nsresult UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool
aUseProfile, PRBool aRemove);
nsresult UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool
aRemove);
nsresult WriteInfoToDataSource(const char *aDocURI,
const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool
aUseProfile, PRBool aRemove);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString & aURL);
nsresult LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet);
nsresult GetUserSheetURL(PRBool aIsChrome, nsCString & aURL);
nsresult GetUserSheetURL(PRBool aIsChrome, nsACString & aURL);
nsresult GetFormSheetURL(nsCString& aURL);
nsresult LoadInstallDataSource();
@ -112,91 +119,94 @@ protected:
nsresult FlushCaches();
private:
NS_IMETHOD LoadDataSource(const nsACString &aFileName, nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE, const char *aProfilePath = nsnull);
nsresult LoadDataSource(const nsACString &aFileName,
nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE,
const char *aProfilePath = nsnull);
NS_IMETHOD GetProfileRoot(nsCString& aFileURL);
NS_IMETHOD GetInstallRoot(nsCString& aFileURL);
static nsresult GetProfileRoot(nsACString& aFileURL);
static nsresult GetInstallRoot(nsIFile** aFileURL);
NS_IMETHOD RefreshWindow(nsIDOMWindowInternal* aWindow);
nsresult RefreshWindow(nsIDOMWindowInternal* aWindow);
NS_IMETHOD GetArcs(nsIRDFDataSource* aDataSource,
nsresult GetArcs(nsIRDFDataSource* aDataSource,
const nsCString& aType,
nsISimpleEnumerator** aResult);
NS_IMETHOD AddToCompositeDataSource(PRBool aUseProfile);
nsresult AddToCompositeDataSource(PRBool aUseProfile);
NS_IMETHOD GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL);
nsresult GetBaseURL(const nsACString& aPackage,
const nsACString& aProvider,
nsACString& aBaseURL);
NS_IMETHOD FindProvider(const nsACString& aPackage,
nsresult FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SelectPackageInProvider(nsIRDFResource *aPackageList,
nsresult SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SetProvider(const nsACString& aProvider,
nsresult SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aAllUsers,
const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SetProviderForPackage(const nsACString& aProvider,
nsresult SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aAllUsers, const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
nsresult SelectProviderForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
NS_IMETHOD CheckProviderVersion (const nsACString& aProviderType,
nsresult GetSelectedProvider(const nsACString& aPackage,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
nsACString& aResult);
nsresult CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible);
NS_IMETHOD IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsresult IsProviderSelected(const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult);
NS_IMETHOD IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
nsresult IsProviderSelectedForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD IsProviderSetForPackage(const nsACString& aProvider,
nsresult IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD InstallProvider(const nsACString& aProviderType,
nsresult InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts, PRBool aRemove);
NS_IMETHOD UninstallProvider(const nsACString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
nsresult UninstallProvider(const nsACString& aProviderType, const nsACString& aProviderName, PRBool aUseProfile);
nsresult ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength);
PRBool GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource);
protected:
PRBool mInstallInitialized;
PRBool mProfileInitialized;
PRBool mUseXBLForms;
PRBool mRuntimeProvider;
nsCString mProfileRoot;
nsCString mInstallRoot;
@ -207,10 +217,6 @@ protected:
nsIRDFService* mRDFService;
nsIRDFContainerUtils* mRDFContainerUtils;
// Boolean that indicates we should batch flushes of the main
// chrome.rdf file.
PRBool mBatchInstallFlushes;
// Resources
nsCOMPtr<nsIRDFResource> mSelectedSkin;
nsCOMPtr<nsIRDFResource> mSelectedLocale;
@ -232,5 +238,19 @@ protected:
nsCOMPtr<nsICSSStyleSheet> mUserChromeSheet;
nsCOMPtr<nsICSSStyleSheet> mUserContentSheet;
nsCOMPtr<nsICSSStyleSheet> mFormSheet;
PRBool mUseXBLForms;
PRPackedBool mInstallInitialized;
PRPackedBool mProfileInitialized;
PRPackedBool mRuntimeProvider;
// Boolean that indicates we should batch flushes of the main
// chrome.rdf file.
PRPackedBool mBatchInstallFlushes;
// make sure we only look once for the JAR override
PRPackedBool mSearchedForOverride;
};

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

@ -3777,36 +3777,31 @@ nsEditorShell::InitSpellChecker()
// Tell the spellchecker what dictionary to use:
PRUnichar *dictName = nsnull;
nsXPIDLString dictName;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &result));
if (NS_SUCCEEDED(result) && prefs)
result = prefs->CopyUnicharPref("spellchecker.dictionary", &dictName);
result = prefs->CopyUnicharPref("spellchecker.dictionary",
getter_Copies(dictName));
if (! dictName || ! *dictName)
if (NS_FAILED(result) || dictName.IsEmpty())
{
// Prefs didn't give us a dictionary name, so just get the current
// locale and use that as the default dictionary name!
if (dictName)
{
nsMemory::Free(dictName);
dictName = nsnull;
}
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &result);
if (NS_SUCCEEDED(result) && packageRegistry)
result = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("navigator").get(), &dictName);
if (NS_SUCCEEDED(result) && packageRegistry) {
nsCAutoString utf8DictName;
result = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("navigator"), utf8DictName);
dictName = NS_ConvertUTF8toUCS2(utf8DictName);
}
}
if (NS_SUCCEEDED(result) && dictName && *dictName)
result = SetCurrentDictionary(dictName);
if (dictName)
nsMemory::Free(dictName);
if (NS_SUCCEEDED(result) && !dictName.IsEmpty())
result = SetCurrentDictionary(dictName.get());
// If an error was thrown while checking the dictionary pref, just
// fail silently so that the spellchecker dialog is allowed to come

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

@ -559,8 +559,8 @@ nsMsgMailSession::GetSelectedLocaleDataDir(nsIFile *defaultsDir)
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1", &rv);
if (NS_SUCCEEDED(rv)) {
nsXPIDLString localeName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
nsCAutoString localeName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global-region"), localeName);
if (NS_SUCCEEDED(rv) && !localeName.IsEmpty()) {
PRBool localeDirExists = PR_FALSE;
@ -569,7 +569,7 @@ nsMsgMailSession::GetSelectedLocaleDataDir(nsIFile *defaultsDir)
rv = defaultsDir->Clone(getter_AddRefs(localeDataDir));
NS_ENSURE_SUCCESS(rv,rv);
rv = localeDataDir->Append(localeName);
rv = localeDataDir->AppendNative(localeName);
NS_ENSURE_SUCCESS(rv,rv);
rv = localeDataDir->Exists(&localeDirExists);
@ -577,7 +577,7 @@ nsMsgMailSession::GetSelectedLocaleDataDir(nsIFile *defaultsDir)
if (localeDirExists) {
// use locale provider instead
rv = defaultsDir->Append(localeName);
rv = defaultsDir->AppendNative(localeName);
NS_ENSURE_SUCCESS(rv,rv);
}
}

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

@ -467,24 +467,20 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs, PRBool canInteract)
// we shouldn't install them again here. But packageRegistry->GetSelectedLocale() doesn't
// work here properly. It always returns global and global-region of default not current
// profile
const PRUnichar* uilocale = mUILocaleName.get() ;
if (uilocale && uilocale[0]) {
if (!mUILocaleName.IsEmpty()) {
#ifdef DEBUG_profile_verbose
nsCAutoString temp1; temp1.AssignWithConversion(uilocale);
printf(" install new UILocaleName: %s\n", temp1.get());
printf(" install new UILocaleName: %s\n", mUILocaleName.get());
#endif
rv = chromeRegistry->SelectLocaleForProfile(uilocale,
rv = chromeRegistry->SelectLocaleForProfile(mUILocaleName,
NS_ConvertUTF8toUCS2(fileStr).get());
if (NS_FAILED(rv)) return rv;
}
const PRUnichar* contentlocale = mContentLocaleName.get() ;
if (contentlocale && contentlocale[0]) {
if (!mContentLocaleName.IsEmpty()) {
#ifdef DEBUG_profile_verbose
nsCAutoString temp2; temp2.AssignWithConversion(contentlocale);
printf(" install new mContentLocaleName: %s\n", temp2.get());
printf(" install new mContentLocaleName: %s\n", mContentLocaleName.get());
#endif
rv = chromeRegistry->SelectLocaleForProfile(contentlocale,
rv = chromeRegistry->SelectLocaleForProfile(mContentLocaleName,
NS_ConvertUTF8toUCS2(fileStr).get());
if (NS_FAILED(rv)) return rv;
}
@ -758,7 +754,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
{
if (cmdResult) {
mIsUILocaleSpecified = PR_TRUE;
mUILocaleName.AssignWithConversion(cmdResult);
mUILocaleName = cmdResult;
}
}
@ -768,7 +764,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
{
if (cmdResult) {
mIsContentLocaleSpecified = PR_TRUE;
mContentLocaleName.AssignWithConversion(cmdResult);
mContentLocaleName = cmdResult;
}
}
@ -1627,41 +1623,44 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
const PRUnichar* uiLocale = aUILocale;
const PRUnichar* contentLocale = aContentLocale;
nsXPIDLString currentUILocaleName;
nsXPIDLString currentContentLocaleName;
nsCAutoString uiLocale; uiLocale.AssignWithConversion(aUILocale);
nsCAutoString contentLocale; contentLocale.AssignWithConversion(aContentLocale);
// When aUILocale == null or aContentLocale == null, set those from default values
// which are from default or from command line options
// When aUILocale == null or aContentLocale == null, set those
// from default values which are from default or from command
// line options
// This fallback is for CreateNewProfile() of CreateDefaultProfile() and ProcessArgs()
// Those functions call CreateNewProfile(locale=null). We should consider default values
// or specified values of locales for CreateDefaultProfile() and ProcessArgs().
// This fallback is for CreateNewProfile() of
// CreateDefaultProfile() and ProcessArgs() Those functions
// call CreateNewProfile(locale=null). We should consider
// default values or specified values of locales for
// CreateDefaultProfile() and ProcessArgs().
// We can get preferred UILocale and contentLocale (specified -UILocale and -contentLocale)
// by GetSelectedLocale() which is done in nsAppRunner.cpp::InstallGlobalLocale()
// We can get preferred UILocale and contentLocale (specified
// -UILocale and -contentLocale) by GetSelectedLocale() which
// is done in nsAppRunner.cpp::InstallGlobalLocale()
nsCOMPtr<nsIXULChromeRegistry> packageRegistry = do_QueryInterface(chromeRegistry);
if ((!aUILocale || !aUILocale[0]) && packageRegistry) {
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global").get(),
getter_Copies(currentUILocaleName));
nsCAutoString currentUILocaleName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"),
currentUILocaleName);
if (NS_SUCCEEDED(rv)) {
uiLocale = currentUILocaleName.get();
uiLocale = currentUILocaleName;
}
}
if (!aContentLocale || !aContentLocale[0]) {
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(),
getter_Copies(currentContentLocaleName));
nsCAutoString currentContentLocaleName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global-region"),
currentContentLocaleName);
if (NS_SUCCEEDED(rv)) {
contentLocale = currentContentLocaleName.get();
contentLocale = currentContentLocaleName;
}
}
#if defined(DEBUG_profile_verbose)
nsCAutoString temp1; temp1.AssignWithConversion(uiLocale);
printf(" uiLocale=%s\n", temp1.get());
printf(" uiLocale=%s\n", uiLocale.get());
nsCAutoString temp2; temp2.AssignWithConversion(contentLocale);
printf(" contentLocale=%s\n", temp2.get());
@ -1675,7 +1674,7 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
rv = NS_GetURLSpecFromFile(profileDir, fileStr);
if (NS_FAILED(rv)) return rv;
if (uiLocale && uiLocale[0]) {
if (!uiLocale.IsEmpty()) {
rv = chromeRegistry->SelectLocaleForProfile(uiLocale,
NS_ConvertUTF8toUCS2(fileStr).get());
// Remember which profile has been created with the UILocale
@ -1686,13 +1685,13 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
}
}
if (contentLocale && contentLocale[0]) {
if (!contentLocale.IsEmpty()) {
// caller prefers locale subdir
nsCOMPtr<nsIFile> locProfDefaultsDir;
rv = profDefaultsDir->Clone(getter_AddRefs(locProfDefaultsDir));
if (NS_FAILED(rv)) return rv;
locProfDefaultsDir->Append(nsDependentString(contentLocale));
locProfDefaultsDir->AppendNative(contentLocale);
rv = locProfDefaultsDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists) {
profDefaultsDir = locProfDefaultsDir; // transfers ownership
@ -2129,10 +2128,10 @@ nsProfile::DefineLocaleDefaultsDir()
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{
nsXPIDLString localeName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
nsCAutoString localeName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global-region"), localeName);
if (NS_SUCCEEDED(rv))
rv = localeDefaults->Append(localeName);
rv = localeDefaults->AppendNative(localeName);
}
(void) directoryService->Undefine(NS_APP_PROFILE_DEFAULTS_50_DIR);
rv = directoryService->Define(NS_APP_PROFILE_DEFAULTS_50_DIR, localeDefaults);

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

@ -62,7 +62,7 @@ interface nsIChromeRegistry : nsISupports
*
* @param aChromeURL the URL that is to be converted.
*/
string convertChromeURL(in nsIURI aChromeURL);
AUTF8String convertChromeURL(in nsIURI aChromeURL);
/**
* get the style sheets for a specific chrome URL
@ -89,15 +89,15 @@ interface nsIChromeRegistry : nsISupports
interface nsIXULChromeRegistry : nsIChromeRegistry {
/* Applies a skin or locale to all possible packages */
void selectSkin(in wstring skinName, in boolean useProfile);
void selectLocale(in wstring localeName, in boolean useProfile);
void deselectSkin(in wstring skinName, in boolean useProfile);
void deselectLocale(in wstring localeName, in boolean useProfile);
PRInt32 isSkinSelected(in wstring skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in wstring localeName, in boolean useProfile);
void selectSkin(in ACString skinName, in boolean useProfile);
void selectLocale(in ACString localeName, in boolean useProfile);
void deselectSkin(in ACString skinName, in boolean useProfile);
void deselectLocale(in ACString localeName, in boolean useProfile);
PRInt32 isSkinSelected(in ACString skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in ACString localeName, in boolean useProfile);
// Special additional APIs for locales only.
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
void selectLocaleForProfile(in ACString localeName, in wstring profilePath);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
@ -109,31 +109,33 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
boolean checkLocaleVersion(in wstring localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName,
void selectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in wstring localeName,
void selectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in wstring skinName,
void deselectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName,
void deselectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName,
boolean isSkinSelectedForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName,
boolean isLocaleSelectedForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
wstring getSelectedLocale(in wstring packageName);
ACString getSelectedLocale(in ACString packageName);
ACString getSelectedSkin(in ACString packageName);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/* Should be called when skins change. Reloads only stylesheets. */
@ -146,10 +148,10 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
in boolean useProfile,
in boolean allowScripts);
void uninstallSkin(in wstring skinName, in boolean useProfile);
void uninstallSkin(in ACString skinName, in boolean useProfile);
void installLocale(in string baseURL, in boolean useProfile);
void uninstallLocale(in wstring localeName, in boolean useProfile);
void uninstallLocale(in ACString localeName, in boolean useProfile);
void installPackage(in string baseURL, in boolean useProfile);
void uninstallPackage(in wstring packageName, in boolean useProfile);

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

@ -636,8 +636,8 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
//aURI->GetSpec(getter_Copies(oldSpec));
//printf("*************************** %s\n", (const char*)oldSpec);
nsXPIDLCString spec;
rv = reg->ConvertChromeURL(aURI, getter_Copies(spec));
nsCAutoString spec;
rv = reg->ConvertChromeURL(aURI, spec);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIIOService> ioServ(do_GetService(kIOServiceCID, &rv));

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

@ -246,17 +246,16 @@ NS_IMETHODIMP nsOverlayEnumerator::GetNext(nsISupports **aResult)
////////////////////////////////////////////////////////////////////////////////
nsChromeRegistry::nsChromeRegistry() : mRDFService(nsnull),
mRDFContainerUtils(nsnull)
mRDFContainerUtils(nsnull),
mUseXBLForms(PR_FALSE),
mInstallInitialized(PR_FALSE),
mProfileInitialized(PR_FALSE),
mRuntimeProvider(PR_FALSE),
mBatchInstallFlushes(PR_FALSE),
mSearchedForOverride(PR_FALSE)
{
NS_INIT_REFCNT();
mInstallInitialized = PR_FALSE;
mProfileInitialized = PR_FALSE;
mUseXBLForms = PR_FALSE;
mBatchInstallFlushes = PR_FALSE;
mRuntimeProvider = PR_FALSE;
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID));
if (prefService)
prefService->GetBoolPref(kUseXBLFormsPref, &mUseXBLForms);
@ -511,7 +510,7 @@ nsChromeRegistry::Canonify(nsIURI* aChromeURI)
}
NS_IMETHODIMP
nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult)
nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, nsACString& aResult)
{
nsresult rv = NS_OK;
NS_ASSERTION(aChromeURL, "null url!");
@ -576,14 +575,15 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult)
}
}
*aResult = ToNewCString(finalURL + remaining);
aResult = finalURL + remaining;
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL)
nsresult
nsChromeRegistry::GetBaseURL(const nsACString& aPackage,
const nsACString& aProvider,
nsACString& aBaseURL)
{
nsCOMPtr<nsIRDFResource> resource;
@ -665,7 +665,7 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
}
// locate
NS_IMETHODIMP
nsresult
nsChromeRegistry::FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
@ -717,7 +717,7 @@ nsChromeRegistry::FindProvider(const nsACString& aPackage,
if (kid) {
// get its name
nsCAutoString providerName;
rv = nsChromeRegistry::FollowArc(mChromeDataSource, providerName, kid, mName);
rv = FollowArc(mChromeDataSource, providerName, kid, mName);
if (NS_FAILED(rv)) return rv;
// get its package list
@ -742,7 +742,7 @@ nsChromeRegistry::FindProvider(const nsACString& aPackage,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsACString& aPackage,
const nsACString& aProvider,
@ -793,7 +793,7 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
// get its name
nsCAutoString packageName;
rv = nsChromeRegistry::FollowArc(mChromeDataSource, packageName, package, mName);
rv = FollowArc(mChromeDataSource, packageName, package, mName);
if (NS_FAILED(rv))
continue; // don't fail if package has not yet been installed
@ -803,7 +803,7 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
useProfile = PR_FALSE; // Always force the auto-selection to be in the
// install dir for the packages required to bring up the profile UI.
rv = SelectProviderForPackage(aProvider,
NS_ConvertASCIItoUCS2(aProviderName).get(),
aProviderName,
NS_ConvertASCIItoUCS2(packageName).get(),
aArc, useProfile, PR_TRUE);
if (NS_FAILED(rv))
@ -818,8 +818,11 @@ nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile,
PRBool aCreateDS, nsIRDFDataSource **aResult)
nsresult
nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL,
PRBool aIsOverlay, PRBool aUseProfile,
PRBool aCreateDS,
nsIRDFDataSource **aResult)
{
*aResult = nsnull;
@ -879,7 +882,9 @@ NS_IMETHODIMP nsChromeRegistry::GetDynamicDataSource(nsIURI *aChromeURL, PRBool
return LoadDataSource(overlayFile, aResult, aUseProfile, nsnull);
}
NS_IMETHODIMP nsChromeRegistry::GetStyleSheets(nsIURI *aChromeURL, nsISupportsArray **aResult)
nsresult
nsChromeRegistry::GetStyleSheets(nsIURI *aChromeURL,
nsISupportsArray **aResult)
{
*aResult = nsnull;
@ -919,7 +924,9 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlays(nsIURI *aChromeURL, nsISimpleEnumera
return GetDynamicInfo(aChromeURL, PR_TRUE, aResult);
}
NS_IMETHODIMP nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult)
nsresult
nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay,
nsISimpleEnumerator **aResult)
{
*aResult = nsnull;
@ -983,7 +990,8 @@ NS_IMETHODIMP nsChromeRegistry::GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOve
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
nsresult
nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
nsIRDFDataSource **aResult,
PRBool aUseProfileDir,
const char *aProfilePath)
@ -1078,7 +1086,7 @@ nsChromeRegistry::GetResource(const nsCString& aURL,
nsresult
nsChromeRegistry::FollowArc(nsIRDFDataSource *aDataSource,
nsCString& aResult,
nsACString& aResult,
nsIRDFResource* aChromeResource,
nsIRDFResource* aProperty)
{
@ -1112,7 +1120,7 @@ nsChromeRegistry::FollowArc(nsIRDFDataSource *aDataSource,
const PRUnichar *s;
rv = literal->GetValueConst(&s);
if (NS_FAILED(rv)) return rv;
aResult.AssignWithConversion(s);
aResult.Assign(NS_ConvertUCS2toUTF8(s));
}
else {
// This should _never_ happen.
@ -1236,7 +1244,7 @@ static PRBool IsChromeURI(nsIURI* aURI)
return PR_FALSE;
}
NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
{
// Deal with our subframes first.
nsCOMPtr<nsIDOMWindowCollection> frames;
@ -1379,7 +1387,8 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
nsresult
nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
const PRUnichar *aOverlayURI,
PRBool aIsOverlay,
PRBool aUseProfile,
@ -1484,8 +1493,11 @@ NS_IMETHODIMP nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
return rv;
}
NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataSource, nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove)
nsresult
nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
nsIRDFResource *aResource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove)
{
nsCOMPtr<nsIRDFContainer> container;
nsresult rv;
@ -1536,8 +1548,10 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataS
}
NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove)
nsresult
nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove)
{
nsresult rv;
nsCOMPtr<nsIRDFResource> resource;
@ -1587,19 +1601,19 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aData
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const nsACString& aSkin,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const nsACString& aLocale,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const nsACString& aLocale,
const PRUnichar *aProfilePath)
{
// to be changed to use given path
@ -1615,9 +1629,30 @@ NS_IMETHODIMP nsChromeRegistry::SetRuntimeProvider(PRBool runtimeProvider)
}
/* wstring getSelectedLocale (); */
NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
PRUnichar **_retval)
/* ACString getSelectedLocale (ACString packageName); */
NS_IMETHODIMP
nsChromeRegistry::GetSelectedLocale(const nsACString& aPackageName,
nsACString& aResult)
{
return GetSelectedProvider(aPackageName,
NS_LITERAL_CSTRING("locale"), mSelectedLocale,
aResult);
}
NS_IMETHODIMP
nsChromeRegistry::GetSelectedSkin(const nsACString& aPackageName,
nsACString& aResult)
{
return GetSelectedProvider(aPackageName,
NS_LITERAL_CSTRING("skin"), mSelectedSkin,
aResult);
}
nsresult
nsChromeRegistry::GetSelectedProvider(const nsACString& aPackageName,
const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
nsACString& _retval)
{
// check if mChromeDataSource is null; do we need to apply this to every instance?
// is there a better way to test if the data source is ready?
@ -1625,9 +1660,8 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
return NS_ERROR_FAILURE;
}
nsString packageStr(aPackageName);
nsCAutoString resourceStr("urn:mozilla:package:");
resourceStr += NS_ConvertUCS2toUTF8(packageStr.get());
resourceStr += aPackageName;
// Obtain the resource.
nsresult rv = NS_OK;
@ -1643,13 +1677,13 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
// Follow the "selectedLocale" arc.
nsCOMPtr<nsIRDFNode> selectedProvider;
if (NS_FAILED(rv = mChromeDataSource->GetTarget(resource, mSelectedLocale, PR_TRUE, getter_AddRefs(selectedProvider)))) {
if (NS_FAILED(rv = mChromeDataSource->GetTarget(resource, aSelectionArc, PR_TRUE, getter_AddRefs(selectedProvider)))) {
NS_ERROR("Unable to obtain the provider.");
return rv;
}
if (!selectedProvider) {
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), NS_LITERAL_CSTRING("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
rv = FindProvider(aPackageName, aProvider, aSelectionArc, getter_AddRefs(selectedProvider));
if (!selectedProvider)
return rv;
}
@ -1664,48 +1698,40 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
return rv;
// trim down to "urn:mozilla:locale:ja-JP"
nsAutoString ustr = NS_ConvertUTF8toUCS2(uri);
nsCAutoString packageStr(":");
packageStr += aPackageName;
packageStr.Insert(PRUnichar(':'), 0);
nsCAutoString ustr(uri);
PRInt32 pos = ustr.RFind(packageStr);
nsString urn;
nsCAutoString urn;
ustr.Left(urn, pos);
rv = GetResource(NS_ConvertUCS2toUTF8(urn.get()), getter_AddRefs(resource));
rv = GetResource(urn, getter_AddRefs(resource));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to obtain the provider resource.");
return rv;
}
// From this resource, follow the "name" arc.
nsCAutoString lc_name; // is this i18n friendly? RDF now use UTF8 internally
rv = nsChromeRegistry::FollowArc(mChromeDataSource,
lc_name,
resource,
mName);
if (NS_FAILED(rv)) return rv;
// this is not i18n friendly? RDF now use UTF8 internally.
*_retval = ToNewUnicode(lc_name);
return NS_OK;
return FollowArc(mChromeDataSource, _retval, resource, mName);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const nsACString& aSkin,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const nsACString& aLocale,
PRBool aUseProfile)
{
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsresult
nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aUseProfile, const char *aProfilePath,
PRBool aIsAdding)
{
@ -1714,7 +1740,7 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsCAutoString resourceStr( "urn:mozilla:" );
resourceStr += aProvider;
resourceStr += ":";
resourceStr.AppendWithConversion(aProviderName);
resourceStr += aProviderName;
// Obtain the provider resource.
nsresult rv = NS_OK;
@ -1792,7 +1818,7 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
@ -1825,51 +1851,51 @@ nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
return rv;
}
NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const PRUnichar *aSkin,
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const nsACString& aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const PRUnichar *aLocale,
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const nsACString& aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
@ -1880,7 +1906,7 @@ nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
nsCAutoString provider( "urn:mozilla:" );
provider += aProviderType;
provider += ":";
provider.AppendWithConversion(aProviderName);
provider += aProviderName;
provider += ":";
provider.AppendWithConversion(aPackageName);
@ -1929,20 +1955,21 @@ nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
aUseProfile, nsnull, aIsAdding);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const PRUnichar* aSkin,
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const nsACString& aSkin,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(NS_LITERAL_CSTRING("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const PRUnichar* aLocale,
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const nsACString& aLocale,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(NS_LITERAL_CSTRING("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsresult
nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult)
{
@ -1952,7 +1979,7 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
nsCAutoString resourceStr( "urn:mozilla:" );
resourceStr += aProvider;
resourceStr += ":";
resourceStr.AppendWithConversion(aProviderName);
resourceStr += aProviderName;
// Obtain the provider resource.
nsresult rv = NS_OK;
nsCOMPtr<nsIRDFResource> resource;
@ -2029,9 +2056,9 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult)
@ -2043,7 +2070,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
nsCAutoString provider( "urn:mozilla:" );
provider += aProviderType;
provider += ":";
provider.AppendWithConversion(aProviderName);
provider += aProviderName;
provider += ":";
provider.AppendWithConversion(aPackageName);
@ -2070,7 +2097,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
aUseProfile, aResult);
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
@ -2096,7 +2123,8 @@ nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
nsresult
nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts,
PRBool aRemove)
@ -2486,7 +2514,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallPackage(const char* aBaseURL, PRBool aUse
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool aUseProfile)
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const nsACString& aSkinName, PRBool aUseProfile)
{
// The skin must first be deselected.
DeselectSkin(aSkinName, aUseProfile);
@ -2495,7 +2523,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool
return UninstallProvider(NS_LITERAL_CSTRING("skin"), aSkinName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PRBool aUseProfile)
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const nsACString& aLocaleName, PRBool aUseProfile)
{
// The locale must first be deselected.
DeselectLocale(aLocaleName, aUseProfile);
@ -2509,9 +2537,9 @@ NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aUseProfile)
{
// XXX We are going to simply do a snip of the arc from the seq ROOT to
@ -2529,8 +2557,7 @@ nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
// Obtain the child we wish to remove.
nsCAutoString specificChild(prefix);
nsCAutoString provName; provName.AssignWithConversion(aProviderName);
specificChild += provName;
specificChild += aProviderName;
// Instantiate the data source we wish to modify.
nsCOMPtr<nsIRDFDataSource> installSource;
@ -2568,8 +2595,8 @@ nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::GetProfileRoot(nsCString& aFileURL)
nsresult
nsChromeRegistry::GetProfileRoot(nsACString& aFileURL)
{
nsresult rv;
nsCOMPtr<nsIFile> userChromeDir;
@ -2622,19 +2649,10 @@ nsChromeRegistry::GetProfileRoot(nsCString& aFileURL)
return NS_GetURLSpecFromFile(userChromeDir, aFileURL);
}
NS_IMETHODIMP
nsChromeRegistry::GetInstallRoot(nsCString& aFileURL)
nsresult
nsChromeRegistry::GetInstallRoot(nsIFile** aFileURL)
{
nsresult rv;
nsCOMPtr<nsIFile> appChromeDir;
// Build a fileSpec that points to the destination
// (bin dir + chrome)
rv = NS_GetSpecialDirectory(NS_APP_CHROME_DIR, getter_AddRefs(appChromeDir));
if (NS_FAILED(rv) || !appChromeDir)
return NS_ERROR_FAILURE;
return NS_GetURLSpecFromFile(appChromeDir, aFileURL);
return NS_GetSpecialDirectory(NS_APP_CHROME_DIR, aFileURL);
}
NS_IMETHODIMP
@ -2693,7 +2711,7 @@ nsChromeRegistry::ReloadChrome()
return rv;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::GetArcs(nsIRDFDataSource* aDataSource,
const nsCString& aType,
nsISimpleEnumerator** aResult)
@ -2728,7 +2746,7 @@ nsChromeRegistry::GetArcs(nsIRDFDataSource* aDataSource,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile)
{
nsresult rv = NS_OK;
@ -2891,7 +2909,7 @@ nsresult nsChromeRegistry::LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet*
return NS_OK;
}
nsresult nsChromeRegistry::GetUserSheetURL(PRBool aIsChrome, nsCString & aURL)
nsresult nsChromeRegistry::GetUserSheetURL(PRBool aIsChrome, nsACString & aURL)
{
aURL = mProfileRoot;
if (aIsChrome)
@ -2910,8 +2928,14 @@ nsresult nsChromeRegistry::GetFormSheetURL(nsCString& aURL)
nsresult nsChromeRegistry::LoadInstallDataSource()
{
nsresult rv = GetInstallRoot(mInstallRoot);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFile> installRootFile;
nsresult rv = GetInstallRoot(getter_AddRefs(installRootFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_GetURLSpecFromFile(installRootFile, mInstallRoot);
NS_ENSURE_SUCCESS(rv, rv);
mInstallInitialized = PR_TRUE;
return AddToCompositeDataSource(PR_FALSE);
}
@ -2932,8 +2956,8 @@ nsresult nsChromeRegistry::LoadProfileDataSource()
// Select and Remove skins based on a pref set in a previous session.
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID));
if (pref) {
nsXPIDLString skinToSelect;
rv = pref->CopyUnicharPref("general.skins.selectedSkin", getter_Copies(skinToSelect));
nsXPIDLCString skinToSelect;
rv = pref->CopyCharPref("general.skins.selectedSkin", getter_Copies(skinToSelect));
if (NS_SUCCEEDED(rv)) {
rv = SelectSkin(skinToSelect, PR_TRUE);
if (NS_SUCCEEDED(rv))
@ -3189,9 +3213,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
// process the line
if (skin.Equals(chromeType)) {
if (isSelection) {
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectSkin(name.get(), isProfile);
rv = SelectSkin(nsDependentCString(chromeLocation), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
#endif
@ -3203,9 +3226,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
rv = InstallPackage(chromeURL.get(), isProfile);
else if (locale.Equals(chromeType)) {
if (isSelection) {
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectLocale(name.get(), isProfile);
rv = SelectLocale(nsDependentCString(chromeLocation), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
#endif
@ -3303,7 +3325,8 @@ NS_IMETHODIMP nsChromeRegistry::CheckLocaleVersion(const PRUnichar *aLocale,
}
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
nsresult
nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible)

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

@ -81,29 +81,36 @@ public:
public:
static nsresult FollowArc(nsIRDFDataSource *aDataSource,
nsCString& aResult, nsIRDFResource* aChromeResource,
nsACString& aResult,
nsIRDFResource* aChromeResource,
nsIRDFResource* aProperty);
static nsresult UpdateArc(nsIRDFDataSource *aDataSource, nsIRDFResource* aSource, nsIRDFResource* aProperty,
nsIRDFNode *aTarget, PRBool aRemove);
protected:
NS_IMETHOD GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
NS_IMETHOD GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
nsresult GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
nsresult GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
nsresult GetResource(const nsCString& aChromeType, nsIRDFResource** aResult);
NS_IMETHOD UpdateDynamicDataSource(nsIRDFDataSource *aDataSource, nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
NS_IMETHOD UpdateDynamicDataSources(nsIRDFDataSource *aDataSource, PRBool aIsOverlay,
PRBool aUseProfile, PRBool aRemove);
NS_IMETHOD WriteInfoToDataSource(const char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
nsresult UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
nsIRDFResource *aResource,
PRBool aIsOverlay, PRBool
aUseProfile, PRBool aRemove);
nsresult UpdateDynamicDataSources(nsIRDFDataSource *aDataSource,
PRBool aIsOverlay,
PRBool aUseProfile, PRBool
aRemove);
nsresult WriteInfoToDataSource(const char *aDocURI,
const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool
aUseProfile, PRBool aRemove);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString & aURL);
nsresult LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet);
nsresult GetUserSheetURL(PRBool aIsChrome, nsCString & aURL);
nsresult GetUserSheetURL(PRBool aIsChrome, nsACString & aURL);
nsresult GetFormSheetURL(nsCString& aURL);
nsresult LoadInstallDataSource();
@ -112,91 +119,94 @@ protected:
nsresult FlushCaches();
private:
NS_IMETHOD LoadDataSource(const nsACString &aFileName, nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE, const char *aProfilePath = nsnull);
nsresult LoadDataSource(const nsACString &aFileName,
nsIRDFDataSource **aResult,
PRBool aUseProfileDirOnly = PR_FALSE,
const char *aProfilePath = nsnull);
NS_IMETHOD GetProfileRoot(nsCString& aFileURL);
NS_IMETHOD GetInstallRoot(nsCString& aFileURL);
static nsresult GetProfileRoot(nsACString& aFileURL);
static nsresult GetInstallRoot(nsIFile** aFileURL);
NS_IMETHOD RefreshWindow(nsIDOMWindowInternal* aWindow);
nsresult RefreshWindow(nsIDOMWindowInternal* aWindow);
NS_IMETHOD GetArcs(nsIRDFDataSource* aDataSource,
nsresult GetArcs(nsIRDFDataSource* aDataSource,
const nsCString& aType,
nsISimpleEnumerator** aResult);
NS_IMETHOD AddToCompositeDataSource(PRBool aUseProfile);
nsresult AddToCompositeDataSource(PRBool aUseProfile);
NS_IMETHOD GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL);
nsresult GetBaseURL(const nsACString& aPackage,
const nsACString& aProvider,
nsACString& aBaseURL);
NS_IMETHOD FindProvider(const nsACString& aPackage,
nsresult FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SelectPackageInProvider(nsIRDFResource *aPackageList,
nsresult SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SetProvider(const nsACString& aProvider,
nsresult SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
const nsACString& aProviderName,
PRBool aAllUsers,
const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SetProviderForPackage(const nsACString& aProvider,
nsresult SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aAllUsers, const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
nsresult SelectProviderForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
NS_IMETHOD CheckProviderVersion (const nsACString& aProviderType,
nsresult GetSelectedProvider(const nsACString& aPackage,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
nsACString& aResult);
nsresult CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible);
NS_IMETHOD IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsresult IsProviderSelected(const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult);
NS_IMETHOD IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
nsresult IsProviderSelectedForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD IsProviderSetForPackage(const nsACString& aProvider,
nsresult IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD InstallProvider(const nsACString& aProviderType,
nsresult InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts, PRBool aRemove);
NS_IMETHOD UninstallProvider(const nsACString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
nsresult UninstallProvider(const nsACString& aProviderType, const nsACString& aProviderName, PRBool aUseProfile);
nsresult ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength);
PRBool GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource);
protected:
PRBool mInstallInitialized;
PRBool mProfileInitialized;
PRBool mUseXBLForms;
PRBool mRuntimeProvider;
nsCString mProfileRoot;
nsCString mInstallRoot;
@ -207,10 +217,6 @@ protected:
nsIRDFService* mRDFService;
nsIRDFContainerUtils* mRDFContainerUtils;
// Boolean that indicates we should batch flushes of the main
// chrome.rdf file.
PRBool mBatchInstallFlushes;
// Resources
nsCOMPtr<nsIRDFResource> mSelectedSkin;
nsCOMPtr<nsIRDFResource> mSelectedLocale;
@ -232,5 +238,19 @@ protected:
nsCOMPtr<nsICSSStyleSheet> mUserChromeSheet;
nsCOMPtr<nsICSSStyleSheet> mUserContentSheet;
nsCOMPtr<nsICSSStyleSheet> mFormSheet;
PRBool mUseXBLForms;
PRPackedBool mInstallInitialized;
PRPackedBool mProfileInitialized;
PRPackedBool mRuntimeProvider;
// Boolean that indicates we should batch flushes of the main
// chrome.rdf file.
PRPackedBool mBatchInstallFlushes;
// make sure we only look once for the JAR override
PRPackedBool mSearchedForOverride;
};

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

@ -1113,11 +1113,10 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
rv = cmdLineArgs->GetCmdLineValue(UILOCALE_CMD_LINE_ARG, getter_Copies(cmdUI));
if (NS_SUCCEEDED(rv)){
if (cmdUI) {
nsAutoString UILocaleName;
UILocaleName.AssignWithConversion(cmdUI);
nsCAutoString UILocaleName(cmdUI);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry)
rv = chromeRegistry->SelectLocale(UILocaleName.get(), PR_FALSE);
rv = chromeRegistry->SelectLocale(UILocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
@ -1125,7 +1124,7 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(uiLang.get(), PR_FALSE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(uiLang), PR_FALSE);
}
}
@ -1133,11 +1132,10 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
rv = cmdLineArgs->GetCmdLineValue(CONTENTLOCALE_CMD_LINE_ARG, getter_Copies(cmdContent));
if (NS_SUCCEEDED(rv)){
if (cmdContent) {
nsAutoString ContentLocaleName;
ContentLocaleName.AssignWithConversion(cmdContent);
nsCAutoString contentLocaleName(cmdContent);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if(chromeRegistry)
rv = chromeRegistry->SelectLocale(ContentLocaleName.get(), PR_FALSE);
rv = chromeRegistry->SelectLocale(contentLocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
@ -1145,7 +1143,7 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(country.get(), PR_FALSE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(country), PR_FALSE);
}
}

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

@ -567,7 +567,8 @@ extern "C" void RunChromeInstallOnThread(void *data)
rv = reg->InstallSkin(spec.get(), PR_TRUE, PR_FALSE);
if (NS_SUCCEEDED(rv) && selected)
{
rv = reg->SelectSkin(info->GetArguments(), PR_TRUE);
NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
rv = reg->SelectSkin(utf8Args, PR_TRUE);
}
}
@ -576,7 +577,8 @@ extern "C" void RunChromeInstallOnThread(void *data)
rv = reg->InstallLocale(spec.get(), PR_TRUE);
if (NS_SUCCEEDED(rv) && selected)
{
rv = reg->SelectLocale(info->GetArguments(), PR_TRUE);
NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
rv = reg->SelectLocale(utf8Args, PR_TRUE);
}
}