Bug 875721 - Part 2: Move iccInfo related attribute/event from mozMobileConnection to mozIccManager (DOM). r=smaug
authorEdgar Chen <echen@mozilla.com>
Thu, 30 May 2013 18:36:10 +0800
changeset 138357 51e77c028e729a7861999b40467b403d4262de27
parent 138356 309c74044e8d39c98825063d93fc87f6cca276bd
child 138358 b37a8382f554c2d24d5d9fe9731c1bb117cf01f1
push id30945
push userryanvm@gmail.com
push dateFri, 12 Jul 2013 19:51:45 +0000
treeherdermozilla-inbound@35fca0404633 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs875721
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 875721 - Part 2: Move iccInfo related attribute/event from mozMobileConnection to mozIccManager (DOM). r=smaug
dom/icc/src/IccManager.cpp
dom/network/src/MobileConnection.cpp
--- a/dom/icc/src/IccManager.cpp
+++ b/dom/icc/src/IccManager.cpp
@@ -1,15 +1,16 @@
 /* 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 "mozilla/Services.h"
 #include "nsIDOMClassInfo.h"
 #include "nsIDOMIccCardLockErrorEvent.h"
+#include "nsIDOMIccInfo.h"
 #include "GeneratedEvents.h"
 #include "IccManager.h"
 #include "SimToolKit.h"
 #include "StkCommandEvent.h"
 
 #define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
 
 using namespace mozilla::dom::icc;
@@ -125,16 +126,28 @@ IccManager::SendStkEventDownload(const J
     return NS_ERROR_FAILURE;
   }
 
   mProvider->SendStkEventDownload(GetOwner(), aEvent);
   return NS_OK;
 }
 
 NS_IMETHODIMP
+IccManager::GetIccInfo(nsIDOMMozIccInfo** aIccInfo)
+{
+  *aIccInfo = nullptr;
+
+  if (!mProvider) {
+    return NS_ERROR_FAILURE;
+  }
+
+  return mProvider->GetIccInfo(aIccInfo);
+}
+
+NS_IMETHODIMP
 IccManager::GetCardState(nsAString& cardState)
 {
   cardState.SetIsVoid(true);
 
   if (!mProvider) {
     return NS_ERROR_FAILURE;
   }
   return mProvider->GetCardState(cardState);
@@ -232,16 +245,17 @@ IccManager::UpdateContact(const nsAStrin
 
   return mProvider->UpdateContact(GetOwner(), aContactType, aContact, aPin2, aRequest);
 }
 
 NS_IMPL_EVENT_HANDLER(IccManager, stkcommand)
 NS_IMPL_EVENT_HANDLER(IccManager, stksessionend)
 NS_IMPL_EVENT_HANDLER(IccManager, icccardlockerror)
 NS_IMPL_EVENT_HANDLER(IccManager, cardstatechange)
+NS_IMPL_EVENT_HANDLER(IccManager, iccinfochange)
 
 // nsIIccListener
 
 NS_IMETHODIMP
 IccManager::NotifyStkCommand(const nsAString& aMessage)
 {
   nsRefPtr<StkCommandEvent> event = StkCommandEvent::Create(this, aMessage);
   NS_ASSERTION(event, "This should never fail!");
@@ -269,9 +283,15 @@ IccManager::NotifyIccCardLockError(const
 
   return DispatchTrustedEvent(ce);
 }
 
 NS_IMETHODIMP
 IccManager::NotifyCardStateChanged()
 {
   return DispatchTrustedEvent(NS_LITERAL_STRING("cardstatechange"));
+}
+
+NS_IMETHODIMP
+IccManager::NotifyIccInfoChanged()
+{
+  return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
 }
\ No newline at end of file
--- a/dom/network/src/MobileConnection.cpp
+++ b/dom/network/src/MobileConnection.cpp
@@ -62,17 +62,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MobileConnection)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMozMobileConnection)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozMobileConnection)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(MobileConnection, nsDOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(MobileConnection, nsDOMEventTargetHelper)
 
-NS_IMPL_EVENT_HANDLER(MobileConnection, iccinfochange)
 NS_IMPL_EVENT_HANDLER(MobileConnection, voicechange)
 NS_IMPL_EVENT_HANDLER(MobileConnection, datachange)
 NS_IMPL_EVENT_HANDLER(MobileConnection, ussdreceived)
 NS_IMPL_EVENT_HANDLER(MobileConnection, dataerror)
 NS_IMPL_EVENT_HANDLER(MobileConnection, cfstatechange)
 
 MobileConnection::MobileConnection()
 {
@@ -168,27 +167,16 @@ MobileConnection::GetRetryCount(int32_t*
 
   if (!mProvider || !CheckPermission("mobileconnection")) {
     return NS_OK;
   }
   return mProvider->GetRetryCount(retryCount);
 }
 
 NS_IMETHODIMP
-MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo)
-{
-  *aIccInfo = nullptr;
-
-  if (!mProvider || !CheckPermission("mobileconnection")) {
-    return NS_OK;
-  }
-  return mProvider->GetIccInfo(aIccInfo);
-}
-
-NS_IMETHODIMP
 MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
 {
   *voice = nullptr;
 
   if (!mProvider || !CheckPermission("mobileconnection")) {
     return NS_OK;
   }
   return mProvider->GetVoiceConnectionInfo(voice);
@@ -412,26 +400,16 @@ MobileConnection::NotifyDataChanged()
   if (!CheckPermission("mobileconnection")) {
     return NS_OK;
   }
 
   return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
 }
 
 NS_IMETHODIMP
-MobileConnection::NotifyIccInfoChanged()
-{
-  if (!CheckPermission("mobileconnection")) {
-    return NS_OK;
-  }
-
-  return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
-}
-
-NS_IMETHODIMP
 MobileConnection::NotifyUssdReceived(const nsAString& aMessage,
                                      bool aSessionEnded)
 {
   if (!CheckPermission("mobileconnection")) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIDOMEvent> event;