Bug 1000670 - part 3 - DOM: create and dispatch clirmodechange event. r=smaug

This commit is contained in:
Hsin-Yi Tsai 2014-04-24 14:37:49 +08:00
parent 5042aa37e7
commit b6e5cdb4e3
4 changed files with 27 additions and 0 deletions

View File

@ -676,6 +676,7 @@ GK_ATOM(onchargingchange, "onchargingchange")
GK_ATOM(onchargingtimechange, "onchargingtimechange")
GK_ATOM(onchecking, "onchecking")
GK_ATOM(onclick, "onclick")
GK_ATOM(onclirmodechange, "onclirmodechange")
GK_ATOM(onclose, "onclose")
GK_ATOM(oncommand, "oncommand")
GK_ATOM(oncommandupdate, "oncommandupdate")

View File

@ -229,6 +229,10 @@ const kEventConstructors = {
return new MozCellBroadcastEvent(aName, aProps);
},
},
MozClirModeEvent: { create: function (aName, aProps) {
return new MozClirModeEvent(aName, aProps);
},
},
MozContactChangeEvent: { create: function (aName, aProps) {
return new MozContactChangeEvent(aName, aProps);
},

View File

@ -7,6 +7,7 @@
#include "GeneratedEvents.h"
#include "mozilla/dom/CFStateChangeEvent.h"
#include "mozilla/dom/DataErrorEvent.h"
#include "mozilla/dom/MozClirModeEvent.h"
#include "mozilla/dom/MozEmergencyCbModeEvent.h"
#include "mozilla/dom/MozOtaStatusEvent.h"
#include "mozilla/dom/USSDReceivedEvent.h"
@ -79,6 +80,7 @@ NS_IMPL_EVENT_HANDLER(MobileConnection, emergencycbmodechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, otastatuschange)
NS_IMPL_EVENT_HANDLER(MobileConnection, iccchange)
NS_IMPL_EVENT_HANDLER(MobileConnection, radiostatechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, clirmodechange)
MobileConnection::MobileConnection(uint32_t aClientId)
: mClientId(aClientId)
@ -733,3 +735,21 @@ MobileConnection::NotifyRadioStateChanged()
return DispatchTrustedEvent(NS_LITERAL_STRING("radiostatechange"));
}
NS_IMETHODIMP
MobileConnection::NotifyClirModeChanged(uint32_t aMode)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
MozClirModeEventInit init;
init.mBubbles = false;
init.mCancelable = false;
init.mMode = aMode;
nsRefPtr<MozClirModeEvent> event =
MozClirModeEvent::Constructor(this, NS_LITERAL_STRING("clirmodechange"), init);
return DispatchTrustedEvent(event);
}

View File

@ -619,6 +619,8 @@ var interfaceNamesInGlobalScope =
{name: "MozCellBroadcast", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozCellBroadcastEvent", b2g: true, pref: "dom.cellbroadcast.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozClirModeEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
"mozContact",
// IMPORTANT: Do not change this list without review from a DOM peer!