Bug 671510 - make sure accessible tree is created for content processes, r=jones.chris.g, sr=Olli.Pettay, f=felipc

This commit is contained in:
Alexander Surkov 2011-07-21 13:37:32 +09:00
parent f3aebefb11
commit 3184ccc8f2
4 changed files with 46 additions and 0 deletions

View File

@ -104,6 +104,10 @@
#define getpid _getpid
#endif
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"
#endif
using namespace mozilla::ipc;
using namespace mozilla::net;
using namespace mozilla::places;
@ -734,6 +738,18 @@ ContentChild::RecvFlushMemory(const nsString& reason)
return true;
}
bool
ContentChild::RecvActivateA11y()
{
#ifdef ACCESSIBILITY
// Start accessibility in content process if it's running in chrome
// process.
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
#endif
return true;
}
nsString&
ContentChild::GetIndexedDBPath()
{

View File

@ -146,6 +146,8 @@ public:
virtual bool RecvFlushMemory(const nsString& reason);
virtual bool RecvActivateA11y();
#ifdef ANDROID
gfxIntSize GetScreenSize() { return mScreenSize; }
#endif

View File

@ -62,6 +62,7 @@
#include "nsExternalHelperAppService.h"
#include "nsCExternalHandlerService.h"
#include "nsFrameMessageManager.h"
#include "nsIPresShell.h"
#include "nsIAlertsService.h"
#include "nsToolkitCompsCID.h"
#include "nsIDOMGeoGeolocation.h"
@ -179,6 +180,9 @@ ContentParent::Init()
obs->AddObserver(this, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, PR_FALSE);
obs->AddObserver(this, "child-memory-reporter-request", PR_FALSE);
obs->AddObserver(this, "memory-pressure", PR_FALSE);
#ifdef ACCESSIBILITY
obs->AddObserver(this, "a11y-init-or-shutdown", PR_FALSE);
#endif
}
nsCOMPtr<nsIPrefBranch2> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
@ -193,6 +197,14 @@ ContentParent::Init()
if (obs) {
obs->NotifyObservers(nsnull, "ipc:content-created", nsnull);
}
#ifdef ACCESSIBILITY
// If accessibility is running in chrome process then start it in content
// process.
if (nsIPresShell::IsAccessibilityActive()) {
SendActivateA11y();
}
#endif
}
void
@ -257,6 +269,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
obs->RemoveObserver(static_cast<nsIObserver*>(this), "memory-pressure");
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-memory-reporter-request");
obs->RemoveObserver(static_cast<nsIObserver*>(this), NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC);
#ifdef ACCESSIBILITY
obs->RemoveObserver(static_cast<nsIObserver*>(this), "a11y-init-or-shutdown");
#endif
}
// clear the child memory reporters
@ -656,6 +671,14 @@ ContentParent::Observe(nsISupports* aSubject,
else if (!strcmp(aTopic, "child-memory-reporter-request")) {
SendPMemoryReportRequestConstructor();
}
#ifdef ACCESSIBILITY
// Make sure accessibility is running in content process when accessibility
// gets initiated in chrome process.
else if (aData && (*aData == '1') &&
!strcmp(aTopic, "a11y-init-or-shutdown")) {
SendActivateA11y();
}
#endif
return NS_OK;
}

View File

@ -129,6 +129,11 @@ child:
FlushMemory(nsString reason);
/**
* Start accessibility engine in content process.
*/
ActivateA11y();
parent:
PNecko();
PCrashReporter();