Bug 750283 - notify observers of a11y init/shutdown in nsAccessibilityService, r=surkov, f=tbsaunde

This commit is contained in:
Mark Capella 2012-05-07 18:14:27 +09:00
parent aa4ed76615
commit 23863fde21
3 changed files with 8 additions and 26 deletions

View File

@ -49,7 +49,6 @@
#include "nsIDOMWindow.h"
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIPresShell.h"
@ -168,23 +167,6 @@ void nsAccessNode::InitXPAccessibility()
if (prefBranch) {
prefBranch->GetBoolPref("browser.formfill.enable", &gIsFormFillEnabled);
}
NotifyA11yInitOrShutdown(true);
}
// nsAccessNode protected static
void nsAccessNode::NotifyA11yInitOrShutdown(bool aIsInit)
{
nsCOMPtr<nsIObserverService> obsService =
mozilla::services::GetObserverService();
NS_ASSERTION(obsService, "No observer service to notify of a11y init/shutdown");
if (!obsService)
return;
static const PRUnichar kInitIndicator[] = { '1', 0 };
static const PRUnichar kShutdownIndicator[] = { '0', 0 };
obsService->NotifyObservers(nsnull, "a11y-init-or-shutdown",
aIsInit ? kInitIndicator : kShutdownIndicator);
}
void nsAccessNode::ShutdownXPAccessibility()
@ -202,8 +184,6 @@ void nsAccessNode::ShutdownXPAccessibility()
gApplicationAccessible->Shutdown();
NS_RELEASE(gApplicationAccessible);
}
NotifyA11yInitOrShutdown(false);
}
RootAccessible*

View File

@ -164,11 +164,6 @@ protected:
nsCOMPtr<nsIContent> mContent;
nsDocAccessible* mDoc;
/**
* Notify global nsIObserver's that a11y is getting init'd or shutdown.
*/
static void NotifyA11yInitOrShutdown(bool aIsInit);
// Static data, we do our own refcounting for our static data.
static nsIStringBundle* gStringBundle;

View File

@ -1271,6 +1271,9 @@ nsAccessibilityService::Init()
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
static const PRUnichar kInitIndicator[] = { '1', 0 };
observerService->NotifyObservers(nsnull, "a11y-init-or-shutdown", kInitIndicator);
// Initialize accessibility.
nsAccessNodeWrap::InitAccessibility();
@ -1284,9 +1287,13 @@ nsAccessibilityService::Shutdown()
// Remove observers.
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService)
if (observerService) {
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
static const PRUnichar kShutdownIndicator[] = { '0', 0 };
observerService->NotifyObservers(nsnull, "a11y-init-or-shutdown", kShutdownIndicator);
}
// Stop accessible document loader.
nsAccDocManager::Shutdown();