Bug 729173 - Part 2: MobileConnection boilerplate. r=mounir

This commit is contained in:
Philipp von Weitershausen 2012-04-19 18:33:25 -03:00
parent 788e34bf37
commit 9bd7b30ecb
5 changed files with 154 additions and 0 deletions

View File

@ -518,6 +518,7 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
#include "nsIDOMSmsCursor.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMConnection.h"
#include "nsIDOMMobileConnection.h"
#include "mozilla/dom/network/Utils.h"
#ifdef MOZ_B2G_RIL
@ -1458,6 +1459,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(MozConnection, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozMobileConnection, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceStyleDecl, nsCSSStyleDeclSH,
@ -4075,6 +4079,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozMobileConnection, nsIDOMMozMobileConnection)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileConnection)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_END

View File

@ -436,6 +436,7 @@ DOMCI_CLASS(MozSmsFilter)
DOMCI_CLASS(MozSmsCursor)
DOMCI_CLASS(MozConnection)
DOMCI_CLASS(MozMobileConnection)
// @font-face in CSS
DOMCI_CLASS(CSSFontFaceRule)

View File

@ -57,6 +57,7 @@ EXPORTS_mozilla/dom/network = \
CPPSRCS = \
Connection.cpp \
MobileConnection.cpp \
Utils.cpp \
$(NULL)

View File

@ -0,0 +1,97 @@
/* 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 "MobileConnection.h"
#include "nsIDOMDOMRequest.h"
#include "nsIDOMClassInfo.h"
DOMCI_DATA(MozMobileConnection, mozilla::dom::network::MobileConnection)
namespace mozilla {
namespace dom {
namespace network {
NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(MobileConnection,
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(cardstatechange)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(voicechange)
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(datachange)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MobileConnection,
nsDOMEventTargetHelper)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(cardstatechange)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(voicechange)
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(datachange)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MobileConnection)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozMobileConnection)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, 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)
MobileConnection::MobileConnection()
{
}
void
MobileConnection::Init(nsPIDOMWindow* aWindow)
{
BindToOwner(aWindow);
}
void
MobileConnection::Shutdown()
{
}
// nsIObserver
NS_IMETHODIMP
MobileConnection::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
return NS_OK;
}
// nsIDOMMozMobileConnection
NS_IMETHODIMP
MobileConnection::GetCardState(nsAString& cardState)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MobileConnection::GetData(nsIDOMMozMobileConnectionInfo** data)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MobileConnection::GetNetworks(nsIDOMDOMRequest** request)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMPL_EVENT_HANDLER(MobileConnection, cardstatechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, voicechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, datachange)
} // namespace network
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,46 @@
/* 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/. */
#ifndef mozilla_dom_network_MobileConnection_h
#define mozilla_dom_network_MobileConnection_h
#include "nsIObserver.h"
#include "nsIDOMMobileConnection.h"
#include "nsDOMEventTargetHelper.h"
#include "nsCycleCollectionParticipant.h"
namespace mozilla {
namespace dom {
namespace network {
class MobileConnection : public nsDOMEventTargetHelper
, public nsIDOMMozMobileConnection
, public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_DECL_NSIDOMMOZMOBILECONNECTION
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
MobileConnection();
void Init(nsPIDOMWindow *aWindow);
void Shutdown();
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection,
nsDOMEventTargetHelper)
private:
NS_DECL_EVENT_HANDLER(cardstatechange)
NS_DECL_EVENT_HANDLER(voicechange)
NS_DECL_EVENT_HANDLER(datachange)
};
} // namespace network
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_network_MobileConnection_h