mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 707883 - Rename nsIRadio{Interface,Callback} -> nsITelephone{Interface,Callback} since this is not at all generic. r=bent
--HG-- rename : dom/telephony/nsIRadioInterface.idl => dom/telephony/nsITelephone.idl
This commit is contained in:
parent
270028cc08
commit
e3765103cc
@ -264,8 +264,8 @@ RadioManager::Init()
|
||||
mozilla::RefPtr<RILReceiver> receiver = new RILReceiver(wctd);
|
||||
StartRil(receiver);
|
||||
|
||||
mRadioInterface = do_QueryInterface(worker);
|
||||
NS_ENSURE_TRUE(mRadioInterface, NS_ERROR_FAILURE);
|
||||
mTelephone = do_QueryInterface(worker);
|
||||
NS_ENSURE_TRUE(mTelephone, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -276,7 +276,7 @@ RadioManager::Shutdown()
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
StopRil();
|
||||
mRadioInterface = nsnull;
|
||||
mTelephone = nsnull;
|
||||
|
||||
mShutdown = true;
|
||||
}
|
||||
@ -302,13 +302,13 @@ RadioManager::FactoryCreate()
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsIRadioInterface>
|
||||
RadioManager::GetRadioInterface()
|
||||
already_AddRefed<nsITelephone>
|
||||
RadioManager::GetTelephone()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (gInstance) {
|
||||
nsCOMPtr<nsIRadioInterface> retval = gInstance->mRadioInterface;
|
||||
nsCOMPtr<nsITelephone> retval = gInstance->mTelephone;
|
||||
return retval.forget();
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "mozilla/ipc/Ril.h"
|
||||
#include "nsIRadioInterface.h"
|
||||
#include "nsITelephone.h"
|
||||
|
||||
#define TELEPHONYRADIO_CONTRACTID "@mozilla.org/telephony/radio;1"
|
||||
#define TELEPHONYRADIOINTERFACE_CONTRACTID "@mozilla.org/telephony/radio-interface;1"
|
||||
@ -85,14 +85,14 @@ public:
|
||||
static already_AddRefed<RadioManager>
|
||||
FactoryCreate();
|
||||
|
||||
static already_AddRefed<nsIRadioInterface>
|
||||
GetRadioInterface();
|
||||
static already_AddRefed<nsITelephone>
|
||||
GetTelephone();
|
||||
|
||||
protected:
|
||||
RadioManager();
|
||||
~RadioManager();
|
||||
|
||||
nsCOMPtr<nsIRadioInterface> mRadioInterface;
|
||||
nsCOMPtr<nsITelephone> mTelephone;
|
||||
bool mShutdown;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ include $(topsrcdir)/dom/dom-config.mk
|
||||
XPIDLSRCS = \
|
||||
mozIDOMTelephony.idl \
|
||||
nsITelephonyWorker.idl \
|
||||
nsIRadioInterface.idl \
|
||||
nsITelephone.idl \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
|
@ -152,7 +152,7 @@ const DOM_CARDSTATE_NOT_READY = "not_ready";
|
||||
const DOM_CARDSTATE_READY = "ready";
|
||||
|
||||
/**
|
||||
* Callback object that Telephony registers with nsIRadioInterface.
|
||||
* Callback object that Telephony registers with nsITelephone.
|
||||
* Telephony can't use itself because that might overload event handler
|
||||
* attributes ('onfoobar').
|
||||
*/
|
||||
@ -161,9 +161,9 @@ function TelephonyRadioCallback(telephony) {
|
||||
}
|
||||
TelephonyRadioCallback.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRadioCallback]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephoneCallback]),
|
||||
|
||||
// nsIRadioCallback
|
||||
// nsITelephoneCallback
|
||||
|
||||
onsignalstrengthchange: function onsignalstrengthchange(signalStrength) {
|
||||
this.telephony.signalStrength = signalStrength;
|
||||
@ -215,7 +215,7 @@ Telephony.prototype = {
|
||||
init: function init(window) {
|
||||
this.window = window;
|
||||
this.radioInterface = Cc["@mozilla.org/telephony/radio-interface;1"]
|
||||
.createInstance(Ci.nsIRadioInterface);
|
||||
.createInstance(Ci.nsITelephone);
|
||||
this.radioCallback = new TelephonyRadioCallback(this);
|
||||
window.addEventListener("unload", function onunload(event) {
|
||||
this.radioInterface.unregisterCallback(this.radioCallback);
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(e21cdf40-c511-442b-8c7d-aa75471b0423)]
|
||||
interface nsIRadioCallback : nsISupports {
|
||||
interface nsITelephoneCallback : nsISupports {
|
||||
void oncallstatechange(in jsval callState);
|
||||
|
||||
//XXX philikon's additions
|
||||
@ -49,13 +49,13 @@ interface nsIRadioCallback : nsISupports {
|
||||
};
|
||||
|
||||
[scriptable, uuid(dda49485-5887-49bb-ba0b-10c5d116eb64)]
|
||||
interface nsIRadioInterface : nsISupports {
|
||||
interface nsITelephone : nsISupports {
|
||||
|
||||
readonly attribute jsval initialState;
|
||||
|
||||
void dial(in DOMString number);
|
||||
void hangup(in long callIndex);
|
||||
|
||||
void registerCallback(in nsIRadioCallback callback);
|
||||
void unregisterCallback(in nsIRadioCallback callback);
|
||||
void registerCallback(in nsITelephoneCallback callback);
|
||||
void unregisterCallback(in nsITelephoneCallback callback);
|
||||
};
|
@ -61,10 +61,10 @@ nsTelephonyWorker.prototype = {
|
||||
contractID: TELEPHONYWORKER_CONTRACTID,
|
||||
classDescription: "TelephonyWorker",
|
||||
interfaces: [Ci.nsITelephonyWorker,
|
||||
Ci.nsIRadioInterface]}),
|
||||
Ci.nsITelephone]}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyWorker,
|
||||
Ci.nsIRadioInterface]),
|
||||
Ci.nsITelephone]),
|
||||
|
||||
onerror: function onerror(event) {
|
||||
// It is very important to call preventDefault on the event here.
|
||||
@ -118,11 +118,11 @@ nsTelephonyWorker.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
// nsITelephonWorker
|
||||
// nsITelephonyWorker
|
||||
|
||||
worker: null,
|
||||
|
||||
// nsIRadioInterface
|
||||
// nsITelephone
|
||||
|
||||
initialState: null,
|
||||
|
||||
|
@ -324,7 +324,7 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(IndexedDatabaseManager,
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(RadioManager, RadioManager::FactoryCreate)
|
||||
|
||||
// The 'RadioManager' class controls the lifetime of the nsITelephonyWorker
|
||||
// object which is also an nsIRadioInterface, so we don't want to register it
|
||||
// object which is also an nsITelephone, so we don't want to register it
|
||||
// as a global service on app-startup. Instead, we'll (ab)use createInstance()
|
||||
// to always return the one singleton that 'RadioManager' holds on to.
|
||||
static nsresult
|
||||
@ -334,7 +334,7 @@ RadioInterfaceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRadioInterface> inst = RadioManager::GetRadioInterface();
|
||||
nsCOMPtr<nsITelephone> inst = RadioManager::GetTelephone();
|
||||
if (NULL == inst) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user