Bug 904025 - part1: pass phone state to child process. r=khuey

This commit is contained in:
Steven Lee 2013-09-13 16:51:45 +08:00
parent c797838e6d
commit e79d5d6cda
4 changed files with 16 additions and 0 deletions

View File

@ -1369,6 +1369,16 @@ ContentChild::RecvCancelMinimizeMemoryUsage()
return true;
}
bool
ContentChild::RecvNotifyPhoneStateChange(const nsString& aState)
{
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(nullptr, "phone-state-changed", aState.get());
}
return true;
}
bool
ContentChild::RecvLoadAndRegisterSheet(const URIParams& aURI, const uint32_t& aType)
{

View File

@ -225,6 +225,7 @@ public:
virtual bool RecvLoadAndRegisterSheet(const URIParams& aURI, const uint32_t& aType);
virtual bool RecvUnregisterSheet(const URIParams& aURI, const uint32_t& aType);
virtual bool RecvNotifyPhoneStateChange(const nsString& state);
#ifdef ANDROID
gfxIntSize GetScreenSize() { return mScreenSize; }
#endif

View File

@ -668,6 +668,7 @@ ContentParent::Init()
obs->AddObserver(this, "file-watcher-update", false);
#ifdef MOZ_WIDGET_GONK
obs->AddObserver(this, NS_VOLUME_STATE_CHANGED, false);
obs->AddObserver(this, "phone-state-changed", false);
#endif
#ifdef ACCESSIBILITY
obs->AddObserver(this, "a11y-init-or-shutdown", false);
@ -1762,6 +1763,9 @@ ContentParent::Observe(nsISupports* aSubject,
unused << SendFileSystemUpdate(volName, mountPoint, state,
mountGeneration, isMediaPresent,
isSharing);
} else if (!strcmp(aTopic, "phone-state-changed")) {
nsString state(aData);
unused << SendNotifyPhoneStateChange(state);
}
#endif
#ifdef ACCESSIBILITY

View File

@ -319,6 +319,7 @@ child:
async LoadAndRegisterSheet(URIParams uri, uint32_t type);
async UnregisterSheet(URIParams uri, uint32_t type);
NotifyPhoneStateChange(nsString newState);
parent:
/**
* Tell the content process some attributes of itself. This is