[Qt] request parameter of QQuickWebView::navigationRequested is not a registered...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2011 01:41:36 +0000 (01:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2011 01:41:36 +0000 (01:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73826

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2011-12-09
Reviewed by Tor Arne Vestbø.

.:

* Source/qtwebkit-export.map: Adding QWebNavigationRequest

Source/WebKit/qt:

* declarative/plugin.cpp:
(WebKitQmlPlugin::registerTypes): Registering QWebNavigationRequest

Source/WebKit2:

Adding QWebNavigationRequest by moving NavigationRequest out of QtWebPagePolicyClient.

* Target.pri:
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qwebnavigationrequest.cpp: Added.
(QWebNavigationRequestPrivate::QWebNavigationRequestPrivate):
(QWebNavigationRequestPrivate::~QWebNavigationRequestPrivate):
(QWebNavigationRequest::QWebNavigationRequest):
(QWebNavigationRequest::~QWebNavigationRequest):
(QWebNavigationRequest::setAction):
(QWebNavigationRequest::url):
(QWebNavigationRequest::button):
(QWebNavigationRequest::modifiers):
(QWebNavigationRequest::action):
* UIProcess/API/qt/qwebnavigationrequest_p.h: Added.
* UIProcess/qt/QtWebPagePolicyClient.cpp:
(QtWebPagePolicyClient::decidePolicyForNavigationAction):
(QtWebPagePolicyClient::decidePolicyForResponse):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102502 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/declarative/plugin.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest_p.h [new file with mode: 0644]
Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp
Source/qtwebkit-export.map

index 512f5fc..2338b6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-09  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt] request parameter of QQuickWebView::navigationRequested is not a registered type
+        https://bugs.webkit.org/show_bug.cgi?id=73826
+
+        Reviewed by Tor Arne Vestbø.
+
+        * Source/qtwebkit-export.map: Adding QWebNavigationRequest
+
 2011-12-09  Joone Hur  <joone.hur@collabora.co.uk>
 
         [GTK] Initial implementation of Accelerated Compositing using Clutter
index e0a8d7c..21217c3 100644 (file)
@@ -1,3 +1,13 @@
+2011-12-09  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt] request parameter of QQuickWebView::navigationRequested is not a registered type
+        https://bugs.webkit.org/show_bug.cgi?id=73826
+
+        Reviewed by Tor Arne Vestbø.
+
+        * declarative/plugin.cpp:
+        (WebKitQmlPlugin::registerTypes): Registering QWebNavigationRequest
+
 2011-12-08  Pierre Rossi  <pierre.rossi@gmail.com>
 
         Drop ENABLE_NO_LISTBOX_RENDERING, and make it a runtime decision.
index d039b8a..bafbb59 100644 (file)
@@ -25,6 +25,7 @@
 #if defined(HAVE_WEBKIT2)
 #include "qquickwebpage_p.h"
 #include "qquickwebview_p.h"
+#include "qwebnavigationrequest_p.h"
 #include "qwebpermissionrequest_p.h"
 #include "qwebpreferences_p.h"
 
@@ -53,6 +54,7 @@ public:
         qmlRegisterUncreatableType<QQuickWebPage>(uri, 3, 0, "WebPage", QObject::tr("Cannot create separate instance of WebPage, use WebView"));
         qmlRegisterUncreatableType<QNetworkReply>(uri, 3, 0, "NetworkReply", QObject::tr("Cannot create separate instance of NetworkReply"));
         qmlRegisterUncreatableType<QWebPermissionRequest>(uri, 3, 0, "PermissionRequest", QObject::tr("Cannot create separate instance of PermissionRequest"));
+        qmlRegisterUncreatableType<QWebNavigationRequest>(uri, 3, 0, "NavigationRequest", QObject::tr("Cannot create separate instance of NavigationRequest"));
 #endif
     }
 };
index 213406b..db100da 100644 (file)
@@ -1,5 +1,31 @@
 2011-12-09  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
+        [Qt] request parameter of QQuickWebView::navigationRequested is not a registered type
+        https://bugs.webkit.org/show_bug.cgi?id=73826
+
+        Reviewed by Tor Arne Vestbø.
+
+        Adding QWebNavigationRequest by moving NavigationRequest out of QtWebPagePolicyClient.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qwebnavigationrequest.cpp: Added.
+        (QWebNavigationRequestPrivate::QWebNavigationRequestPrivate):
+        (QWebNavigationRequestPrivate::~QWebNavigationRequestPrivate):
+        (QWebNavigationRequest::QWebNavigationRequest):
+        (QWebNavigationRequest::~QWebNavigationRequest):
+        (QWebNavigationRequest::setAction):
+        (QWebNavigationRequest::url):
+        (QWebNavigationRequest::button):
+        (QWebNavigationRequest::modifiers):
+        (QWebNavigationRequest::action):
+        * UIProcess/API/qt/qwebnavigationrequest_p.h: Added.
+        * UIProcess/qt/QtWebPagePolicyClient.cpp:
+        (QtWebPagePolicyClient::decidePolicyForNavigationAction):
+        (QtWebPagePolicyClient::decidePolicyForResponse):
+
+2011-12-09  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
         [Qt][WK2] Unskip API tests
         https://bugs.webkit.org/show_bug.cgi?id=74180
 
index a5d4c6d..08f6e3d 100644 (file)
@@ -177,6 +177,7 @@ HEADERS += \
     UIProcess/API/qt/qwebdownloaditem_p.h \
     UIProcess/API/qt/qwebdownloaditem_p_p.h \
     UIProcess/API/qt/qwebpermissionrequest_p.h \
+    UIProcess/API/qt/qwebnavigationrequest_p.h \
     UIProcess/API/qt/qquickwebpage_p.h \
     UIProcess/API/qt/qquickwebpage_p_p.h \
     UIProcess/API/qt/qquickwebview_p.h \
@@ -495,6 +496,7 @@ SOURCES += \
     UIProcess/API/cpp/qt/WKURLQt.cpp \
     UIProcess/API/qt/qwebdownloaditem.cpp \
     UIProcess/API/qt/qwebpermissionrequest.cpp \
+    UIProcess/API/qt/qwebnavigationrequest.cpp \
     UIProcess/API/qt/qquickwebpage.cpp \
     UIProcess/API/qt/qquickwebview.cpp \
     UIProcess/API/qt/qwebpreferences.cpp \
index 4567773..099504f 100644 (file)
@@ -24,6 +24,7 @@
 #include "qwebkitglobal.h"
 #include <QtQuick/qquickitem.h>
 
+class QWebNavigationRequest;
 class QDeclarativeComponent;
 class QQuickWebPage;
 class QQuickWebViewAttached;
@@ -114,7 +115,7 @@ Q_SIGNALS:
     void messageReceived(const QVariantMap& message);
     void linkHovered(const QUrl& url, const QString& title);
     void navigationStateChanged();
-    void navigationRequested(QObject* request);
+    void navigationRequested(QWebNavigationRequest* request);
 
 protected:
     virtual void geometryChanged(const QRectF&, const QRectF&);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest.cpp
new file mode 100644 (file)
index 0000000..885fe54
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qwebnavigationrequest_p.h"
+
+#include "qquickwebview_p.h"
+
+class QWebNavigationRequestPrivate {
+public:
+    QWebNavigationRequestPrivate(const QUrl& url, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
+        : url(url)
+        , button(button)
+        , modifiers(modifiers)
+        , action(QQuickWebView::AcceptRequest)
+    {
+    }
+
+    ~QWebNavigationRequestPrivate()
+    {
+    }
+
+    QUrl url;
+    Qt::MouseButton button;
+    Qt::KeyboardModifiers modifiers;
+    int action;
+};
+
+QWebNavigationRequest::QWebNavigationRequest(const QUrl& url, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QObject* parent)
+    : QObject(parent)
+    , d(new QWebNavigationRequestPrivate(url, button, modifiers))
+{
+}
+
+QWebNavigationRequest::~QWebNavigationRequest()
+{
+    delete d;
+}
+
+void QWebNavigationRequest::setAction(int action)
+{
+    if (d->action == action)
+        return;
+
+    d->action = action;
+    emit actionChanged();
+}
+
+QUrl QWebNavigationRequest::url() const
+{
+    return d->url;
+}
+
+int QWebNavigationRequest::button() const
+{
+    return int(d->button);
+}
+
+int QWebNavigationRequest::modifiers() const
+{
+    return int(d->modifiers);
+}
+
+int QWebNavigationRequest::action() const
+{
+    return int(d->action);
+}
+
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebnavigationrequest_p.h
new file mode 100644 (file)
index 0000000..4acf940
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qwebnavigationrequest_p_h
+#define qwebnavigationrequest_p_h
+
+#include "qwebkitglobal.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QUrl>
+
+class QWebNavigationRequestPrivate;
+
+class QWEBKIT_EXPORT QWebNavigationRequest : public QObject {
+    Q_OBJECT
+    Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
+    Q_PROPERTY(int button READ button CONSTANT FINAL)
+    Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
+    Q_PROPERTY(int action READ action WRITE setAction NOTIFY actionChanged FINAL)
+
+public:
+    QWebNavigationRequest(const QUrl& url, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QObject* parent = 0);
+    ~QWebNavigationRequest();
+
+    QUrl url() const;
+    int button() const;
+    int modifiers() const;
+    int action() const;
+
+    void setAction(int action);
+
+Q_SIGNALS:
+    void actionChanged();
+
+private:
+    QWebNavigationRequestPrivate* d;
+};
+
+#endif // qwebnavigationrequest_h
index 0c0ca64..d475d62 100644 (file)
 #include "WKURLQt.h"
 #include "qquickwebview_p.h"
 #include "qquickwebview_p_p.h"
+#include "qwebnavigationrequest_p.h"
 #include <QtCore/QObject>
 #include <WKFramePolicyListener.h>
 #include <WKURLRequest.h>
 
-class NavigationRequest : public QObject {
-    Q_OBJECT
-    Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
-    Q_PROPERTY(int button READ button CONSTANT FINAL)
-    Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
-    Q_PROPERTY(int action READ action WRITE setAction NOTIFY actionChanged FINAL)
-
-public:
-    NavigationRequest(const QUrl& url, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
-        : m_url(url)
-        , m_button(button)
-        , m_modifiers(modifiers)
-        , m_action(QQuickWebView::AcceptRequest)
-    {
-    }
-
-    QUrl url() const { return m_url; }
-    int button() const { return int(m_button); }
-    int modifiers() const { return int(m_modifiers); }
-
-    int action() const { return int(m_action); }
-    void setAction(int action)
-    {
-        if (m_action == action)
-            return;
-        m_action = action;
-        emit actionChanged();
-    }
-
-Q_SIGNALS:
-    void actionChanged();
-
-private:
-    QUrl m_url;
-    Qt::MouseButton m_button;
-    Qt::KeyboardModifiers m_modifiers;
-    int m_action;
-};
-
 QtWebPagePolicyClient::QtWebPagePolicyClient(WKPageRef pageRef, QQuickWebView* webView)
     : m_webView(webView)
 {
@@ -83,7 +45,7 @@ void QtWebPagePolicyClient::decidePolicyForNavigationAction(const QUrl& url, Qt:
 {
     // NOTE: even though the C API (and the WebKit2 IPC) supports an asynchronous answer, this is not currently working.
     // We are expected to call the listener immediately. See the patch for https://bugs.webkit.org/show_bug.cgi?id=53785.
-    NavigationRequest navigationRequest(url, mouseButton, keyboardModifiers);
+    QWebNavigationRequest navigationRequest(url, mouseButton, keyboardModifiers);
     emit m_webView->navigationRequested(&navigationRequest);
 
     switch (QQuickWebView::NavigationRequestAction(navigationRequest.action())) {
@@ -170,5 +132,3 @@ void QtWebPagePolicyClient::decidePolicyForResponse(WKPageRef page, WKFrameRef f
 
     WKFramePolicyListenerUse(listener);
 }
-
-#include "QtWebPagePolicyClient.moc"
index a546cb2..4b6e75f 100644 (file)
@@ -130,6 +130,9 @@ qwk_1.0 {
         *QWebPermissionRequest;
         non-virtual?thunk?to?QWebPermissionRequest*;
         QWebPermissionRequest::*;
+        *QWebNavigationRequest;
+        non-virtual?thunk?to?QWebNavigationRequest*;
+        QWebNavigationRequest::*;
 
 
         # WebKit 2 C API mangled in C++