зеркало из https://github.com/mozilla/pjs.git
Bug 552822 - IPC remoting of geolocation prompt. r=olli/r=jdm
This commit is contained in:
Родитель
ade1133f29
Коммит
b2b1085458
|
@ -109,6 +109,11 @@ ifdef MOZ_JSDEBUGGER
|
||||||
DEFINES += -DMOZ_JSDEBUGGER
|
DEFINES += -DMOZ_JSDEBUGGER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef MOZ_IPC
|
||||||
|
include $(topsrcdir)/config/config.mk
|
||||||
|
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||||
|
endif
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
ifdef MOZ_X11
|
ifdef MOZ_X11
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
#include "base/basictypes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Local Includes
|
// Local Includes
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
#include "nsScreen.h"
|
#include "nsScreen.h"
|
||||||
|
|
|
@ -81,6 +81,7 @@ XPIDLSRCS = \
|
||||||
nsIDOMClientRectList.idl \
|
nsIDOMClientRectList.idl \
|
||||||
nsIFocusManager.idl \
|
nsIFocusManager.idl \
|
||||||
nsIQueryContentEventResult.idl \
|
nsIQueryContentEventResult.idl \
|
||||||
|
nsITabChild.idl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
interface nsIDOMWindow;
|
interface nsIDOMWindow;
|
||||||
|
interface nsIDOMElement;
|
||||||
interface nsIDOMGeoPosition;
|
interface nsIDOMGeoPosition;
|
||||||
interface nsIGeolocationPrompt;
|
interface nsIGeolocationPrompt;
|
||||||
|
|
||||||
|
@ -54,6 +55,8 @@ interface nsIGeolocationRequest : nsISupports {
|
||||||
readonly attribute nsIURI requestingURI;
|
readonly attribute nsIURI requestingURI;
|
||||||
readonly attribute nsIDOMWindow requestingWindow;
|
readonly attribute nsIDOMWindow requestingWindow;
|
||||||
|
|
||||||
|
readonly attribute nsIDOMElement requestingElement;
|
||||||
|
|
||||||
void cancel();
|
void cancel();
|
||||||
void allow();
|
void allow();
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,6 +77,7 @@ include $(topsrcdir)/config/rules.mk
|
||||||
LOCAL_INCLUDES += \
|
LOCAL_INCLUDES += \
|
||||||
-I$(srcdir)/../../content/base/src \
|
-I$(srcdir)/../../content/base/src \
|
||||||
-I$(srcdir)/../../content/events/src \
|
-I$(srcdir)/../../content/events/src \
|
||||||
|
-I$(srcdir)/../src/geolocation \
|
||||||
-I$(topsrcdir)/chrome/src \
|
-I$(topsrcdir)/chrome/src \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,14 @@ include protocol PDocumentRenderer;
|
||||||
include protocol PDocumentRendererShmem;
|
include protocol PDocumentRendererShmem;
|
||||||
include protocol PObjectWrapper;
|
include protocol PObjectWrapper;
|
||||||
include protocol PContextWrapper;
|
include protocol PContextWrapper;
|
||||||
|
include protocol PGeolocationRequest;
|
||||||
|
|
||||||
include "mozilla/TabTypes.h";
|
include "mozilla/TabTypes.h";
|
||||||
include "TabMessageUtils.h";
|
include "TabMessageUtils.h";
|
||||||
include "gfxMatrix.h";
|
include "gfxMatrix.h";
|
||||||
|
include "mozilla/net/NeckoMessageUtils.h";
|
||||||
|
|
||||||
|
using IPC::URI;
|
||||||
using MagicWindowHandle;
|
using MagicWindowHandle;
|
||||||
using RemoteDOMEvent;
|
using RemoteDOMEvent;
|
||||||
using gfxMatrix;
|
using gfxMatrix;
|
||||||
|
@ -60,6 +63,7 @@ rpc protocol PIFrameEmbedding
|
||||||
manages PDocumentRenderer;
|
manages PDocumentRenderer;
|
||||||
manages PDocumentRendererShmem;
|
manages PDocumentRendererShmem;
|
||||||
manages PContextWrapper;
|
manages PContextWrapper;
|
||||||
|
manages PGeolocationRequest;
|
||||||
|
|
||||||
child:
|
child:
|
||||||
__delete__();
|
__delete__();
|
||||||
|
@ -99,6 +103,9 @@ parent:
|
||||||
returns (nsString[] retval);
|
returns (nsString[] retval);
|
||||||
|
|
||||||
sendAsyncMessageToParent(nsString aMessage, nsString aJSON);
|
sendAsyncMessageToParent(nsString aMessage, nsString aJSON);
|
||||||
|
|
||||||
|
PGeolocationRequest(URI uri);
|
||||||
|
|
||||||
child:
|
child:
|
||||||
createWidget(MagicWindowHandle parentWidget);
|
createWidget(MagicWindowHandle parentWidget);
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,12 @@ TabChild::Init()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS10(TabChild, nsIWebBrowserChrome, nsIWebBrowserChrome2,
|
NS_IMPL_ISUPPORTS11(TabChild, nsIWebBrowserChrome, nsIWebBrowserChrome2,
|
||||||
nsIEmbeddingSiteWindow, nsIEmbeddingSiteWindow2,
|
nsIEmbeddingSiteWindow, nsIEmbeddingSiteWindow2,
|
||||||
nsIWebBrowserChromeFocus, nsIInterfaceRequestor,
|
nsIWebBrowserChromeFocus, nsIInterfaceRequestor,
|
||||||
nsIWindowProvider, nsIWebProgressListener,
|
nsIWindowProvider, nsIWebProgressListener,
|
||||||
nsIWebProgressListener2, nsSupportsWeakReference)
|
nsIWebProgressListener2, nsSupportsWeakReference,
|
||||||
|
nsITabChild)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TabChild::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
|
TabChild::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
|
||||||
|
@ -670,6 +671,22 @@ TabChild::RecvPDocumentRendererShmemConstructor(
|
||||||
aBuf);
|
aBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The PGeolocationRequestChild actor is implemented by a refcounted
|
||||||
|
nsGeolocationRequest, and has an identical lifetime. */
|
||||||
|
|
||||||
|
PGeolocationRequestChild*
|
||||||
|
TabChild::AllocPGeolocationRequest(const IPC::URI&)
|
||||||
|
{
|
||||||
|
NS_RUNTIMEABORT("unused");
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TabChild::DeallocPGeolocationRequest(PGeolocationRequestChild* actor)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvactivateFrameEvent(const nsString& aType, const bool& capture)
|
TabChild::RecvactivateFrameEvent(const nsString& aType, const bool& capture)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIScriptContext.h"
|
#include "nsIScriptContext.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
|
#include "nsITabChild.h"
|
||||||
|
|
||||||
class gfxMatrix;
|
class gfxMatrix;
|
||||||
|
|
||||||
|
@ -148,7 +149,8 @@ class TabChild : public PIFrameEmbeddingChild,
|
||||||
public nsIWebBrowserChromeFocus,
|
public nsIWebBrowserChromeFocus,
|
||||||
public nsIInterfaceRequestor,
|
public nsIInterfaceRequestor,
|
||||||
public nsIWindowProvider,
|
public nsIWindowProvider,
|
||||||
public nsSupportsWeakReference
|
public nsSupportsWeakReference,
|
||||||
|
public nsITabChild
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TabChild();
|
TabChild();
|
||||||
|
@ -236,6 +238,9 @@ public:
|
||||||
const PRInt32& aBufH,
|
const PRInt32& aBufH,
|
||||||
Shmem& aBuf);
|
Shmem& aBuf);
|
||||||
|
|
||||||
|
virtual PGeolocationRequestChild* AllocPGeolocationRequest(const IPC::URI& uri);
|
||||||
|
virtual bool DeallocPGeolocationRequest(PGeolocationRequestChild* actor);
|
||||||
|
|
||||||
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
||||||
|
|
||||||
JSContext* GetJSContext() { return mCx; }
|
JSContext* GetJSContext() { return mCx; }
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "jsarray.h"
|
#include "jsarray.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
#include "nsGeolocationOOP.h"
|
||||||
|
#include "nsIDOMNSHTMLFrameElement.h"
|
||||||
|
|
||||||
using mozilla::ipc::DocumentRendererParent;
|
using mozilla::ipc::DocumentRendererParent;
|
||||||
using mozilla::ipc::DocumentRendererShmemParent;
|
using mozilla::ipc::DocumentRendererShmemParent;
|
||||||
|
@ -449,6 +451,19 @@ TabParent::DeallocPContextWrapper(PContextWrapperParent* actor)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PGeolocationRequestParent*
|
||||||
|
TabParent::AllocPGeolocationRequest(const URI::URI& uri)
|
||||||
|
{
|
||||||
|
return new GeolocationRequestParent(mFrameElement, uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TabParent::DeallocPGeolocationRequest(PGeolocationRequestParent* actor)
|
||||||
|
{
|
||||||
|
delete actor;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
TabParent::GetGlobalJSObject(JSContext* cx, JSObject** globalp)
|
TabParent::GetGlobalJSObject(JSContext* cx, JSObject** globalp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,6 +160,9 @@ public:
|
||||||
virtual PContextWrapperParent* AllocPContextWrapper();
|
virtual PContextWrapperParent* AllocPContextWrapper();
|
||||||
virtual bool DeallocPContextWrapper(PContextWrapperParent* actor);
|
virtual bool DeallocPContextWrapper(PContextWrapperParent* actor);
|
||||||
|
|
||||||
|
virtual PGeolocationRequestParent* AllocPGeolocationRequest(const IPC::URI& uri);
|
||||||
|
virtual bool DeallocPGeolocationRequest(PGeolocationRequestParent* actor);
|
||||||
|
|
||||||
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
|
@ -59,6 +59,9 @@ EXTRA_DSO_LDOPTS = \
|
||||||
|
|
||||||
LOCAL_INCLUDES = \
|
LOCAL_INCLUDES = \
|
||||||
-I$(topsrcdir)/dom/base \
|
-I$(topsrcdir)/dom/base \
|
||||||
|
-I$(topsrcdir)/dom/ipc \
|
||||||
|
-I$(topsrcdir)/content/base/src \
|
||||||
|
-I$(topsrcdir)/content/events/src \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifdef WINCE_WINDOWS_MOBILE
|
ifdef WINCE_WINDOWS_MOBILE
|
||||||
|
@ -76,6 +79,8 @@ EXTRA_COMPONENTS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
||||||
|
include $(topsrcdir)/config/config.mk
|
||||||
|
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
DEFINES += -D_IMPL_NS_LAYOUT
|
DEFINES += -D_IMPL_NS_LAYOUT
|
||||||
|
|
|
@ -34,6 +34,27 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
#include "nsGeolocationOOP.h"
|
||||||
|
#include "nsXULAppAPI.h"
|
||||||
|
|
||||||
|
#include "mozilla/dom/PIFrameEmbeddingChild.h"
|
||||||
|
#include "mozilla/dom/PIFrameEmbeddingParent.h"
|
||||||
|
#include "mozilla/dom/ContentProcessChild.h"
|
||||||
|
#include "nsNetUtil.h"
|
||||||
|
|
||||||
|
#include "nsFrameManager.h"
|
||||||
|
#include "nsFrameLoader.h"
|
||||||
|
#include "nsIFrameLoader.h"
|
||||||
|
|
||||||
|
#include "nsIDocShellTreeOwner.h"
|
||||||
|
#include "nsIDocShellTreeItem.h"
|
||||||
|
#include "nsIWebProgressListener2.h"
|
||||||
|
|
||||||
|
#include "nsDOMEventTargetHelper.h"
|
||||||
|
#include "TabChild.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nsGeolocation.h"
|
#include "nsGeolocation.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -230,6 +251,14 @@ nsGeolocationRequest::GetRequestingWindow(nsIDOMWindow * *aRequestingWindow)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequest::GetRequestingElement(nsIDOMElement * *aRequestingElement)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aRequestingElement);
|
||||||
|
*aRequestingElement = nsnull;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGeolocationRequest::Cancel()
|
nsGeolocationRequest::Cancel()
|
||||||
{
|
{
|
||||||
|
@ -340,6 +369,16 @@ nsGeolocationRequest::Shutdown()
|
||||||
mErrorCallback = nsnull;
|
mErrorCallback = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
bool nsGeolocationRequest::Recv__delete__(const bool& allow)
|
||||||
|
{
|
||||||
|
if (allow)
|
||||||
|
(void) Allow();
|
||||||
|
else
|
||||||
|
(void) Cancel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// nsGeolocationService
|
// nsGeolocationService
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
@ -856,12 +895,7 @@ nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
||||||
|
|
||||||
if (mOwner) {
|
if (mOwner) {
|
||||||
nsCOMPtr<nsIGeolocationPrompt> prompt = do_GetService(NS_GEOLOCATION_PROMPT_CONTRACTID);
|
RegisterRequestWithPrompt(request);
|
||||||
if (prompt == nsnull)
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
prompt->Prompt(request);
|
|
||||||
|
|
||||||
mPendingCallbacks.AppendElement(request);
|
mPendingCallbacks.AppendElement(request);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -900,11 +934,7 @@ nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
||||||
|
|
||||||
if (mOwner) {
|
if (mOwner) {
|
||||||
nsCOMPtr<nsIGeolocationPrompt> prompt = do_GetService(NS_GEOLOCATION_PROMPT_CONTRACTID);
|
RegisterRequestWithPrompt(request);
|
||||||
if (prompt == nsnull)
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
prompt->Prompt(request);
|
|
||||||
|
|
||||||
// need to hand back an index/reference.
|
// need to hand back an index/reference.
|
||||||
mWatchingCallbacks.AppendElement(request);
|
mWatchingCallbacks.AppendElement(request);
|
||||||
|
@ -962,7 +992,150 @@ nsGeolocation::WindowOwnerStillExists()
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
|
||||||
|
{
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||||
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mOwner);
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nsIDocShell *docshell = window->GetDocShell();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(docshell);
|
||||||
|
NS_ASSERTION(item, "doc shell tree item is null");
|
||||||
|
if (!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
||||||
|
item->GetTreeOwner(getter_AddRefs(owner));
|
||||||
|
NS_ASSERTION(owner, "doc shell tree owner is null");
|
||||||
|
|
||||||
|
nsCOMPtr<nsITabChild> tabchild = do_GetInterface(owner);
|
||||||
|
if (!tabchild)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// because owner implements nsITabChild, we can assume that it is
|
||||||
|
// the one and only TabChild.
|
||||||
|
mozilla::dom::TabChild* child = static_cast<mozilla::dom::TabChild*>(tabchild.get());
|
||||||
|
|
||||||
|
mozilla::dom::PGeolocationRequestChild* a =
|
||||||
|
child->SendPGeolocationRequestConstructor(request, IPC::URI(mURI));
|
||||||
|
|
||||||
|
(void) a->Sendprompt();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nsCOMPtr<nsIGeolocationPrompt> prompt = do_GetService(NS_GEOLOCATION_PROMPT_CONTRACTID);
|
||||||
|
NS_ASSERTION(prompt, "null geolocation prompt. geolocation will not work without one.");
|
||||||
|
if (prompt)
|
||||||
|
prompt->Prompt(request);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef WINCE_WINDOWS_MOBILE
|
#ifndef WINCE_WINDOWS_MOBILE
|
||||||
DOMCI_DATA(GeoPositionCoords, void)
|
DOMCI_DATA(GeoPositionCoords, void)
|
||||||
DOMCI_DATA(GeoPosition, void)
|
DOMCI_DATA(GeoPosition, void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
nsGeolocationRequestProxy::nsGeolocationRequestProxy()
|
||||||
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsGeolocationRequestProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsGeolocationRequestProxy::~nsGeolocationRequestProxy()
|
||||||
|
{
|
||||||
|
MOZ_COUNT_DTOR(nsGeolocationRequestProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsGeolocationRequestProxy::Init(mozilla::dom::GeolocationRequestParent* parent)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(parent, "null parent");
|
||||||
|
mParent = parent;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIGeolocationPrompt> prompt = do_GetService(NS_GEOLOCATION_PROMPT_CONTRACTID);
|
||||||
|
NS_ASSERTION(prompt, "null geolocation prompt. geolocation will not work without one.");
|
||||||
|
if (!prompt)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
(void) prompt->Prompt(this);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS1(nsGeolocationRequestProxy, nsIGeolocationRequest);
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequestProxy::GetRequestingWindow(nsIDOMWindow * *aRequestingWindow)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aRequestingWindow);
|
||||||
|
*aRequestingWindow = nsnull;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequestProxy::GetRequestingURI(nsIURI * *aRequestingURI)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aRequestingURI);
|
||||||
|
NS_ASSERTION(mParent, "No parent for request");
|
||||||
|
|
||||||
|
NS_ADDREF(*aRequestingURI = mParent->mURI);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequestProxy::GetRequestingElement(nsIDOMElement * *aRequestingElement)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aRequestingElement);
|
||||||
|
NS_ASSERTION(mParent && mParent->mElement.get(), "No parent for request");
|
||||||
|
NS_ADDREF(*aRequestingElement = mParent->mElement);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequestProxy::Cancel()
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mParent, "No parent for request");
|
||||||
|
(void) mozilla::dom::GeolocationRequestParent::Send__delete__(mParent, false);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequestProxy::Allow()
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mParent, "No parent for request");
|
||||||
|
(void) mozilla::dom::GeolocationRequestParent::Send__delete__(mParent, true);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
GeolocationRequestParent::GeolocationRequestParent(nsIDOMElement *element, const IPC::URI& uri)
|
||||||
|
{
|
||||||
|
MOZ_COUNT_CTOR(GeolocationRequestParent);
|
||||||
|
|
||||||
|
mURI = uri;
|
||||||
|
mElement = element;
|
||||||
|
mProxy = nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeolocationRequestParent::~GeolocationRequestParent()
|
||||||
|
{
|
||||||
|
MOZ_COUNT_DTOR(GeolocationRequestParent);
|
||||||
|
delete mProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GeolocationRequestParent::Recvprompt()
|
||||||
|
{
|
||||||
|
mProxy = new nsGeolocationRequestProxy();
|
||||||
|
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
||||||
|
if (NS_FAILED(mProxy->Init(this)))
|
||||||
|
mProxy->Cancel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
#include "mozilla/dom/PGeolocationRequestChild.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
@ -61,7 +64,12 @@
|
||||||
class nsGeolocationService;
|
class nsGeolocationService;
|
||||||
class nsGeolocation;
|
class nsGeolocation;
|
||||||
|
|
||||||
class nsGeolocationRequest : public nsIGeolocationRequest, public nsITimerCallback
|
class nsGeolocationRequest
|
||||||
|
: public nsIGeolocationRequest
|
||||||
|
, public nsITimerCallback
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
, public mozilla::dom::PGeolocationRequestChild
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
|
@ -83,6 +91,10 @@ class nsGeolocationRequest : public nsIGeolocationRequest, public nsITimerCallba
|
||||||
|
|
||||||
~nsGeolocationRequest();
|
~nsGeolocationRequest();
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
bool Recv__delete__(const bool& allow);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void NotifyError(PRInt16 errorCode);
|
void NotifyError(PRInt16 errorCode);
|
||||||
|
@ -204,6 +216,8 @@ private:
|
||||||
|
|
||||||
~nsGeolocation();
|
~nsGeolocation();
|
||||||
|
|
||||||
|
void RegisterRequestWithPrompt(nsGeolocationRequest* request);
|
||||||
|
|
||||||
// Two callback arrays. The first |mPendingCallbacks| holds objects for only
|
// Two callback arrays. The first |mPendingCallbacks| holds objects for only
|
||||||
// one callback and then they are released/removed from the array. The second
|
// one callback and then they are released/removed from the array. The second
|
||||||
// |mWatchingCallbacks| holds objects until the object is explictly removed or
|
// |mWatchingCallbacks| holds objects until the object is explictly removed or
|
||||||
|
@ -223,3 +237,4 @@ private:
|
||||||
// owning back pointer.
|
// owning back pointer.
|
||||||
nsRefPtr<nsGeolocationService> mService;
|
nsRefPtr<nsGeolocationService> mService;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ EXPORT_LIBRARY = 1
|
||||||
## When you add IPDL files to a source directory, list the directory here.
|
## When you add IPDL files to a source directory, list the directory here.
|
||||||
##
|
##
|
||||||
IPDLDIRS = \
|
IPDLDIRS = \
|
||||||
|
dom/src/geolocation \
|
||||||
dom/plugins \
|
dom/plugins \
|
||||||
dom/ipc \
|
dom/ipc \
|
||||||
netwerk/ipc \
|
netwerk/ipc \
|
||||||
|
|
|
@ -237,6 +237,11 @@ OS_LIBS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -fr
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef MOZ_IPC
|
||||||
|
include $(topsrcdir)/config/config.mk
|
||||||
|
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||||
|
endif
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
LOCAL_INCLUDES += -I$(srcdir)/../base \
|
LOCAL_INCLUDES += -I$(srcdir)/../base \
|
||||||
|
|
|
@ -36,6 +36,10 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
#include "base/basictypes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "xpcmodule.h"
|
#include "xpcmodule.h"
|
||||||
#include "nsLayoutStatics.h"
|
#include "nsLayoutStatics.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче