summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-06-17 18:06:12 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-07-01 11:50:02 +0200
commit3973b5b2a3fb29c0b38044e52f3166684fb3d5fc (patch)
tree5b9e5957984cc096ae26cf775224785b3b5a6600 /src
parente3c6a9c704959a8e291026b8edb6d24c8cf38643 (diff)
Permission Management for Chromium 44
Implementing the new PermissionManager API. Change-Id: If0fdac24b8fec561a898aba009345576b5ce7fc6 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp6
-rw-r--r--src/core/browser_context_adapter.h9
-rw-r--r--src/core/browser_context_qt.cpp8
-rw-r--r--src/core/browser_context_qt.h6
-rw-r--r--src/core/content_browser_client_qt.cpp35
-rw-r--r--src/core/content_browser_client_qt.h13
-rw-r--r--src/core/core_gyp_generator.pro2
-rw-r--r--src/core/permission_manager_qt.cpp207
-rw-r--r--src/core/permission_manager_qt.h119
-rw-r--r--src/core/web_contents_adapter.cpp2
-rw-r--r--src/core/web_contents_delegate_qt.cpp23
-rw-r--r--src/core/web_contents_delegate_qt.h7
12 files changed, 361 insertions, 76 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index a01f7a4b8..4c5e7fdc1 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -40,6 +40,7 @@
#include "browser_context_qt.h"
#include "content_client_qt.h"
#include "download_manager_delegate_qt.h"
+#include "permission_manager_qt.h"
#include "web_engine_context.h"
#include "web_engine_visited_links_manager.h"
#include "url_request_context_getter_qt.h"
@@ -352,4 +353,9 @@ UserScriptControllerHost *BrowserContextAdapter::userScriptController()
return m_userScriptController.data();
}
+void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply)
+{
+ static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->permissionRequestReply(origin, type, reply);
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 1a973c026..717450184 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -119,6 +119,13 @@ public:
TrackVisitedLinksOnDisk,
};
+ enum PermissionType {
+ UnsupportedPermission = 0,
+ GeolocationPermission = 1,
+// Reserved:
+// NotificationPermission = 2,
+ };
+
HttpCacheType httpCacheType() const;
void setHttpCacheType(BrowserContextAdapter::HttpCacheType);
@@ -138,6 +145,8 @@ public:
void updateCustomUrlSchemeHandlers();
UserScriptControllerHost *userScriptController();
+ void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
+
private:
QString m_name;
bool m_offTheRecord;
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index aa444ab7e..d947f8486 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -38,6 +38,7 @@
#include "browser_context_adapter.h"
#include "download_manager_delegate_qt.h"
+#include "permission_manager_qt.h"
#include "qtwebenginecoreglobal_p.h"
#include "resource_context_qt.h"
#include "type_conversion.h"
@@ -134,6 +135,13 @@ content::SSLHostStateDelegate* BrowserContextQt::GetSSLHostStateDelegate()
return 0;
}
+content::PermissionManager *BrowserContextQt::GetPermissionManager()
+{
+ if (!permissionManager)
+ permissionManager.reset(new PermissionManagerQt(m_adapter));
+ return permissionManager.get();
+}
+
net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers)
{
url_request_getter_ = new URLRequestContextGetterQt(m_adapter, protocol_handlers);
diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h
index af36b55ab..ba1b94dc2 100644
--- a/src/core/browser_context_qt.h
+++ b/src/core/browser_context_qt.h
@@ -47,6 +47,7 @@
namespace QtWebEngineCore {
class BrowserContextAdapter;
+class PermissionManagerQt;
class URLRequestContextGetterQt;
class BrowserContextQt : public content::BrowserContext
@@ -72,13 +73,16 @@ public:
virtual content::PushMessagingService* GetPushMessagingService() Q_DECL_OVERRIDE;
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() Q_DECL_OVERRIDE;
net::URLRequestContextGetter *CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers);
+ virtual content::PermissionManager *GetPermissionManager() Q_DECL_OVERRIDE;
+
+ BrowserContextAdapter *adapter() { return m_adapter; }
- BrowserContextAdapter* adapter() { return m_adapter; }
private:
friend class ContentBrowserClientQt;
friend class WebContentsAdapter;
scoped_ptr<content::ResourceContext> resourceContext;
scoped_refptr<URLRequestContextGetterQt> url_request_getter_;
+ scoped_ptr<PermissionManagerQt> permissionManager;
BrowserContextAdapter *m_adapter;
friend class BrowserContextAdapter;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 3aa1c1800..f38451901 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -408,41 +408,6 @@ void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int re
contentsDelegate->allowCertificateError(errorController);
}
-void ContentBrowserClientQt::RequestPermission(content::PermissionType permission,
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- const base::Callback<void(bool)>& result_callback)
-{
- Q_UNUSED(bridge_id);
- Q_UNUSED(user_gesture);
- WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate());
- Q_ASSERT(contentsDelegate);
- if (permission == content::PERMISSION_GEOLOCATION)
- contentsDelegate->requestGeolocationPermission(requesting_frame, result_callback);
- else
- result_callback.Run(false);
-}
-
-
-void ContentBrowserClientQt::CancelPermissionRequest(content::PermissionType permission,
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame)
-{
- Q_UNUSED(bridge_id);
- WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate());
- Q_ASSERT(contentsDelegate);
- if (permission == content::PERMISSION_GEOLOCATION)
- contentsDelegate->cancelGeolocationPermissionRequest(requesting_frame);
-}
-
-blink::WebNotificationPermission ContentBrowserClientQt::CheckDesktopNotificationPermission(const GURL&, content::ResourceContext *, int )
-{
- return blink::WebNotificationPermission::WebNotificationPermissionDenied;
-}
-
content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvider()
{
#ifdef QT_USE_POSITIONING
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 91d00a11a..f6add6805 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -101,23 +101,10 @@ public:
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) Q_DECL_OVERRIDE;
- virtual void RequestPermission(
- content::PermissionType permission,
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- const base::Callback<void(bool)>& result_callback) Q_DECL_OVERRIDE;
- virtual void CancelPermissionRequest(content::PermissionType permission,
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) Q_DECL_OVERRIDE;
content::LocationProvider* OverrideSystemLocationProvider() Q_DECL_OVERRIDE;
content::DevToolsManagerDelegate *GetDevToolsManagerDelegate() Q_DECL_OVERRIDE;
virtual net::URLRequestContextGetter *CreateRequestContext(content::BrowserContext *browser_context, content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptorss) Q_DECL_OVERRIDE;
- virtual blink::WebNotificationPermission CheckDesktopNotificationPermission(const GURL& source_origin, content::ResourceContext* context, int render_process_id) Q_DECL_OVERRIDE;
-
virtual std::string GetApplicationLocale() Q_DECL_OVERRIDE;
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) Q_DECL_OVERRIDE;
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index 4ab1b7b98..40a82a52e 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -58,6 +58,7 @@ SOURCES = \
native_web_keyboard_event_qt.cpp \
network_delegate_qt.cpp \
ozone_platform_eglfs.cpp \
+ permission_manager_qt.cpp \
process_main.cpp \
proxy_config_service_qt.cpp \
proxy_resolver_qt.cpp \
@@ -129,6 +130,7 @@ HEADERS = \
media_capture_devices_dispatcher.h \
network_delegate_qt.h \
ozone_platform_eglfs.h \
+ permission_manager_qt.h \
process_main.h \
proxy_config_service_qt.h \
proxy_resolver_qt.h \
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp
new file mode 100644
index 000000000..865874fe6
--- /dev/null
+++ b/src/core/permission_manager_qt.cpp
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "permission_manager_qt.h"
+
+#include "content/public/browser/permission_type.h"
+#include "content/public/browser/web_contents.h"
+
+#include "type_conversion.h"
+#include "web_contents_delegate_qt.h"
+
+namespace QtWebEngineCore {
+
+BrowserContextAdapter::PermissionType toQt(content::PermissionType type)
+{
+ switch (type) {
+ case content::PermissionType::GEOLOCATION:
+ return BrowserContextAdapter::GeolocationPermission;
+ case content::PermissionType::NOTIFICATIONS:
+ case content::PermissionType::MIDI_SYSEX:
+ case content::PermissionType::PUSH_MESSAGING:
+ case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
+ case content::PermissionType::NUM:
+ break;
+ }
+ return BrowserContextAdapter::UnsupportedPermission;
+}
+
+PermissionManagerQt::PermissionManagerQt(BrowserContextAdapter *contextAdapter)
+ : m_contextAdapter(contextAdapter)
+ , m_subscriberCount(0)
+{
+}
+
+PermissionManagerQt::~PermissionManagerQt()
+{
+}
+
+void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserContextAdapter::PermissionType type, bool reply)
+{
+ QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, type);
+ m_permissions[key] = reply;
+ content::PermissionStatus status = reply ? content::PERMISSION_STATUS_GRANTED : content::PERMISSION_STATUS_DENIED;
+ auto it = m_requests.begin();
+ const auto end = m_requests.end();
+ while (it != end) {
+ if (it->origin == origin && it->type == type) {
+ it->callback.Run(status);
+ it = m_requests.erase(it);
+ } else
+ ++it;
+ }
+ Q_FOREACH (const Subscriber &subscriber, m_subscribers) {
+ if (subscriber.origin == origin && subscriber.type == type)
+ subscriber.callback.Run(status);
+ }
+}
+
+void PermissionManagerQt::RequestPermission(content::PermissionType permission,
+ content::WebContents* web_contents,
+ int request_id,
+ const GURL& requesting_origin,
+ bool user_gesture,
+ const base::Callback<void(content::PermissionStatus)>& callback)
+{
+ Q_UNUSED(user_gesture);
+ BrowserContextAdapter::PermissionType permissionType = toQt(permission);
+ if (permissionType == BrowserContextAdapter::UnsupportedPermission) {
+ callback.Run(content::PERMISSION_STATUS_DENIED);
+ return;
+ }
+
+ WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate());
+ Q_ASSERT(contentsDelegate);
+ Request request = {
+ request_id,
+ permissionType,
+ toQt(requesting_origin),
+ callback
+ };
+ m_requests.append(request);
+ if (permissionType == BrowserContextAdapter::GeolocationPermission)
+ contentsDelegate->requestGeolocationPermission(request.origin);
+}
+
+void PermissionManagerQt::CancelPermissionRequest(content::PermissionType permission,
+ content::WebContents* web_contents,
+ int request_id,
+ const GURL& requesting_origin)
+{
+ Q_UNUSED(web_contents);
+ const BrowserContextAdapter::PermissionType permissionType = toQt(permission);
+ if (permissionType == BrowserContextAdapter::UnsupportedPermission)
+ return;
+
+ // Should we add API to cancel permissions in the UI level?
+ const QUrl origin = toQt(requesting_origin);
+ auto it = m_requests.begin();
+ const auto end = m_requests.end();
+ while (it != end) {
+ if (it->id == request_id && it->type == permissionType && it->origin == origin) {
+ m_requests.erase(it);
+ return;
+ }
+ }
+ qWarning() << "PermissionManagerQt::CancelPermissionRequest called on unknown request" << request_id << origin << permissionType;
+}
+
+content::PermissionStatus PermissionManagerQt::GetPermissionStatus(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& /*embedding_origin*/)
+{
+ const BrowserContextAdapter::PermissionType permissionType = toQt(permission);
+ if (permissionType == BrowserContextAdapter::UnsupportedPermission)
+ return content::PERMISSION_STATUS_DENIED;
+
+ QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType);
+ if (!m_permissions.contains(key))
+ return content::PERMISSION_STATUS_ASK;
+ if (m_permissions[key])
+ return content::PERMISSION_STATUS_GRANTED;
+ return content::PERMISSION_STATUS_DENIED;
+}
+
+void PermissionManagerQt::ResetPermission(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& /*embedding_origin*/)
+{
+ const BrowserContextAdapter::PermissionType permissionType = toQt(permission);
+ if (permissionType == BrowserContextAdapter::UnsupportedPermission)
+ return;
+
+ QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType);
+ m_permissions.remove(key);
+}
+
+void PermissionManagerQt::RegisterPermissionUsage(
+ content::PermissionType /*permission*/,
+ const GURL& /*requesting_origin*/,
+ const GURL& /*embedding_origin*/)
+{
+ // We do not currently track which permissions are used.
+}
+
+int PermissionManagerQt::SubscribePermissionStatusChange(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& /*embedding_origin*/,
+ const base::Callback<void(content::PermissionStatus)>& callback)
+{
+ Subscriber subscriber = {
+ m_subscriberCount++,
+ toQt(permission),
+ toQt(requesting_origin),
+ callback
+ };
+ m_subscribers.append(subscriber);
+ return subscriber.id;
+}
+
+void PermissionManagerQt::UnsubscribePermissionStatusChange(int subscription_id)
+{
+ for (int i = 0; i < m_subscribers.count(); i++) {
+ if (m_subscribers[i].id == subscription_id) {
+ m_subscribers.removeAt(i);
+ return;
+ }
+ }
+ qWarning() << "PermissionManagerQt::UnsubscribePermissionStatusChange called on unknown subscription id" << subscription_id;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h
new file mode 100644
index 000000000..75f88f9a9
--- /dev/null
+++ b/src/core/permission_manager_qt.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PERMISSION_MANAGER_QT_H
+#define PERMISSION_MANAGER_QT_H
+
+#include "base/callback.h"
+#include "content/public/browser/permission_manager.h"
+#include "browser_context_adapter.h"
+
+#include <QHash>
+#include <QList>
+
+namespace QtWebEngineCore {
+
+class PermissionManagerQt : public content::PermissionManager {
+
+public:
+ PermissionManagerQt(BrowserContextAdapter *);
+ ~PermissionManagerQt();
+ typedef BrowserContextAdapter::PermissionType PermissionType;
+
+ void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
+
+ // content::PermissionManager implementation:
+ void RequestPermission(
+ content::PermissionType permission,
+ content::WebContents* web_contents,
+ int request_id,
+ const GURL& requesting_origin,
+ bool user_gesture,
+ const base::Callback<void(content::PermissionStatus)>& callback) override;
+
+ void CancelPermissionRequest(
+ content::PermissionType permission,
+ content::WebContents* web_contents,
+ int request_id,
+ const GURL& requesting_origin) override;
+
+ content::PermissionStatus GetPermissionStatus(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin) override;
+
+ void ResetPermission(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin) override;
+
+ void RegisterPermissionUsage(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin) override;
+
+ int SubscribePermissionStatusChange(
+ content::PermissionType permission,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin,
+ const base::Callback<void(content::PermissionStatus)>& callback) override;
+
+ void UnsubscribePermissionStatusChange(int subscription_id) override;
+
+private:
+ BrowserContextAdapter *m_contextAdapter;
+ QHash<QPair<QUrl, PermissionType>, bool> m_permissions;
+ struct Request {
+ int id;
+ PermissionType type;
+ QUrl origin;
+ base::Callback<void(content::PermissionStatus)> callback;
+ };
+ QList<Request> m_requests;
+ struct Subscriber {
+ int id;
+ PermissionType type;
+ QUrl origin;
+ base::Callback<void(content::PermissionStatus)> callback;
+ };
+ int m_subscriberCount;
+ QList<Subscriber> m_subscribers;
+
+};
+
+} // namespace QtWebEngineCore
+
+#endif // PERMISSION_MANAGER_QT_H
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index ac1bf968d..2464574e6 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -799,7 +799,7 @@ void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin,
void WebContentsAdapter::runGeolocationRequestCallback(const QUrl &securityOrigin, bool allowed)
{
Q_D(WebContentsAdapter);
- d->webContentsDelegate->geolocationPermissionReply(securityOrigin, allowed);
+ d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::GeolocationPermission, allowed);
}
void WebContentsAdapter::grantMouseLockPermission(bool granted)
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index ea4bf3a03..865ee8e2c 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -337,28 +337,9 @@ void WebContentsDelegateQt::allowCertificateError(const QSharedPointer<Certifica
m_viewClient->allowCertificateError(errorController);
}
-void WebContentsDelegateQt::requestGeolocationPermission(const GURL &requestingFrameOrigin, const base::Callback<void (bool)> &resultCallback)
+void WebContentsDelegateQt::requestGeolocationPermission(const QUrl &requestingOrigin)
{
- QUrl url = toQt(requestingFrameOrigin);
- bool newRequest = !m_geolocationPermissionRequests.contains(url);
- m_geolocationPermissionRequests[url] = resultCallback;
- if (newRequest)
- m_viewClient->runGeolocationPermissionRequest(url);
-}
-
-void WebContentsDelegateQt::cancelGeolocationPermissionRequest(const GURL &requestingFrameOrigin)
-{
- m_geolocationPermissionRequests.remove(toQt(requestingFrameOrigin));
- // FIXME: Tell the API layer to cancel the permission request?
-}
-
-void WebContentsDelegateQt::geolocationPermissionReply(const QUrl &origin, bool permission)
-{
- auto it = m_geolocationPermissionRequests.find(origin);
- if (it != m_geolocationPermissionRequests.end()) {
- (*it).Run(permission);
- m_geolocationPermissionRequests.erase(it);
- }
+ m_viewClient->runGeolocationPermissionRequest(requestingOrigin);
}
void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text)
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index d51ff8c3a..e2a6a2cbd 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -39,6 +39,7 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/common/permission_status.mojom.h"
#include "base/callback.h"
@@ -101,15 +102,11 @@ public:
void overrideWebPreferences(content::WebContents *, content::WebPreferences*);
void allowCertificateError(const QSharedPointer<CertificateErrorController> &) ;
- void requestGeolocationPermission(const GURL &requestingFrameOrigin, const base::Callback<void (bool)> &resultCallback);
- void cancelGeolocationPermissionRequest(const GURL &requestingFrameOrigin);
- void geolocationPermissionReply(const QUrl&, bool permission);
+ void requestGeolocationPermission(const QUrl &requestingOrigin);
private:
WebContentsAdapter *createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture);
- QHash<QUrl, base::Callback<void (bool)> > m_geolocationPermissionRequests;
-
WebContentsAdapterClient *m_viewClient;
QString m_lastSearchedString;
int m_lastReceivedFindReply;