mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 778093 - Part 2/9: add navigator.mozCellBroadcast, r=mounir
This commit is contained in:
parent
430c5a72dc
commit
fcdc68fd47
@ -160,6 +160,7 @@
|
||||
@BINPATH@/components/dom_wifi.xpt
|
||||
@BINPATH@/components/dom_system_gonk.xpt
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
@BINPATH@/components/dom_cellbroadcast.xpt
|
||||
#endif
|
||||
#ifdef MOZ_B2G_FM
|
||||
@BINPATH@/components/dom_fm.xpt
|
||||
|
@ -82,6 +82,7 @@ PARALLEL_DIRS += \
|
||||
telephony \
|
||||
wifi \
|
||||
icc \
|
||||
cellbroadcast \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -233,6 +233,11 @@ this.PermissionsTable = { geolocation: {
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
cellbroadcast: {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "Connection.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "MobileConnection.h"
|
||||
#include "mozilla/dom/CellBroadcast.h"
|
||||
#endif
|
||||
#include "nsIIdleObserver.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
@ -127,6 +128,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorNetwork)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorMobileConnection)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorCellBroadcast)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
@ -201,6 +203,10 @@ Navigator::Invalidate()
|
||||
mMobileConnection->Shutdown();
|
||||
mMobileConnection = nullptr;
|
||||
}
|
||||
|
||||
if (mCellBroadcast) {
|
||||
mCellBroadcast = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -1166,6 +1172,31 @@ Navigator::GetMozSms(nsIDOMMozSmsManager** aSmsManager)
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIMozNavigatorCellBroadcast
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetMozCellBroadcast(nsIDOMMozCellBroadcast** aCellBroadcast)
|
||||
{
|
||||
*aCellBroadcast = nullptr;
|
||||
|
||||
if (!mCellBroadcast) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
if (!CheckPermission("cellbroadcast")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewCellBroadcast(window, getter_AddRefs(mCellBroadcast));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aCellBroadcast = mCellBroadcast);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsNavigator::nsIDOMNavigatorTelephony
|
||||
//*****************************************************************************
|
||||
|
@ -20,6 +20,7 @@
|
||||
#endif
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsINavigatorMobileConnection.h"
|
||||
#include "nsINavigatorCellBroadcast.h"
|
||||
#endif
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMNavigatorTime.h"
|
||||
@ -105,6 +106,7 @@ class Navigator : public nsIDOMNavigator
|
||||
, public nsIDOMMozNavigatorNetwork
|
||||
#ifdef MOZ_B2G_RIL
|
||||
, public nsIMozNavigatorMobileConnection
|
||||
, public nsIMozNavigatorCellBroadcast
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
, public nsIDOMNavigatorBluetooth
|
||||
@ -140,6 +142,7 @@ public:
|
||||
NS_DECL_NSIDOMMOZNAVIGATORNETWORK
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DECL_NSIMOZNAVIGATORMOBILECONNECTION
|
||||
NS_DECL_NSIMOZNAVIGATORCELLBROADCAST
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -197,6 +200,7 @@ private:
|
||||
nsRefPtr<network::Connection> mConnection;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
nsRefPtr<network::MobileConnection> mMobileConnection;
|
||||
nsCOMPtr<nsIDOMMozCellBroadcast> mCellBroadcast;
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
nsCOMPtr<nsIDOMBluetoothManager> mBluetooth;
|
||||
|
@ -504,6 +504,7 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "nsIDOMVoicemailEvent.h"
|
||||
#include "nsIDOMIccManager.h"
|
||||
#include "StkCommandEvent.h"
|
||||
#include "nsIDOMMozCellBroadcast.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_FM
|
||||
@ -1505,6 +1506,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_CLASSINFO_DATA(MozMobileConnection, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(MozCellBroadcast, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(USSDReceivedEvent, nsDOMGenericSH,
|
||||
@ -2469,6 +2473,7 @@ nsDOMClassInfo::Init()
|
||||
network::IsAPIEnabled())
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorMobileConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorCellBroadcast)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
@ -4099,6 +4104,11 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozCellBroadcast, nsIDOMMozCellBroadcast)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCellBroadcast)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(USSDReceivedEvent, nsIDOMUSSDReceivedEvent)
|
||||
|
@ -402,6 +402,7 @@ DOMCI_CLASS(MozSmsCursor)
|
||||
DOMCI_CLASS(MozConnection)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOMCI_CLASS(MozMobileConnection)
|
||||
DOMCI_CLASS(MozCellBroadcast)
|
||||
#endif
|
||||
|
||||
DOMCI_CLASS(USSDReceivedEvent)
|
||||
|
16
dom/cellbroadcast/Makefile.in
Normal file
16
dom/cellbroadcast/Makefile.in
Normal file
@ -0,0 +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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
relativesrcdir = @relativesrcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PARALLEL_DIRS = interfaces src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
29
dom/cellbroadcast/interfaces/Makefile.in
Normal file
29
dom/cellbroadcast/interfaces/Makefile.in
Normal file
@ -0,0 +1,29 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
XPIDL_MODULE = dom_cellbroadcast
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIDOMMozCellBroadcast.idl \
|
||||
nsIDOMMozCellBroadcastEvent.idl \
|
||||
nsIDOMMozCellBroadcastMessage.idl \
|
||||
nsINavigatorCellBroadcast.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
XPIDL_FLAGS += \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
-I$(topsrcdir)/dom/interfaces/base \
|
||||
-I$(topsrcdir)/dom/interfaces/events \
|
||||
$(NULL)
|
56
dom/cellbroadcast/src/CellBroadcast.cpp
Normal file
56
dom/cellbroadcast/src/CellBroadcast.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "CellBroadcast.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
|
||||
DOMCI_DATA(MozCellBroadcast, mozilla::dom::CellBroadcast)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(CellBroadcast)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CellBroadcast,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CellBroadcast,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(CellBroadcast)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozCellBroadcast)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozCellBroadcast)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozCellBroadcast)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(CellBroadcast, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(CellBroadcast, nsDOMEventTargetHelper)
|
||||
|
||||
CellBroadcast::CellBroadcast(nsPIDOMWindow *aWindow)
|
||||
{
|
||||
BindToOwner(aWindow);
|
||||
}
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(CellBroadcast, received)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewCellBroadcast(nsPIDOMWindow* aWindow,
|
||||
nsIDOMMozCellBroadcast** aCellBroadcast)
|
||||
{
|
||||
nsPIDOMWindow* innerWindow = aWindow->IsInnerWindow() ?
|
||||
aWindow :
|
||||
aWindow->GetCurrentInnerWindow();
|
||||
|
||||
nsRefPtr<mozilla::dom::CellBroadcast> cb =
|
||||
new mozilla::dom::CellBroadcast(innerWindow);
|
||||
cb.forget(aCellBroadcast);
|
||||
|
||||
return NS_OK;
|
||||
}
|
41
dom/cellbroadcast/src/CellBroadcast.h
Normal file
41
dom/cellbroadcast/src/CellBroadcast.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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_CellBroadcast_h__
|
||||
#define mozilla_dom_CellBroadcast_h__
|
||||
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIDOMMozCellBroadcast.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CellBroadcast MOZ_FINAL : public nsDOMEventTargetHelper
|
||||
, public nsIDOMMozCellBroadcast
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMMOZCELLBROADCAST
|
||||
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CellBroadcast,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
CellBroadcast() MOZ_DELETE;
|
||||
CellBroadcast(nsPIDOMWindow *aWindow);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewCellBroadcast(nsPIDOMWindow* aWindow,
|
||||
nsIDOMMozCellBroadcast** aCellBroadcast);
|
||||
|
||||
#endif // mozilla_dom_CellBroadcast_h__
|
30
dom/cellbroadcast/src/Makefile.in
Normal file
30
dom/cellbroadcast/src/Makefile.in
Normal file
@ -0,0 +1,30 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = dom_cellbroadcast_s
|
||||
XPIDL_MODULE = dom_cellbroadcast
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
FAIL_ON_WARNINGS := 1
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
CellBroadcast.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
CellBroadcast.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -145,6 +145,7 @@ SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/dom/icc/src/$(LIB_PREFIX)dom_icc_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/dom/cellbroadcast/src/$(LIB_PREFIX)dom_cellbroadcast_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
endif #}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user