mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 594261 - IPC part - Factor out geolocation prompt into something that can be reused. r=chris jones, a=stuart
--HG-- rename : dom/src/geolocation/PGeolocationRequest.ipdl => dom/ipc/PContentPermissionRequest.ipdl extra : rebase_source : 73f75b6f4c4deae71337dd2a9925d15aefcaacb8
This commit is contained in:
parent
4511728eeb
commit
4c4c8dfdd9
@ -47,7 +47,7 @@ LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
EXPORTS = TabMessageUtils.h
|
||||
EXPORTS = TabMessageUtils.h PCOMContentPermissionRequestChild.h
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla mozilla/dom
|
||||
|
||||
@ -80,10 +80,10 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../content/base/src \
|
||||
-I$(srcdir)/../../content/events/src \
|
||||
-I$(srcdir)/../../toolkit/components/places/src \
|
||||
-I$(srcdir)/../src/geolocation \
|
||||
-I$(topsrcdir)/chrome/src \
|
||||
-I$(topsrcdir)/uriloader/exthandler \
|
||||
-I$(srcdir)/../../netwerk/base/src \
|
||||
-I$(srcdir)/../src/geolocation \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
@ -42,7 +42,7 @@ include protocol PContentDialog;
|
||||
include protocol PDocumentRenderer;
|
||||
include protocol PDocumentRendererShmem;
|
||||
include protocol PDocumentRendererNativeID;
|
||||
include protocol PGeolocationRequest;
|
||||
include protocol PContentPermissionRequest;
|
||||
include protocol PExternalHelperApp;
|
||||
|
||||
include "mozilla/TabTypes.h";
|
||||
@ -71,7 +71,7 @@ rpc protocol PBrowser
|
||||
manages PDocumentRenderer;
|
||||
manages PDocumentRendererShmem;
|
||||
manages PDocumentRendererNativeID;
|
||||
manages PGeolocationRequest;
|
||||
manages PContentPermissionRequest;
|
||||
manages PExternalHelperApp;
|
||||
|
||||
both:
|
||||
@ -114,7 +114,7 @@ parent:
|
||||
|
||||
QueryContentResult(nsQueryContentEvent event);
|
||||
|
||||
PGeolocationRequest(URI uri);
|
||||
PContentPermissionRequest(nsCString aType, URI uri);
|
||||
|
||||
PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
|
||||
PRInt32[] aIntParams, nsString[] aStringParams);
|
||||
|
54
dom/ipc/PCOMContentPermissionRequestChild.h
Normal file
54
dom/ipc/PCOMContentPermissionRequestChild.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/dom/PContentPermissionRequestChild.h"
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
|
||||
/*
|
||||
PContentPermissionRequestChild implementations also are
|
||||
XPCOM objects. Addref() is called on their implementation
|
||||
before SendPCOntentPermissionRequestConstructor is called.
|
||||
When Dealloc is called, IPDLRelease() is called.
|
||||
Implementations of this method are expected to call
|
||||
Release() on themselves. See Bug 594261 for more
|
||||
information.
|
||||
*/
|
||||
class PCOMContentPermissionRequestChild : public mozilla::dom::PContentPermissionRequestChild {
|
||||
public:
|
||||
virtual void IPDLRelease() = 0;
|
||||
};
|
@ -43,7 +43,7 @@ using IPC::URI;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
protocol PGeolocationRequest
|
||||
protocol PContentPermissionRequest
|
||||
{
|
||||
manager PBrowser;
|
||||
|
@ -87,7 +87,7 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsGeolocation.h"
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QGraphicsView>
|
||||
@ -968,21 +968,18 @@ TabChild::DeallocPContentDialog(PContentDialogChild* aDialog)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The PGeolocationRequestChild actor is implemented by a refcounted
|
||||
nsGeolocationRequest, and has an identical lifetime. */
|
||||
|
||||
PGeolocationRequestChild*
|
||||
TabChild::AllocPGeolocationRequest(const IPC::URI&)
|
||||
PContentPermissionRequestChild*
|
||||
TabChild::AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI&)
|
||||
{
|
||||
NS_RUNTIMEABORT("unused");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::DeallocPGeolocationRequest(PGeolocationRequestChild* actor)
|
||||
TabChild::DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor)
|
||||
{
|
||||
static_cast<nsGeolocationRequest*>(actor)->Release();
|
||||
return true;
|
||||
static_cast<PCOMContentPermissionRequestChild*>(actor)->IPDLRelease();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -283,8 +283,8 @@ public:
|
||||
const gfxMatrix& aMatrix,
|
||||
const PRUint32& aNativeID);
|
||||
|
||||
virtual PGeolocationRequestChild* AllocPGeolocationRequest(const IPC::URI& uri);
|
||||
virtual bool DeallocPGeolocationRequest(PGeolocationRequestChild* actor);
|
||||
virtual PContentPermissionRequestChild* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
|
||||
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor);
|
||||
|
||||
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
||||
|
||||
|
@ -524,14 +524,18 @@ TabParent::DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDParent* act
|
||||
return true;
|
||||
}
|
||||
|
||||
PGeolocationRequestParent*
|
||||
TabParent::AllocPGeolocationRequest(const IPC::URI& uri)
|
||||
PContentPermissionRequestParent*
|
||||
TabParent::AllocPContentPermissionRequest(const nsCString& type, const IPC::URI& uri)
|
||||
{
|
||||
return new GeolocationRequestParent(mFrameElement, uri);
|
||||
if (type.Equals(NS_LITERAL_CSTRING("geolocation"))) {
|
||||
return new GeolocationRequestParent(mFrameElement, uri);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::DeallocPGeolocationRequest(PGeolocationRequestParent* actor)
|
||||
TabParent::DeallocPContentPermissionRequest(PContentPermissionRequestParent* actor)
|
||||
{
|
||||
delete actor;
|
||||
return true;
|
||||
|
@ -199,8 +199,8 @@ public:
|
||||
virtual bool DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDParent* actor);
|
||||
|
||||
|
||||
virtual PGeolocationRequestParent* AllocPGeolocationRequest(const IPC::URI& uri);
|
||||
virtual bool DeallocPGeolocationRequest(PGeolocationRequestParent* actor);
|
||||
virtual PContentPermissionRequestParent* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
|
||||
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestParent* actor);
|
||||
|
||||
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
||||
|
||||
|
@ -41,4 +41,5 @@ IPDLSRCS = \
|
||||
PDocumentRenderer.ipdl \
|
||||
PDocumentRendererNativeID.ipdl \
|
||||
PDocumentRendererShmem.ipdl \
|
||||
PContentPermissionRequest.ipdl \
|
||||
$(NULL)
|
||||
|
@ -1,40 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Geolocation code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# the Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2010
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Josh Matthews <josh@joshmatthews.net> (Initial Developer)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
IPDLSRCS = \
|
||||
PGeolocationRequest.ipdl \
|
||||
$(NULL)
|
@ -1115,13 +1115,14 @@ nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
|
||||
// the one and only TabChild.
|
||||
TabChild* child = GetTabChildFrom(window->GetDocShell());
|
||||
|
||||
child->SendPGeolocationRequestConstructor(request, IPC::URI(mURI));
|
||||
|
||||
// Retain a reference so the object isn't deleted without IPDL's knowledge.
|
||||
// Corresponding release occurs in DeallocPGeolocationRequest.
|
||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||
request->AddRef();
|
||||
|
||||
unused << request->Sendprompt();
|
||||
nsCString type = NS_LITERAL_CSTRING("geolocation");
|
||||
child->SendPContentPermissionRequestConstructor(request, type, IPC::URI(mURI));
|
||||
|
||||
request->Sendprompt();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define nsGeoLocation_h
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "mozilla/dom/PGeolocationRequestChild.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestChild.h"
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
@ -67,6 +67,10 @@
|
||||
#include "nsIGeolocationProvider.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
#endif
|
||||
|
||||
class nsGeolocationService;
|
||||
class nsGeolocation;
|
||||
|
||||
@ -74,7 +78,7 @@ class nsGeolocationRequest
|
||||
: public nsIContentPermissionRequest
|
||||
, public nsITimerCallback
|
||||
#ifdef MOZ_IPC
|
||||
, public mozilla::dom::PGeolocationRequestChild
|
||||
, public PCOMContentPermissionRequestChild
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
@ -100,6 +104,7 @@ class nsGeolocationRequest
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool Recv__delete__(const bool& allow);
|
||||
void IPDLRelease() { Release(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -45,14 +45,14 @@
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
#include "mozilla/dom/PGeolocationRequestParent.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
|
||||
class nsGeolocationRequestProxy;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class GeolocationRequestParent : public PGeolocationRequestParent
|
||||
class GeolocationRequestParent : public PContentPermissionRequestParent
|
||||
{
|
||||
public:
|
||||
GeolocationRequestParent(nsIDOMElement *element, const IPC::URI& principal);
|
||||
|
@ -55,7 +55,6 @@ EXPORT_LIBRARY = 1
|
||||
##
|
||||
IPDLDIRS = \
|
||||
uriloader/exthandler \
|
||||
dom/src/geolocation \
|
||||
dom/plugins \
|
||||
dom/ipc \
|
||||
gfx/layers/ipc \
|
||||
|
Loading…
Reference in New Issue
Block a user