From c6929f7270cace5f28d7560367adfc8db4f6183d Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Wed, 6 Mar 2013 17:53:08 +0800 Subject: [PATCH] Bug 834160 - Part 1/7: Refactor RILContentHelper callback registration. Interface changes. r=allstars.chh,htsai f=mounir --- .../interfaces/nsICellBroadcastProvider.idl | 35 ++++ dom/icc/interfaces/nsIIccProvider.idl | 54 ++++++ .../nsIMobileConnectionProvider.idl | 54 +++--- dom/system/gonk/nsIRadioInterfaceLayer.idl | 173 +----------------- dom/telephony/nsITelephonyProvider.idl | 111 +++++++++++ dom/voicemail/nsIVoicemailProvider.idl | 39 ++++ 6 files changed, 265 insertions(+), 201 deletions(-) create mode 100644 dom/cellbroadcast/interfaces/nsICellBroadcastProvider.idl create mode 100644 dom/icc/interfaces/nsIIccProvider.idl create mode 100644 dom/telephony/nsITelephonyProvider.idl create mode 100644 dom/voicemail/nsIVoicemailProvider.idl diff --git a/dom/cellbroadcast/interfaces/nsICellBroadcastProvider.idl b/dom/cellbroadcast/interfaces/nsICellBroadcastProvider.idl new file mode 100644 index 000000000000..d05a14bb6308 --- /dev/null +++ b/dom/cellbroadcast/interfaces/nsICellBroadcastProvider.idl @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMMozCellBroadcastMessage; + +[scriptable, uuid(4c6fb794-31bd-4ed7-b21a-34b82aa3efbe)] +interface nsICellBroadcastListener : nsISupports +{ + /** + * Called when a Cell Broadcast message has been received by the network. + * + * @param message + * The received Cell Broadcast Message. + */ + void notifyMessageReceived(in nsIDOMMozCellBroadcastMessage message); +}; + +/** + * XPCOM component (in the content process) that provides the cell broadcast + * information. + */ +[scriptable, uuid(e6c01d18-829e-4d5a-9611-60fca36e6b46)] +interface nsICellBroadcastProvider : nsISupports +{ + /** + * Called when a content process registers receiving unsolicited messages from + * RadioInterfaceLayer in the chrome process. Only a content process that has + * the 'cellbroadcast' permission is allowed to register. + */ + void registerCellBroadcastMsg(in nsICellBroadcastListener listener); + void unregisterCellBroadcastMsg(in nsICellBroadcastListener listener); +}; diff --git a/dom/icc/interfaces/nsIIccProvider.idl b/dom/icc/interfaces/nsIIccProvider.idl new file mode 100644 index 000000000000..97d667ef56f1 --- /dev/null +++ b/dom/icc/interfaces/nsIIccProvider.idl @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMWindow; +interface nsIDOMDOMRequest; + +[scriptable, uuid(f383a42b-0961-4bb0-b45e-dbc345d59237)] +interface nsIIccListener : nsISupports +{ + void notifyStkCommand(in DOMString aMessage); + void notifyStkSessionEnd(); +}; + +/** + * XPCOM component (in the content process) that provides the ICC information. + */ +[scriptable, uuid(1bfb62cf-544c-4adb-b91c-c75e5d0dce29)] +interface nsIIccProvider : nsISupports +{ + /** + * Called when a content process registers receiving unsolicited messages from + * RadioInterfaceLayer in the chrome process. Only a content process that has + * the 'mobileconnection' permission is allowed to register. + */ + void registerIccMsg(in nsIIccListener listener); + void unregisterIccMsg(in nsIIccListener listener); + + void sendStkResponse(in nsIDOMWindow window, + in jsval command, + in jsval response); + void sendStkMenuSelection(in nsIDOMWindow window, + in unsigned short itemIdentifier, + in boolean helpRequested); + void sendStkTimerExpiration(in nsIDOMWindow window, + in jsval timer); + void sendStkEventDownload(in nsIDOMWindow window, + in jsval event); + + /** + * Secure Card Icc communication channel + */ + nsIDOMDOMRequest iccOpenChannel(in nsIDOMWindow window, + in DOMString aid); + + nsIDOMDOMRequest iccExchangeAPDU(in nsIDOMWindow window, + in long channel, + in jsval apdu); + + nsIDOMDOMRequest iccCloseChannel(in nsIDOMWindow window, + in long channel); +}; diff --git a/dom/network/interfaces/nsIMobileConnectionProvider.idl b/dom/network/interfaces/nsIMobileConnectionProvider.idl index bcc556f615d0..12d44f33af20 100644 --- a/dom/network/interfaces/nsIMobileConnectionProvider.idl +++ b/dom/network/interfaces/nsIMobileConnectionProvider.idl @@ -11,22 +11,40 @@ interface nsIDOMMozMobileCFInfo; interface nsIDOMDOMRequest; interface nsIDOMWindow; +[scriptable, uuid(2cb8e811-7eaf-4cb9-8aa8-581e7a245edc)] +interface nsIMobileConnectionListener : nsISupports +{ + void notifyVoiceChanged(); + void notifyDataChanged(); + void notifyCardStateChanged(); + void notifyIccInfoChanged(); + void notifyUssdReceived(in DOMString message, + in boolean sessionEnded); + void notifyDataError(in DOMString message); + void notifyIccCardLockError(in DOMString lockType, + in unsigned long retryCount); + void notifyCFStateChange(in boolean success, + in unsigned short action, + in unsigned short reason, + in DOMString number, + in unsigned short timeSeconds, + in unsigned short serviceClass); +}; + /** * XPCOM component (in the content process) that provides the mobile * network information. */ -[scriptable, uuid(0fb90831-801d-4a84-a56f-7cbc77ba9d61)] +[scriptable, uuid(152da558-c3c0-45ad-9ac5-1adaf7a83c0d)] interface nsIMobileConnectionProvider : nsISupports { /** * Called when a content process registers receiving unsolicited messages from * RadioInterfaceLayer in the chrome process. Only a content process that has - * the 'mobileconnection' permission is allowed to register. Note that content - * doesn't need to unregister because the chrome process will remove it from - * the registration list once the chrome receives a 'child-process-shutdown' - * message. + * the 'mobileconnection' permission is allowed to register. */ - void registerMobileConnectionMsg(); + void registerMobileConnectionMsg(in nsIMobileConnectionListener listener); + void unregisterMobileConnectionMsg(in nsIMobileConnectionListener listener); readonly attribute DOMString cardState; readonly attribute nsIDOMMozMobileICCInfo iccInfo; @@ -45,32 +63,8 @@ interface nsIMobileConnectionProvider : nsISupports nsIDOMDOMRequest sendMMI(in nsIDOMWindow window, in DOMString mmi); nsIDOMDOMRequest cancelMMI(in nsIDOMWindow window); - void sendStkResponse(in nsIDOMWindow window, - in jsval command, - in jsval response); - void sendStkMenuSelection(in nsIDOMWindow window, - in unsigned short itemIdentifier, - in boolean helpRequested); - void sendStkTimerExpiration(in nsIDOMWindow window, - in jsval timer); - void sendStkEventDownload(in nsIDOMWindow window, - in jsval event); - nsIDOMDOMRequest getCallForwardingOption(in nsIDOMWindow window, in unsigned short reason); nsIDOMDOMRequest setCallForwardingOption(in nsIDOMWindow window, in nsIDOMMozMobileCFInfo CFInfo); - - /** - * Secure Card Icc communication channel - */ - nsIDOMDOMRequest iccOpenChannel(in nsIDOMWindow window, - in DOMString aid); - - nsIDOMDOMRequest iccExchangeAPDU(in nsIDOMWindow window, - in long channel, - in jsval apdu); - - nsIDOMDOMRequest iccCloseChannel(in nsIDOMWindow window, - in long channel); }; diff --git a/dom/system/gonk/nsIRadioInterfaceLayer.idl b/dom/system/gonk/nsIRadioInterfaceLayer.idl index 2a47d06d90a8..0bb179f90979 100644 --- a/dom/system/gonk/nsIRadioInterfaceLayer.idl +++ b/dom/system/gonk/nsIRadioInterfaceLayer.idl @@ -3,80 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsIMobileConnectionProvider.idl" interface nsIDOMMozMobileConnectionInfo; -interface nsIDOMDOMRequest; -interface nsIDOMWindow; -interface nsIDOMMozVoicemailStatus; +interface nsIDOMMozMobileICCInfo; interface nsISmsRequest; interface nsIDOMMozSmsSegmentInfo; -interface nsIDOMMozCellBroadcastMessage; - -[scriptable, uuid(0faabc35-644d-4ed5-b109-425280ff1cdf)] -interface nsIRILTelephonyCallback : nsISupports -{ - /** - * Notified when a telephony call changes state. - * - * @param callIndex - * Call identifier assigned by the RIL. - * @param callState - * One of the nsIRadioInterfaceLayer::CALL_STATE_* values. - * @param number - * Number of the other party. - * @param isActive - * Indicates whether this call is the currently active one. - */ - void callStateChanged(in unsigned long callIndex, - in unsigned short callState, - in AString number, - in boolean isActive); - - /** - * Called when nsIRILContentHelper is asked to enumerate the current - * telephony call state (nsIRILContentHelper::enumerateCalls). This is - * called once per call that is currently managed by the RIL. - * - * @param callIndex - * Call identifier assigned by the RIL. - * @param callState - * One of the nsIRadioInterfaceLayer::CALL_STATE_* values. - * @param number - * Number of the other party. - * @param isActive - * Indicates whether this call is the active one. - * - * @return true to continue enumeration or false to cancel. - */ - boolean enumerateCallState(in unsigned long callIndex, - in unsigned short callState, - in AString number, - in boolean isActive); - - /** - * Called when RIL error occurs. - * - * @param callIndex - * Call identifier assigned by the RIL. -1 if no connection - * @param error - * Error from RIL. - */ - void notifyError(in long callIndex, - in AString error); -}; - -[scriptable, uuid(521cfe4a-bf79-4134-a9fc-e2242164d657)] -interface nsIRILVoicemailCallback : nsISupports -{ - /** - * Called when a voicemail notification has been received by the network. - * - * @param status - * The new voicemail status - */ - void voicemailNotification(in nsIDOMMozVoicemailStatus status); -}; [scriptable, uuid(1e602d20-d066-4399-8997-daf36b3158ef)] interface nsIRILDataCallInfo : nsISupports @@ -153,93 +84,6 @@ interface nsIRILContactUpdateCallback : nsISupports in DOMString contactType); }; -[scriptable, uuid(c5e31c2c-a6a1-44c3-a30e-7fdfb4dc1750)] -interface nsIRILCellBroadcastCallback : nsISupports -{ - /** - * Called when a Cell Broadcast message has been received by the network. - * - * @param message - * The received Cell Broadcast Message. - */ - void notifyMessageReceived(in nsIDOMMozCellBroadcastMessage message); -}; - -/** - * Helper that runs in the content process and exposes information - * to the DOM. - */ -[scriptable, uuid(8c35c286-7a84-410d-9b36-b15f2cadf78f)] -interface nsIRILContentHelper : nsIMobileConnectionProvider -{ - void registerTelephonyCallback(in nsIRILTelephonyCallback callback); - void unregisterTelephonyCallback(in nsIRILTelephonyCallback callback); - - void registerVoicemailCallback(in nsIRILVoicemailCallback callback); - void unregisterVoicemailCallback(in nsIRILVoicemailCallback callback); - - void registerCellBroadcastCallback(in nsIRILCellBroadcastCallback callback); - void unregisterCellBroadcastCallback(in nsIRILCellBroadcastCallback callback); - - /** - * Called when a content process registers receiving unsolicited messages from - * RadioInterfaceLayer in the chrome process. Only a content process that has - * the 'telephony' permission is allowed to register. Note that content - * doesn't need to unregister because the chrome process will remove it from - * the registration list once the chrome receives a 'child-process-shutdown' - * message. - */ - void registerTelephonyMsg(); - - /** - * Called when a content process registers receiving unsolicited messages from - * RadioInterfaceLayer in the chrome process. Only a content process that has - * the 'voicemail' permission is allowed to register. Note that content - * doesn't need to unregister because the chrome process will remove it from - * the registration list once the chrome receives a 'child-process-shutdown' - * message. - */ - void registerVoicemailMsg(); - - /** - * Called when a content process registers receiving unsolicited messages from - * RadioInterfaceLayer in the chrome process. Only a content process that has - * the 'cellbroadcast' permission is allowed to register. Note that content - * doesn't need to unregister because the chrome process will remove it from - * the registration list once the chrome receives a 'child-process-shutdown' - * message. - */ - void registerCellBroadcastMsg(); - - /** - * Will continue calling callback.enumerateCallState until the callback - * returns false. - */ - void enumerateCalls(in nsIRILTelephonyCallback callback); - - /** - * Functionality for making and managing phone calls. - */ - void dial(in DOMString number); - void dialEmergency(in DOMString number); - void hangUp(in unsigned long callIndex); - - void startTone(in DOMString dtmfChar); - void stopTone(); - - void answerCall(in unsigned long callIndex); - void rejectCall(in unsigned long callIndex); - void holdCall(in unsigned long callIndex); - void resumeCall(in unsigned long callIndex); - - attribute bool microphoneMuted; - attribute bool speakerEnabled; - - readonly attribute nsIDOMMozVoicemailStatus voicemailStatus; - readonly attribute DOMString voicemailNumber; - readonly attribute DOMString voicemailDisplayName; -}; - [scriptable, uuid(c0c5cb9f-6372-4b5a-b74c-baacc2da5e4f)] interface nsIVoicemailInfo : nsISupports { @@ -264,22 +108,9 @@ interface nsIRilContext : nsISupports readonly attribute nsIDOMMozMobileConnectionInfo data; }; -[scriptable, uuid(385345ee-f78c-4be4-abd2-07d3dae4e208)] +[scriptable, uuid(c8336da3-2539-42ce-a63f-e5cbdfc0da36)] interface nsIRadioInterfaceLayer : nsISupports { - const unsigned short CALL_STATE_UNKNOWN = 0; - const unsigned short CALL_STATE_DIALING = 1; - const unsigned short CALL_STATE_ALERTING = 2; - const unsigned short CALL_STATE_BUSY = 3; - const unsigned short CALL_STATE_CONNECTING = 4; - const unsigned short CALL_STATE_CONNECTED = 5; - const unsigned short CALL_STATE_HOLDING = 6; - const unsigned short CALL_STATE_HELD = 7; - const unsigned short CALL_STATE_RESUMING = 8; - const unsigned short CALL_STATE_DISCONNECTING = 9; - const unsigned short CALL_STATE_DISCONNECTED = 10; - const unsigned short CALL_STATE_INCOMING = 11; - /** * Activates or deactivates radio power. */ diff --git a/dom/telephony/nsITelephonyProvider.idl b/dom/telephony/nsITelephonyProvider.idl new file mode 100644 index 000000000000..ab81f9359f8b --- /dev/null +++ b/dom/telephony/nsITelephonyProvider.idl @@ -0,0 +1,111 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(2ab9abfe-09fb-4fea-985f-acf29fc7376a)] +interface nsITelephonyListener : nsISupports +{ + /** + * Notified when a telephony call changes state. + * + * @param callIndex + * Call identifier assigned by the RIL. + * @param callState + * One of the nsITelephonyProvider::CALL_STATE_* values. + * @param number + * Number of the other party. + * @param isActive + * Indicates whether this call is the currently active one. + */ + void callStateChanged(in unsigned long callIndex, + in unsigned short callState, + in AString number, + in boolean isActive); + + /** + * Called when nsITelephonyProvider is asked to enumerate the current + * telephony call state (nsITelephonyProvider::enumerateCalls). This is + * called once per call that is currently managed by the RIL. + * + * @param callIndex + * Call identifier assigned by the RIL. + * @param callState + * One of the nsITelephonyProvider::CALL_STATE_* values. + * @param number + * Number of the other party. + * @param isActive + * Indicates whether this call is the active one. + * + * @return true to continue enumeration or false to cancel. + */ + boolean enumerateCallState(in unsigned long callIndex, + in unsigned short callState, + in AString number, + in boolean isActive); + + /** + * Called when RIL error occurs. + * + * @param callIndex + * Call identifier assigned by the RIL. -1 if no connection + * @param error + * Error from RIL. + */ + void notifyError(in long callIndex, + in AString error); +}; + +/** + * XPCOM component (in the content process) that provides the telephony + * information. + */ +[scriptable, uuid(099e1d81-f247-4ebb-89d8-cd89dd5f6ed4)] +interface nsITelephonyProvider : nsISupports +{ + const unsigned short CALL_STATE_UNKNOWN = 0; + const unsigned short CALL_STATE_DIALING = 1; + const unsigned short CALL_STATE_ALERTING = 2; + const unsigned short CALL_STATE_BUSY = 3; + const unsigned short CALL_STATE_CONNECTING = 4; + const unsigned short CALL_STATE_CONNECTED = 5; + const unsigned short CALL_STATE_HOLDING = 6; + const unsigned short CALL_STATE_HELD = 7; + const unsigned short CALL_STATE_RESUMING = 8; + const unsigned short CALL_STATE_DISCONNECTING = 9; + const unsigned short CALL_STATE_DISCONNECTED = 10; + const unsigned short CALL_STATE_INCOMING = 11; + + /** + * Called when a content process registers receiving unsolicited messages from + * RadioInterfaceLayer in the chrome process. Only a content process that has + * the 'telephony' permission is allowed to register. + */ + void registerTelephonyMsg(in nsITelephonyListener listener); + void unregisterTelephonyMsg(in nsITelephonyListener listener); + + /** + * Will continue calling listener.enumerateCallState until the listener + * returns false. + */ + void enumerateCalls(in nsITelephonyListener listener); + + /** + * Functionality for making and managing phone calls. + */ + void dial(in DOMString number); + void dialEmergency(in DOMString number); + void hangUp(in unsigned long callIndex); + + void startTone(in DOMString dtmfChar); + void stopTone(); + + void answerCall(in unsigned long callIndex); + void rejectCall(in unsigned long callIndex); + void holdCall(in unsigned long callIndex); + void resumeCall(in unsigned long callIndex); + + attribute bool microphoneMuted; + attribute bool speakerEnabled; +}; diff --git a/dom/voicemail/nsIVoicemailProvider.idl b/dom/voicemail/nsIVoicemailProvider.idl new file mode 100644 index 000000000000..4d036386f6ac --- /dev/null +++ b/dom/voicemail/nsIVoicemailProvider.idl @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMMozVoicemailStatus; + +[scriptable, uuid(214b0963-da48-4859-a56c-f065a90e0403)] +interface nsIVoicemailListener : nsISupports +{ + /** + * Called when a voicemail notification has been received by the network. + * + * @param status + * The new voicemail status + */ + void notifyStatusChanged(in nsIDOMMozVoicemailStatus status); +}; + +/** + * XPCOM component (in the content process) that provides the voicemail + * information. + */ +[scriptable, uuid(37bc0991-21a3-4de9-b888-d667fea6c05d)] +interface nsIVoicemailProvider : nsISupports +{ + /** + * Called when a content process registers receiving unsolicited messages from + * RadioInterfaceLayer in the chrome process. Only a content process that has + * the 'voicemail' permission is allowed to register. + */ + void registerVoicemailMsg(in nsIVoicemailListener listener); + void unregisterVoicemailMsg(in nsIVoicemailListener listener); + + readonly attribute nsIDOMMozVoicemailStatus voicemailStatus; + readonly attribute DOMString voicemailNumber; + readonly attribute DOMString voicemailDisplayName; +};