Re-add logic for bug 239914: use the classic skin when OS accessibility is enabled, because it obeys system colors and preferences.

This commit is contained in:
bsmedberg%covad.net 2004-06-22 19:22:00 +00:00
Родитель c4bfd42e34
Коммит 1cba5e2e5e
1 изменённых файлов: 34 добавлений и 0 удалений

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

@ -71,6 +71,7 @@
#include "nsIExtensionManager.h"
#include "nsIIOService.h"
#include "nsILocaleService.h"
#include "nsILookAndFeel.h"
#include "nsIObserverService.h"
#include "nsINativeAppSupport.h"
#include "nsIPref.h"
@ -88,6 +89,7 @@
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsNetUtil.h"
#include "nsWidgetsCID.h"
#include "nsXPCOM.h"
#include "nsXPIDLString.h"
@ -867,6 +869,7 @@ public:
nsresult RegisterProfileService(nsIToolkitProfileService* aProfileService);
nsresult InitEventQueue();
nsresult SetWindowCreator(nsINativeAppSupport* native);
void CheckAccessibleSkin();
private:
nsIServiceManager* mServiceManager;
@ -994,6 +997,33 @@ ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
return wwatch->SetWindowCreator(creator);
}
NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
void
ScopedXPCOMStartup::CheckAccessibleSkin()
{
nsCOMPtr<nsILookAndFeel> lookAndFeel (do_GetService(kLookAndFeelCID));
if (lookAndFeel) {
PRInt32 useAccessibilityTheme = 0;
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_UseAccessibilityTheme,
useAccessibilityTheme);
if (useAccessibilityTheme) {
// If OS accessibility is active, use the classic skin, which obeys the
// system accessibility colors.
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry
(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
if (chromeRegistry) {
// Make change this session only
chromeRegistry->SetRuntimeProvider(PR_TRUE);
chromeRegistry->SelectSkin(NS_LITERAL_CSTRING("classic/1.0"), PR_TRUE);
}
}
}
}
// don't modify aAppDir directly... clone it first
static int
VerifyInstallation(nsIFile* aAppDir)
@ -1306,6 +1336,8 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
{ //extra scoping is needed so we release these components before xpcom shutdown
xpcom.CheckAccessibleSkin();
nsCOMPtr<nsIWindowWatcher> windowWatcher
(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIDialogParamBlock> ioParamBlock
@ -1871,6 +1903,8 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
io->SetOffline(PR_TRUE);
}
xpcom.CheckAccessibleSkin();
{
NS_TIMELINE_ENTER("startupNotifier");
nsCOMPtr<nsIObserver> startupNotifier