fix for bug 119923 - split nsIChromeRegistry into 2 interfaces, one that is XUL-specific

this way we can implement an minimal chrome registry for embedding, that doesn't support all the wacky skin- and locale-switching goodness of XUL.
r=waterson, sr=hyatt
This commit is contained in:
alecf%netscape.com 2002-04-12 01:52:27 +00:00
Родитель b6a8eb0c42
Коммит fba198f16c
21 изменённых файлов: 360 добавлений и 289 удалений

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

@ -64,39 +64,88 @@ interface nsIChromeRegistry : nsISupports
*/
string convertChromeURL(in nsIURI aChromeURL);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/**
* get the style sheets for a specific chrome URL
*/
nsISupportsArray getStyleSheets(in nsIURI aChromeURL);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
/**
* get the user-specified style sheets
*/
nsISupportsArray getUserSheets(in boolean useChromeSheets);
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();
/**
* get the style sheets required for a specific running docshell
*/
nsISupportsArray getAgentSheets(in nsIDocShell docShell);
/**
* refresh the chrome list at runtime, looking for new packages/etc
*/
void checkForNewChrome();
};
[scriptable, uuid(a9f92623-5982-4afe-9d90-619cf5b0c39f)]
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 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);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
void selectLocaleForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
void deselectSkinForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
// Special additional APIs for locales only.
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
wstring getSelectedLocale(in wstring packageName);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
/* runtimeProvider == true: don't assert the runtime change */
void setRuntimeProvider(in boolean runtimeProvider);
boolean checkThemeVersion(in wstring skinName);
boolean checkLocaleVersion(in wstring localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
wstring getSelectedLocale(in wstring packageName);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();
boolean allowScriptsForSkin(in nsIURI url);
/* Installation APIs */
void installSkin(in string baseURL, in boolean useProfile, in boolean allowScripts);
void installSkin(in string baseURL,
in boolean useProfile,
in boolean allowScripts);
void uninstallSkin(in wstring skinName, in boolean useProfile);
void installLocale(in string baseURL, in boolean useProfile);
@ -104,21 +153,8 @@ interface nsIChromeRegistry : nsISupports
void installPackage(in string baseURL, in boolean useProfile);
void uninstallPackage(in wstring packageName, in boolean useProfile);
void getAgentSheets(in nsIDocShell docShell, out nsISupportsArray styleSheets);
void getUserSheets(in boolean useChromeSheets, out nsISupportsArray styleSheets);
boolean allowScriptsForSkin(in nsIURI url);
void checkForNewChrome();
boolean checkThemeVersion(in wstring skinName);
boolean checkLocaleVersion(in wstring localeName);
};
%{ C++
// for component registration

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

@ -299,7 +299,7 @@ nsChromeRegistry::~nsChromeRegistry()
}
NS_IMPL_THREADSAFE_ISUPPORTS3(nsChromeRegistry, nsIChromeRegistry, nsIObserver, nsISupportsWeakReference);
NS_IMPL_THREADSAFE_ISUPPORTS4(nsChromeRegistry, nsIChromeRegistry, nsIXULChromeRegistry, nsIObserver, nsISupportsWeakReference);
////////////////////////////////////////////////////////////////////////////////
// nsIChromeRegistry methods:
@ -597,10 +597,10 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
// Follow the "selectedSkin" or "selectedLocale" arc.
nsCOMPtr<nsIRDFResource> arc;
if (aProvider.Equals(nsCAutoString("skin"))) {
if (aProvider.Equals(NS_LITERAL_CSTRING("skin"))) {
arc = mSelectedSkin;
}
else if (aProvider.Equals(nsCAutoString("locale"))) {
else if (aProvider.Equals(NS_LITERAL_CSTRING("locale"))) {
arc = mSelectedLocale;
}
else
@ -662,8 +662,8 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
// locate
NS_IMETHODIMP
nsChromeRegistry::FindProvider(const nsCString& aPackage,
const nsCString& aProvider,
nsChromeRegistry::FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider)
{
@ -740,8 +740,8 @@ nsChromeRegistry::FindProvider(const nsCString& aPackage,
NS_IMETHODIMP
nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsCString& aPackage,
const nsCString& aProvider,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider)
@ -1586,20 +1586,20 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aData
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const PRUnichar* aSkin,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const PRUnichar* aLocale,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
const PRUnichar *aProfilePath)
{
// to be changed to use given path
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
}
/* void setRuntimeProvider (in boolean runtimeProvider); */
@ -1645,7 +1645,7 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
}
if (!selectedProvider) {
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), nsCAutoString("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), NS_LITERAL_CSTRING("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
if (!selectedProvider)
return rv;
}
@ -1690,16 +1690,16 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const PRUnichar* aSkin,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const PRUnichar* aLocale,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsCString& aProvider,
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
PRBool aUseProfile, const char *aProfilePath,
@ -1783,13 +1783,13 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsCString& aProvider,
}
if (aProvider.Equals("skin") && mScrollbarSheet)
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::SetProviderForPackage(const nsCString& aProvider,
nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
@ -1826,55 +1826,50 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
nsCAutoString provider("skin");
return IsProviderSelectedForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
nsCAutoString provider("locale");
return IsProviderSelectedForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
NS_IMETHODIMP
nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
{
nsCAutoString package( "urn:mozilla:package:" );
package.AppendWithConversion(aPackageName);
@ -1934,16 +1929,16 @@ NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCString& aProvi
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const PRUnichar* aSkin,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(nsCAutoString("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
return IsProviderSelected(NS_LITERAL_CSTRING("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const PRUnichar* aLocale,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(nsCAutoString("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
return IsProviderSelected(NS_LITERAL_CSTRING("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsCString& aProvider,
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult)
@ -2032,7 +2027,7 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsCString& aProvider,
}
NS_IMETHODIMP
nsChromeRegistry::IsProviderSelectedForPackage(const nsCString& aProviderType,
nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
@ -2073,7 +2068,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsCString& aProviderType,
}
NS_IMETHODIMP
nsChromeRegistry::IsProviderSetForPackage(const nsCString& aProvider,
nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
@ -2099,14 +2094,14 @@ nsChromeRegistry::IsProviderSetForPackage(const nsCString& aProvider,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
const nsCString& aBaseURL,
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts,
PRBool aRemove)
{
// XXX don't allow local chrome overrides of install chrome!
#ifdef DEBUG
printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", aProviderType.get(), aBaseURL.get());
printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", PromiseFlatCString(aProviderType).get(), PromiseFlatCString(aBaseURL).get());
#endif
// Load the data source found at the base URL.
@ -2126,9 +2121,9 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
remote->Init(key.get());
remote->Refresh(PR_TRUE);
PRBool skinCount = GetProviderCount(nsCAutoString("skin"), dataSource);
PRBool localeCount = GetProviderCount(nsCAutoString("locale"), dataSource);
PRBool packageCount = GetProviderCount(nsCAutoString("package"), dataSource);
PRBool skinCount = GetProviderCount(NS_LITERAL_CSTRING("skin"), dataSource);
PRBool localeCount = GetProviderCount(NS_LITERAL_CSTRING("locale"), dataSource);
PRBool packageCount = GetProviderCount(NS_LITERAL_CSTRING("package"), dataSource);
PRBool appendPackage = PR_FALSE;
PRBool appendProvider = PR_FALSE;
@ -2317,7 +2312,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
// See if we're a packages seq in a skin/locale. If so, we need to set up the baseURL, allowScripts
// and package arcs.
if (val.Find(":packages") != -1 && !aProviderType.Equals(nsCAutoString("package"))) {
if (val.Find(":packages") != -1 && !aProviderType.Equals(NS_LITERAL_CSTRING("package"))) {
PRBool doAppendPackage = appendPackage;
PRInt32 perProviderPackageCount;
container->GetCount(&perProviderPackageCount);
@ -2374,7 +2369,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
rv = nsChromeRegistry::UpdateArc(installSource, entry, mBaseURL, baseLiteral, aRemove);
if (NS_FAILED(rv)) return rv;
if (aProviderType.Equals(nsCAutoString("skin")) && !aAllowScripts) {
if (aProviderType.Equals(NS_LITERAL_CSTRING("skin")) && !aAllowScripts) {
rv = nsChromeRegistry::UpdateArc(installSource, entry, mAllowScripts, scriptLiteral, aRemove);
if (NS_FAILED(rv)) return rv;
}
@ -2434,8 +2429,9 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
literal->GetValueConst(&valueStr);
nsAutoString imageURL(valueStr);
if (imageURL.FindChar(':') == -1) {
// We're relative. Prepend the base URL of the package.
nsAutoString fullURL; fullURL.AssignWithConversion(aBaseURL.get());
// We're relative. Prepend the base URL of the
// package.
NS_ConvertUTF8toUCS2 fullURL(aBaseURL);
fullURL += imageURL;
mRDFService->GetLiteral(fullURL.get(), getter_AddRefs(literal));
newTarget = do_QueryInterface(literal);
@ -2470,20 +2466,23 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
NS_IMETHODIMP nsChromeRegistry::InstallSkin(const char* aBaseURL, PRBool aUseProfile, PRBool aAllowScripts)
{
nsCAutoString provider("skin");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, aAllowScripts, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("skin"),
nsDependentCString(aBaseURL),
aUseProfile, aAllowScripts, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::InstallLocale(const char* aBaseURL, PRBool aUseProfile)
{
nsCAutoString provider("locale");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, PR_TRUE, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("locale"),
nsDependentCString(aBaseURL),
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::InstallPackage(const char* aBaseURL, PRBool aUseProfile)
{
nsCAutoString provider("package");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, PR_TRUE, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("package"),
nsDependentCString(aBaseURL),
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool aUseProfile)
@ -2492,8 +2491,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool
DeselectSkin(aSkinName, aUseProfile);
// Now uninstall it.
nsCAutoString provider("skin");
return UninstallProvider(provider, aSkinName, aUseProfile);
return UninstallProvider(NS_LITERAL_CSTRING("skin"), aSkinName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PRBool aUseProfile)
@ -2501,8 +2499,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PR
// The locale must first be deselected.
DeselectLocale(aLocaleName, aUseProfile);
nsCAutoString provider("locale");
return UninstallProvider(provider, aLocaleName, aUseProfile);
return UninstallProvider(NS_LITERAL_CSTRING("locale"), aLocaleName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName, PRBool aUseProfile)
@ -2512,7 +2509,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName,
}
NS_IMETHODIMP
nsChromeRegistry::UninstallProvider(const nsCString& aProviderType,
nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
const PRUnichar* aProviderName,
PRBool aUseProfile)
{
@ -2771,7 +2768,7 @@ nsChromeRegistry::GetAgentSheets(nsIDocShell* aDocShell, nsISupportsArray **aRes
// Determine the agent sheets that should be loaded.
if (!mScrollbarSheet)
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (!mFormSheet) {
nsCAutoString sheetURL;
@ -2868,7 +2865,7 @@ nsChromeRegistry::GetUserSheets(PRBool aIsChrome, nsISupportsArray **aResult)
return NS_OK;
}
nsresult nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString& aURL)
nsresult nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString& aURL)
{
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
@ -2949,7 +2946,7 @@ nsresult nsChromeRegistry::LoadProfileDataSource()
}
}
rv = LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
rv = LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
// This must always be the last line of profile initialization!
nsCAutoString sheetURL;
@ -3100,12 +3097,12 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
PRBool isProfile;
PRBool isSelection;
nsCAutoString content("content");
nsCAutoString locale("locale");
nsCAutoString skin("skin");
nsCAutoString profile("profile");
nsCAutoString select("select");
nsCAutoString path("path");
NS_NAMED_LITERAL_CSTRING(content, "content");
NS_NAMED_LITERAL_CSTRING(locale, "locale");
NS_NAMED_LITERAL_CSTRING(skin, "skin");
NS_NAMED_LITERAL_CSTRING(profile, "profile");
NS_NAMED_LITERAL_CSTRING(select, "select");
NS_NAMED_LITERAL_CSTRING(path, "path");
nsCAutoString fileURL;
nsCAutoString chromeURL;
@ -3191,7 +3188,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
// process the line
if (skin.Equals(chromeType)) {
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectSkin(name.get(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
@ -3204,7 +3202,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
rv = InstallPackage(chromeURL.get(), isProfile);
else if (locale.Equals(chromeType)) {
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectLocale(name.get(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
@ -3228,7 +3227,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
}
PRBool
nsChromeRegistry::GetProviderCount(const nsCString& aProviderType, nsIRDFDataSource* aDataSource)
nsChromeRegistry::GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource)
{
nsresult rv;
@ -3292,8 +3291,7 @@ NS_IMETHODIMP nsChromeRegistry::Observe(nsISupports *aSubject, const char *aTopi
NS_IMETHODIMP nsChromeRegistry::CheckThemeVersion(const PRUnichar *aSkin,
PRBool* aResult)
{
nsCAutoString provider("skin");
return CheckProviderVersion(provider, aSkin, mSkinVersion, aResult);
return CheckProviderVersion(NS_LITERAL_CSTRING("skin"), aSkin, mSkinVersion, aResult);
}
@ -3301,11 +3299,11 @@ NS_IMETHODIMP nsChromeRegistry::CheckLocaleVersion(const PRUnichar *aLocale,
PRBool* aResult)
{
nsCAutoString provider("locale");
return CheckProviderVersion(provider, aLocale, mLocaleVersion, aResult);
return CheckProviderVersion(NS_LITERAL_CSTRING("skin"), aLocale, mLocaleVersion, aResult);
}
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsCString& aProviderType,
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible)

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

@ -54,7 +54,7 @@ class nsIDocument;
#include "nsWeakReference.h"
#include "nsString.h"
class nsChromeRegistry : public nsIChromeRegistry,
class nsChromeRegistry : public nsIXULChromeRegistry,
public nsIObserver,
public nsSupportsWeakReference
{
@ -63,6 +63,7 @@ public:
// nsIChromeRegistry methods:
NS_DECL_NSICHROMEREGISTRY
NS_DECL_NSIXULCHROMEREGISTRY
NS_DECL_NSIOBSERVER
@ -93,7 +94,7 @@ protected:
NS_IMETHOD WriteInfoToDataSource(const char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString & aURL);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString & aURL);
nsresult LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet);
nsresult GetUserSheetURL(PRBool aIsChrome, nsCString & aURL);
@ -122,66 +123,66 @@ private:
NS_IMETHOD GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL);
NS_IMETHOD FindProvider(const nsCString& aPackage,
const nsCString& aProvider,
NS_IMETHOD FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsCString& aPackage,
const nsCString& aProvider,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SetProvider(const nsCString& aProvider,
NS_IMETHOD SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
PRBool aAllUsers,
const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SetProviderForPackage(const nsCString& aProvider,
NS_IMETHOD SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aAllUsers, const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsCString& aProviderType,
NS_IMETHOD SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
NS_IMETHOD CheckProviderVersion (const nsCString& aProviderType,
NS_IMETHOD CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible);
NS_IMETHOD IsProviderSelected(const nsCString& aProvider,
NS_IMETHOD IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult);
NS_IMETHOD IsProviderSelectedForPackage(const nsCString& aProviderType,
NS_IMETHOD IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD IsProviderSetForPackage(const nsCString& aProvider,
NS_IMETHOD IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD InstallProvider(const nsCString& aProviderType,
const nsCString& aBaseURL,
NS_IMETHOD InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts, PRBool aRemove);
NS_IMETHOD UninstallProvider(const nsCString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
NS_IMETHOD UninstallProvider(const nsACString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
nsresult ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength);
PRBool GetProviderCount(const nsCString& aProviderType, nsIRDFDataSource* aDataSource);
PRBool GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource);
protected:
PRBool mInstallInitialized;

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

@ -79,7 +79,6 @@
#include "nsIXBLPrototypeHandler.h"
#include "nsIChromeRegistry.h"
#include "nsIPref.h"
#include "nsIPresShell.h"

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

@ -3871,10 +3871,11 @@ nsEditorShell::InitSpellChecker()
dictName = nsnull;
}
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &result);
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService(kChromeRegistryCID, &result);
if (NS_SUCCEEDED(result) && chromeRegistry)
result = chromeRegistry->GetSelectedLocale(NS_LITERAL_STRING("navigator").get(), &dictName);
if (NS_SUCCEEDED(result) && packageRegistry)
result = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("navigator").get(), &dictName);
}
if (NS_SUCCEEDED(result) && dictName && *dictName)

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

@ -553,10 +553,11 @@ nsMsgMailSession::GetSelectedLocaleDataDir(nsIFile *defaultsDir)
NS_ENSURE_SUCCESS(rv,rv);
if (baseDirExists) {
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService("@mozilla.org/chrome/chrome-registry;1", &rv);
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService("@mozilla.org/chrome/chrome-registry;1", &rv);
if (NS_SUCCEEDED(rv)) {
nsXPIDLString localeName;
rv = chromeRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
if (NS_SUCCEEDED(rv) && !localeName.IsEmpty()) {
PRBool localeDirExists = PR_FALSE;

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

@ -463,7 +463,7 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs, PRBool canInteract)
}
gLocaleProfiles->Remove(&key);
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if (NS_FAILED(rv)) return rv;
// Install to the profile
@ -472,7 +472,7 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs, PRBool canInteract)
const char* fileStr = fileURL.GetURLString();
// NEED TO FIX: when current UILocale and contentLocale are same with specified locales,
// we shouldn't install them again here. But chromeRegistry->GetSelectedLocale() doesn't
// 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() ;
@ -1548,7 +1548,7 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(profDefaultsDir));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if (NS_SUCCEEDED(rv)) {
const PRUnichar* uiLocale = aUILocale;
@ -1566,8 +1566,9 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
// We can get preferred UILocale and contentLocale (specified -UILocale and -contentLocale)
// by GetSelectedLocale() which is done in nsAppRunner.cpp::InstallGlobalLocale()
if (!aUILocale || !aUILocale[0]) {
rv = chromeRegistry->GetSelectedLocale(NS_LITERAL_STRING("global").get(),
nsCOMPtr<nsIXULChromeRegistry> packageRegistry = do_QueryInterface(chromeRegistry);
if ((!aUILocale || !aUILocale[0]) && packageRegistry) {
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global").get(),
getter_Copies(currentUILocaleName));
if (NS_SUCCEEDED(rv)) {
uiLocale = currentUILocaleName.get();
@ -1575,7 +1576,7 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
}
if (!aContentLocale || !aContentLocale[0]) {
rv = chromeRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(),
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(),
getter_Copies(currentContentLocaleName));
if (NS_SUCCEEDED(rv)) {
contentLocale = currentContentLocaleName.get();
@ -2033,12 +2034,12 @@ nsProfile::DefineLocaleDefaultsDir()
rv = directoryService->Get(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(localeDefaults));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIChromeRegistry> chromeRegistry =
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService(kChromeRegistryCID, &rv);
if (NS_SUCCEEDED(rv))
{
nsXPIDLString localeName;
rv = chromeRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("global-region").get(), getter_Copies(localeName));
if (NS_SUCCEEDED(rv))
rv = localeDefaults->AppendUnicode(localeName);
}

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

@ -64,39 +64,88 @@ interface nsIChromeRegistry : nsISupports
*/
string convertChromeURL(in nsIURI aChromeURL);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/**
* get the style sheets for a specific chrome URL
*/
nsISupportsArray getStyleSheets(in nsIURI aChromeURL);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
/**
* get the user-specified style sheets
*/
nsISupportsArray getUserSheets(in boolean useChromeSheets);
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();
/**
* get the style sheets required for a specific running docshell
*/
nsISupportsArray getAgentSheets(in nsIDocShell docShell);
/**
* refresh the chrome list at runtime, looking for new packages/etc
*/
void checkForNewChrome();
};
[scriptable, uuid(a9f92623-5982-4afe-9d90-619cf5b0c39f)]
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 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);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
void selectLocaleForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
void deselectSkinForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName, in wstring packageName, in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName, in wstring packageName, in boolean useProfile);
// Special additional APIs for locales only.
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
wstring getSelectedLocale(in wstring packageName);
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
/* runtimeProvider == true: don't assert the runtime change */
void setRuntimeProvider(in boolean runtimeProvider);
boolean checkThemeVersion(in wstring skinName);
boolean checkLocaleVersion(in wstring localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in wstring skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in wstring localeName,
in wstring packageName,
in boolean useProfile);
wstring getSelectedLocale(in wstring packageName);
nsISimpleEnumerator getOverlays(in nsIURI aChromeURL);
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();
boolean allowScriptsForSkin(in nsIURI url);
/* Installation APIs */
void installSkin(in string baseURL, in boolean useProfile, in boolean allowScripts);
void installSkin(in string baseURL,
in boolean useProfile,
in boolean allowScripts);
void uninstallSkin(in wstring skinName, in boolean useProfile);
void installLocale(in string baseURL, in boolean useProfile);
@ -104,21 +153,8 @@ interface nsIChromeRegistry : nsISupports
void installPackage(in string baseURL, in boolean useProfile);
void uninstallPackage(in wstring packageName, in boolean useProfile);
void getAgentSheets(in nsIDocShell docShell, out nsISupportsArray styleSheets);
void getUserSheets(in boolean useChromeSheets, out nsISupportsArray styleSheets);
boolean allowScriptsForSkin(in nsIURI url);
void checkForNewChrome();
boolean checkThemeVersion(in wstring skinName);
boolean checkLocaleVersion(in wstring localeName);
};
%{ C++
// for component registration

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

@ -299,7 +299,7 @@ nsChromeRegistry::~nsChromeRegistry()
}
NS_IMPL_THREADSAFE_ISUPPORTS3(nsChromeRegistry, nsIChromeRegistry, nsIObserver, nsISupportsWeakReference);
NS_IMPL_THREADSAFE_ISUPPORTS4(nsChromeRegistry, nsIChromeRegistry, nsIXULChromeRegistry, nsIObserver, nsISupportsWeakReference);
////////////////////////////////////////////////////////////////////////////////
// nsIChromeRegistry methods:
@ -597,10 +597,10 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
// Follow the "selectedSkin" or "selectedLocale" arc.
nsCOMPtr<nsIRDFResource> arc;
if (aProvider.Equals(nsCAutoString("skin"))) {
if (aProvider.Equals(NS_LITERAL_CSTRING("skin"))) {
arc = mSelectedSkin;
}
else if (aProvider.Equals(nsCAutoString("locale"))) {
else if (aProvider.Equals(NS_LITERAL_CSTRING("locale"))) {
arc = mSelectedLocale;
}
else
@ -662,8 +662,8 @@ nsChromeRegistry::GetBaseURL(const nsCString& aPackage, const nsCString& aProvid
// locate
NS_IMETHODIMP
nsChromeRegistry::FindProvider(const nsCString& aPackage,
const nsCString& aProvider,
nsChromeRegistry::FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider)
{
@ -740,8 +740,8 @@ nsChromeRegistry::FindProvider(const nsCString& aPackage,
NS_IMETHODIMP
nsChromeRegistry::SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsCString& aPackage,
const nsCString& aProvider,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider)
@ -1586,20 +1586,20 @@ NS_IMETHODIMP nsChromeRegistry::UpdateDynamicDataSources(nsIRDFDataSource *aData
NS_IMETHODIMP nsChromeRegistry::SelectSkin(const PRUnichar* aSkin,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocale(const PRUnichar* aLocale,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
const PRUnichar *aProfilePath)
{
// to be changed to use given path
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
}
/* void setRuntimeProvider (in boolean runtimeProvider); */
@ -1645,7 +1645,7 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
}
if (!selectedProvider) {
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), nsCAutoString("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
rv = FindProvider(NS_ConvertUCS2toUTF8(packageStr.get()), NS_LITERAL_CSTRING("locale"), mSelectedLocale, getter_AddRefs(selectedProvider));
if (!selectedProvider)
return rv;
}
@ -1690,16 +1690,16 @@ NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
NS_IMETHODIMP nsChromeRegistry::DeselectSkin(const PRUnichar* aSkin,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
return SetProvider(NS_LITERAL_CSTRING("skin"), mSelectedSkin, aSkin, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocale(const PRUnichar* aLocale,
PRBool aUseProfile)
{
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
return SetProvider(NS_LITERAL_CSTRING("locale"), mSelectedLocale, aLocale, aUseProfile, nsnull, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsCString& aProvider,
NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
PRBool aUseProfile, const char *aProfilePath,
@ -1783,13 +1783,13 @@ NS_IMETHODIMP nsChromeRegistry::SetProvider(const nsCString& aProvider,
}
if (aProvider.Equals("skin") && mScrollbarSheet)
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistry::SetProviderForPackage(const nsCString& aProvider,
nsChromeRegistry::SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
@ -1826,55 +1826,50 @@ NS_IMETHODIMP nsChromeRegistry::SelectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::SelectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_TRUE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectSkinForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("skin");
return SelectProviderForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::DeselectLocaleForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile)
{
nsCAutoString provider("locale");
return SelectProviderForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
return SelectProviderForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::IsSkinSelectedForPackage(const PRUnichar *aSkin,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
nsCAutoString provider("skin");
return IsProviderSelectedForPackage(provider, aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("skin"), aSkin, aPackageName, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelectedForPackage(const PRUnichar *aLocale,
const PRUnichar *aPackageName,
PRBool aUseProfile, PRBool* aResult)
{
nsCAutoString provider("locale");
return IsProviderSelectedForPackage(provider, aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
return IsProviderSelectedForPackage(NS_LITERAL_CSTRING("locale"), aLocale, aPackageName, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
NS_IMETHODIMP
nsChromeRegistry::SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding)
{
nsCAutoString package( "urn:mozilla:package:" );
package.AppendWithConversion(aPackageName);
@ -1934,16 +1929,16 @@ NS_IMETHODIMP nsChromeRegistry::SelectProviderForPackage(const nsCString& aProvi
NS_IMETHODIMP nsChromeRegistry::IsSkinSelected(const PRUnichar* aSkin,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(nsCAutoString("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
return IsProviderSelected(NS_LITERAL_CSTRING("skin"), aSkin, mSelectedSkin, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsLocaleSelected(const PRUnichar* aLocale,
PRBool aUseProfile, PRInt32* aResult)
{
return IsProviderSelected(nsCAutoString("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
return IsProviderSelected(NS_LITERAL_CSTRING("locale"), aLocale, mSelectedLocale, aUseProfile, aResult);
}
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsCString& aProvider,
NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult)
@ -2032,7 +2027,7 @@ NS_IMETHODIMP nsChromeRegistry::IsProviderSelected(const nsCString& aProvider,
}
NS_IMETHODIMP
nsChromeRegistry::IsProviderSelectedForPackage(const nsCString& aProviderType,
nsChromeRegistry::IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
@ -2073,7 +2068,7 @@ nsChromeRegistry::IsProviderSelectedForPackage(const nsCString& aProviderType,
}
NS_IMETHODIMP
nsChromeRegistry::IsProviderSetForPackage(const nsCString& aProvider,
nsChromeRegistry::IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
@ -2099,14 +2094,14 @@ nsChromeRegistry::IsProviderSetForPackage(const nsCString& aProvider,
return NS_OK;
}
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
const nsCString& aBaseURL,
NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts,
PRBool aRemove)
{
// XXX don't allow local chrome overrides of install chrome!
#ifdef DEBUG
printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", aProviderType.get(), aBaseURL.get());
printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", PromiseFlatCString(aProviderType).get(), PromiseFlatCString(aBaseURL).get());
#endif
// Load the data source found at the base URL.
@ -2126,9 +2121,9 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
remote->Init(key.get());
remote->Refresh(PR_TRUE);
PRBool skinCount = GetProviderCount(nsCAutoString("skin"), dataSource);
PRBool localeCount = GetProviderCount(nsCAutoString("locale"), dataSource);
PRBool packageCount = GetProviderCount(nsCAutoString("package"), dataSource);
PRBool skinCount = GetProviderCount(NS_LITERAL_CSTRING("skin"), dataSource);
PRBool localeCount = GetProviderCount(NS_LITERAL_CSTRING("locale"), dataSource);
PRBool packageCount = GetProviderCount(NS_LITERAL_CSTRING("package"), dataSource);
PRBool appendPackage = PR_FALSE;
PRBool appendProvider = PR_FALSE;
@ -2317,7 +2312,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
// See if we're a packages seq in a skin/locale. If so, we need to set up the baseURL, allowScripts
// and package arcs.
if (val.Find(":packages") != -1 && !aProviderType.Equals(nsCAutoString("package"))) {
if (val.Find(":packages") != -1 && !aProviderType.Equals(NS_LITERAL_CSTRING("package"))) {
PRBool doAppendPackage = appendPackage;
PRInt32 perProviderPackageCount;
container->GetCount(&perProviderPackageCount);
@ -2374,7 +2369,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
rv = nsChromeRegistry::UpdateArc(installSource, entry, mBaseURL, baseLiteral, aRemove);
if (NS_FAILED(rv)) return rv;
if (aProviderType.Equals(nsCAutoString("skin")) && !aAllowScripts) {
if (aProviderType.Equals(NS_LITERAL_CSTRING("skin")) && !aAllowScripts) {
rv = nsChromeRegistry::UpdateArc(installSource, entry, mAllowScripts, scriptLiteral, aRemove);
if (NS_FAILED(rv)) return rv;
}
@ -2434,8 +2429,9 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
literal->GetValueConst(&valueStr);
nsAutoString imageURL(valueStr);
if (imageURL.FindChar(':') == -1) {
// We're relative. Prepend the base URL of the package.
nsAutoString fullURL; fullURL.AssignWithConversion(aBaseURL.get());
// We're relative. Prepend the base URL of the
// package.
NS_ConvertUTF8toUCS2 fullURL(aBaseURL);
fullURL += imageURL;
mRDFService->GetLiteral(fullURL.get(), getter_AddRefs(literal));
newTarget = do_QueryInterface(literal);
@ -2470,20 +2466,23 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
NS_IMETHODIMP nsChromeRegistry::InstallSkin(const char* aBaseURL, PRBool aUseProfile, PRBool aAllowScripts)
{
nsCAutoString provider("skin");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, aAllowScripts, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("skin"),
nsDependentCString(aBaseURL),
aUseProfile, aAllowScripts, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::InstallLocale(const char* aBaseURL, PRBool aUseProfile)
{
nsCAutoString provider("locale");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, PR_TRUE, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("locale"),
nsDependentCString(aBaseURL),
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::InstallPackage(const char* aBaseURL, PRBool aUseProfile)
{
nsCAutoString provider("package");
return InstallProvider(provider, nsCAutoString(aBaseURL), aUseProfile, PR_TRUE, PR_FALSE);
return InstallProvider(NS_LITERAL_CSTRING("package"),
nsDependentCString(aBaseURL),
aUseProfile, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool aUseProfile)
@ -2492,8 +2491,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallSkin(const PRUnichar* aSkinName, PRBool
DeselectSkin(aSkinName, aUseProfile);
// Now uninstall it.
nsCAutoString provider("skin");
return UninstallProvider(provider, aSkinName, aUseProfile);
return UninstallProvider(NS_LITERAL_CSTRING("skin"), aSkinName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PRBool aUseProfile)
@ -2501,8 +2499,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallLocale(const PRUnichar* aLocaleName, PR
// The locale must first be deselected.
DeselectLocale(aLocaleName, aUseProfile);
nsCAutoString provider("locale");
return UninstallProvider(provider, aLocaleName, aUseProfile);
return UninstallProvider(NS_LITERAL_CSTRING("locale"), aLocaleName, aUseProfile);
}
NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName, PRBool aUseProfile)
@ -2512,7 +2509,7 @@ NS_IMETHODIMP nsChromeRegistry::UninstallPackage(const PRUnichar* aPackageName,
}
NS_IMETHODIMP
nsChromeRegistry::UninstallProvider(const nsCString& aProviderType,
nsChromeRegistry::UninstallProvider(const nsACString& aProviderType,
const PRUnichar* aProviderName,
PRBool aUseProfile)
{
@ -2771,7 +2768,7 @@ nsChromeRegistry::GetAgentSheets(nsIDocShell* aDocShell, nsISupportsArray **aRes
// Determine the agent sheets that should be loaded.
if (!mScrollbarSheet)
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (!mFormSheet) {
nsCAutoString sheetURL;
@ -2868,7 +2865,7 @@ nsChromeRegistry::GetUserSheets(PRBool aIsChrome, nsISupportsArray **aResult)
return NS_OK;
}
nsresult nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString& aURL)
nsresult nsChromeRegistry::LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString& aURL)
{
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
@ -2949,7 +2946,7 @@ nsresult nsChromeRegistry::LoadProfileDataSource()
}
}
rv = LoadStyleSheet(getter_AddRefs(mScrollbarSheet), nsCAutoString("chrome://global/skin/scrollbars.css"));
rv = LoadStyleSheet(getter_AddRefs(mScrollbarSheet), NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
// This must always be the last line of profile initialization!
nsCAutoString sheetURL;
@ -3100,12 +3097,12 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
PRBool isProfile;
PRBool isSelection;
nsCAutoString content("content");
nsCAutoString locale("locale");
nsCAutoString skin("skin");
nsCAutoString profile("profile");
nsCAutoString select("select");
nsCAutoString path("path");
NS_NAMED_LITERAL_CSTRING(content, "content");
NS_NAMED_LITERAL_CSTRING(locale, "locale");
NS_NAMED_LITERAL_CSTRING(skin, "skin");
NS_NAMED_LITERAL_CSTRING(profile, "profile");
NS_NAMED_LITERAL_CSTRING(select, "select");
NS_NAMED_LITERAL_CSTRING(path, "path");
nsCAutoString fileURL;
nsCAutoString chromeURL;
@ -3191,7 +3188,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
// process the line
if (skin.Equals(chromeType)) {
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectSkin(name.get(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
@ -3204,7 +3202,8 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
rv = InstallPackage(chromeURL.get(), isProfile);
else if (locale.Equals(chromeType)) {
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
NS_ConvertUTF8toUCS2 name(chromeLocation);
rv = SelectLocale(name.get(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
@ -3228,7 +3227,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
}
PRBool
nsChromeRegistry::GetProviderCount(const nsCString& aProviderType, nsIRDFDataSource* aDataSource)
nsChromeRegistry::GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource)
{
nsresult rv;
@ -3292,8 +3291,7 @@ NS_IMETHODIMP nsChromeRegistry::Observe(nsISupports *aSubject, const char *aTopi
NS_IMETHODIMP nsChromeRegistry::CheckThemeVersion(const PRUnichar *aSkin,
PRBool* aResult)
{
nsCAutoString provider("skin");
return CheckProviderVersion(provider, aSkin, mSkinVersion, aResult);
return CheckProviderVersion(NS_LITERAL_CSTRING("skin"), aSkin, mSkinVersion, aResult);
}
@ -3301,11 +3299,11 @@ NS_IMETHODIMP nsChromeRegistry::CheckLocaleVersion(const PRUnichar *aLocale,
PRBool* aResult)
{
nsCAutoString provider("locale");
return CheckProviderVersion(provider, aLocale, mLocaleVersion, aResult);
return CheckProviderVersion(NS_LITERAL_CSTRING("skin"), aLocale, mLocaleVersion, aResult);
}
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsCString& aProviderType,
NS_IMETHODIMP nsChromeRegistry::CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible)

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

@ -54,7 +54,7 @@ class nsIDocument;
#include "nsWeakReference.h"
#include "nsString.h"
class nsChromeRegistry : public nsIChromeRegistry,
class nsChromeRegistry : public nsIXULChromeRegistry,
public nsIObserver,
public nsSupportsWeakReference
{
@ -63,6 +63,7 @@ public:
// nsIChromeRegistry methods:
NS_DECL_NSICHROMEREGISTRY
NS_DECL_NSIXULCHROMEREGISTRY
NS_DECL_NSIOBSERVER
@ -93,7 +94,7 @@ protected:
NS_IMETHOD WriteInfoToDataSource(const char *aDocURI, const PRUnichar *aOverlayURI,
PRBool aIsOverlay, PRBool aUseProfile, PRBool aRemove);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsCString & aURL);
nsresult LoadStyleSheet(nsICSSStyleSheet** aSheet, const nsACString & aURL);
nsresult LoadStyleSheetWithURL(nsIURI* aURL, nsICSSStyleSheet** aSheet);
nsresult GetUserSheetURL(PRBool aIsChrome, nsCString & aURL);
@ -122,66 +123,66 @@ private:
NS_IMETHOD GetBaseURL(const nsCString& aPackage, const nsCString& aProvider,
nsCString& aBaseURL);
NS_IMETHOD FindProvider(const nsCString& aPackage,
const nsCString& aProvider,
NS_IMETHOD FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsCString& aPackage,
const nsCString& aProvider,
const nsACString& aPackage,
const nsACString& aProvider,
const nsCString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
NS_IMETHOD SetProvider(const nsCString& aProvider,
NS_IMETHOD SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const PRUnichar* aProviderName,
PRBool aAllUsers,
const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SetProviderForPackage(const nsCString& aProvider,
NS_IMETHOD SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aAllUsers, const char *aProfilePath,
PRBool aIsAdding);
NS_IMETHOD SelectProviderForPackage(const nsCString& aProviderType,
NS_IMETHOD SelectProviderForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
NS_IMETHOD CheckProviderVersion (const nsCString& aProviderType,
NS_IMETHOD CheckProviderVersion (const nsACString& aProviderType,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible);
NS_IMETHOD IsProviderSelected(const nsCString& aProvider,
NS_IMETHOD IsProviderSelected(const nsACString& aProvider,
const PRUnichar* aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult);
NS_IMETHOD IsProviderSelectedForPackage(const nsCString& aProviderType,
NS_IMETHOD IsProviderSelectedForPackage(const nsACString& aProviderType,
const PRUnichar *aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD IsProviderSetForPackage(const nsCString& aProvider,
NS_IMETHOD IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
NS_IMETHOD InstallProvider(const nsCString& aProviderType,
const nsCString& aBaseURL,
NS_IMETHOD InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
PRBool aUseProfile, PRBool aAllowScripts, PRBool aRemove);
NS_IMETHOD UninstallProvider(const nsCString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
NS_IMETHOD UninstallProvider(const nsACString& aProviderType, const PRUnichar* aProviderName, PRBool aUseProfile);
nsresult ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength);
PRBool GetProviderCount(const nsCString& aProviderType, nsIRDFDataSource* aDataSource);
PRBool GetProviderCount(const nsACString& aProviderType, nsIRDFDataSource* aDataSource);
protected:
PRBool mInstallInitialized;

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

@ -74,7 +74,6 @@
#include "nsIContentHandler.h"
#include "nsIBrowserInstance.h"
#include "nsIEventQueueService.h"
#include "nsMPFileLocProvider.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIHttpProtocolHandler.h"
#include "nsBuildID.h"
@ -1020,14 +1019,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (cmdUI) {
nsAutoString UILocaleName;
UILocaleName.AssignWithConversion(cmdUI);
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if (chromeRegistry)
rv = chromeRegistry->SelectLocale(UILocaleName.get(), PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdUI && matchOS) {
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(uiLang.get(), PR_FALSE);
@ -1040,14 +1039,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (cmdContent) {
nsAutoString ContentLocaleName;
ContentLocaleName.AssignWithConversion(cmdContent);
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if(chromeRegistry)
rv = chromeRegistry->SelectLocale(ContentLocaleName.get(), PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdContent && matchOS) {
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(country.get(), PR_FALSE);

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

@ -1254,7 +1254,7 @@ function stylesheetSwitchAll(frameset, title) {
function applyTheme(themeName)
{
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIChromeRegistry);
.getService(Components.interfaces.nsIXULChromeRegistry);
chromeRegistry.selectSkin(themeName.getAttribute("name"), true);
chromeRegistry.refreshSkins();

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

@ -1413,7 +1413,7 @@ function applyTheme(themeName)
return;
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIChromeRegistry);
.getService(Components.interfaces.nsIXULChromeRegistry);
var oldTheme = false;
try {

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

@ -43,7 +43,7 @@ var gData;
try {
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if (chromeRegistry)
chromeRegistry = chromeRegistry.QueryInterface(Components.interfaces.nsIChromeRegistry);
chromeRegistry = chromeRegistry.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
}
catch(e) {}
@ -115,7 +115,7 @@ function applySkin()
try {
var reg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if (reg)
reg = reg.QueryInterface(Components.interfaces.nsIChromeRegistry);
reg = reg.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
}
catch(e) {}

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

@ -30,7 +30,7 @@ function selectLocale(event)
var langcode = node.getAttribute('value');
if (langcode)
{
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIXULChromeRegistry);
chromeRegistry.selectLocale(langcode, true);
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.notifyObservers(null, "locale-selected", null);

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

@ -108,7 +108,7 @@ nsInstallInfo::nsInstallInfo(PRUint32 aInstallType,
const PRUnichar* aArgs,
PRUint32 flags,
nsIXPIListener* aListener,
nsIChromeRegistry* aChromeReg)
nsIXULChromeRegistry* aChromeRegistry)
: mError(0),
mType(aInstallType),
mFlags(flags),
@ -116,7 +116,7 @@ nsInstallInfo::nsInstallInfo(PRUint32 aInstallType,
mArgs(aArgs),
mFile(aFile),
mListener(aListener),
mChromeReg(aChromeReg)
mChromeRegistry(aChromeRegistry)
{
MOZ_COUNT_CTOR(nsInstallInfo);
}

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

@ -81,7 +81,7 @@ class nsInstallInfo
const PRUnichar* aArgs,
PRUint32 aFlags,
nsIXPIListener* aListener,
nsIChromeRegistry* aChromeReg);
nsIXULChromeRegistry* aChromeReg);
virtual ~nsInstallInfo();
@ -91,7 +91,7 @@ class nsInstallInfo
PRUint32 GetFlags() { return mFlags; }
PRUint32 GetType() { return mType; }
nsIXPIListener* GetListener() { return mListener.get(); }
nsIChromeRegistry* GetChromeRegistry() { return mChromeReg.get(); }
nsIXULChromeRegistry* GetChromeRegistry() { return mChromeRegistry.get(); }
private:
@ -104,7 +104,7 @@ class nsInstallInfo
nsCOMPtr<nsIFile> mFile;
nsCOMPtr<nsIXPIListener> mListener;
nsCOMPtr<nsIChromeRegistry> mChromeReg;
nsCOMPtr<nsIXULChromeRegistry> mChromeRegistry;
};
#ifdef XP_PC
@ -284,8 +284,8 @@ class nsInstall
PRInt32 GetInstallPlatform(nsCString& aPlatform);
nsIChromeRegistry* GetChromeRegistry() { return mChromeRegistry; }
void SetChromeRegistry(nsIChromeRegistry* reg)
nsIXULChromeRegistry* GetChromeRegistry() { return mChromeRegistry; }
void SetChromeRegistry(nsIXULChromeRegistry* reg)
{ mChromeRegistry = reg; }
PRUint32 GetFinalStatus() { return mFinalStatus; }
@ -313,7 +313,7 @@ class nsInstall
nsString mInstallURL;
PRUint32 mInstallFlags;
nsCString mInstallPlatform;
nsIChromeRegistry* mChromeRegistry; // we don't own it, it outlives us
nsIXULChromeRegistry* mChromeRegistry; // we don't own it, it outlives us
nsInstallFolder* mPackageFolder;
PRBool mUserCancelled;

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

@ -1883,7 +1883,7 @@ JSObject * InitXPInstallObjects(JSContext *jscontext,
const PRUnichar* url,
const PRUnichar* args,
PRUint32 flags,
nsIChromeRegistry* reg,
nsIXULChromeRegistry* reg,
nsIZipReader * theJARFile)
{
JSObject *installObject = nsnull;

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

@ -242,7 +242,7 @@ PRInt32 nsRegisterItem::Complete()
nsresult rv;
PRInt32 result = nsInstall::SUCCESS;
PRBool isProfile = mChromeType & CHROME_PROFILE;
nsIChromeRegistry* reg = mInstall->GetChromeRegistry();
nsIXULChromeRegistry* reg = mInstall->GetChromeRegistry();
if ( reg && !(mChromeType & CHROME_DELAYED) )
{

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

@ -314,17 +314,17 @@ nsSoftwareUpdate::InstallJar( nsIFile* aLocalFile,
// -- grab a proxied Chrome Registry now while we can
nsresult rv;
nsIChromeRegistry* chromeReg = nsnull;
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIChromeRegistry,
nsIXULChromeRegistry* chromeRegistry = nsnull;
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIXULChromeRegistry,
tmpReg,
kChromeRegistryCID,
NS_UI_THREAD_EVENTQ, &rv);
if (NS_SUCCEEDED(rv))
chromeReg = tmpReg;
chromeRegistry = tmpReg;
// we want to call this with or without a chrome registry
nsInstallInfo *info = new nsInstallInfo( 0, aLocalFile, aURL, aArguments,
flags, aListener, chromeReg );
flags, aListener, chromeRegistry );
if (!info)
return NS_ERROR_OUT_OF_MEMORY;
@ -347,8 +347,8 @@ nsSoftwareUpdate::InstallChrome( PRUint32 aType,
nsIXPIListener* aListener)
{
nsresult rv;
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIChromeRegistry,
chromeReg,
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIXULChromeRegistry,
chromeRegistry,
kChromeRegistryCID,
NS_UI_THREAD_EVENTQ, &rv);
if (NS_FAILED(rv))
@ -360,7 +360,7 @@ nsSoftwareUpdate::InstallChrome( PRUint32 aType,
aName,
(PRUint32)aSelect,
aListener,
chromeReg);
chromeRegistry);
if (!info)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -58,14 +58,14 @@
static NS_DEFINE_CID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
extern JSObject *InitXPInstallObjects(JSContext *jscontext, JSObject *global, nsIFile* jarfile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, nsIZipReader* hZip);
extern JSObject *InitXPInstallObjects(JSContext *jscontext, JSObject *global, nsIFile* jarfile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIXULChromeRegistry* registry, nsIZipReader* hZip);
extern nsresult InitInstallVersionClass(JSContext *jscontext, JSObject *global, void** prototype);
extern nsresult InitInstallTriggerGlobalClass(JSContext *jscontext, JSObject *global, void** prototype);
// Defined in this file:
PR_STATIC_CALLBACK(void) XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report);
static PRInt32 GetInstallScriptFromJarfile(nsIZipReader* hZip, nsIFile* jarFile, char** scriptBuffer, PRUint32 *scriptLength);
static nsresult SetupInstallContext(nsIZipReader* hZip, nsIFile* jarFile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, JSRuntime *jsRT, JSContext **jsCX, JSObject **jsGlob);
static nsresult SetupInstallContext(nsIZipReader* hZip, nsIFile* jarFile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIXULChromeRegistry* reg, JSRuntime *jsRT, JSContext **jsCX, JSObject **jsGlob);
extern "C" void RunInstallOnThread(void *data);
@ -266,7 +266,7 @@ static nsresult SetupInstallContext(nsIZipReader* hZip,
const PRUnichar* url,
const PRUnichar* args,
PRUint32 flags,
nsIChromeRegistry* reg,
nsIXULChromeRegistry* reg,
JSRuntime *rt,
JSContext **jsCX,
JSObject **jsGlob)
@ -522,7 +522,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
listener->OnInstallStart(info->GetURL());
// make sure we've got a chrome registry -- can't proceed if not
nsIChromeRegistry* reg = info->GetChromeRegistry();
nsIXULChromeRegistry* reg = info->GetChromeRegistry();
if (reg)
{
// build up jar: URL