[Qt] [WK2] Expose onNavigationRequested signal instead of expecting a slot be defined...
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Nov 2011 16:52:54 +0000 (16:52 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Nov 2011 16:52:54 +0000 (16:52 +0000)
commitf3ac357fda85a19041bfb7df7781f68b882fca2c
tree79e5d1d474ba39a5d304f6893ba352acf4d4a6ea
parenta34626171d97f0ce9f753cccfb0038ccf6c457b3
[Qt] [WK2] Expose onNavigationRequested signal instead of expecting a slot be defined from QML
https://bugs.webkit.org/show_bug.cgi?id=72976

Reviewed by Tor Arne Vestbø.

Expecting slots/methods to be implemented in QML isn't very idiomatic in
comparison with the alternative of having a signal. So we now use a signal
for handling navigation requests, and expose a 'request' object with relevant
metadata. There's also a settable property 'action' used to indicate whether
the navigation should be ignored or trigger a download.

The pattern signal with an object parameter that can keep the reply is common in QML,
and used for example for mouse signals.

* UIProcess/API/qt/qquickwebview.cpp:
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
* UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationPolicyForUrl.qml.
* UIProcess/API/qt/tests/qmltests/qmltests.pro:
* UIProcess/qt/QtWebPagePolicyClient.cpp:
(NavigationRequest::NavigationRequest):
(NavigationRequest::url):
(NavigationRequest::button):
(NavigationRequest::modifiers):
(NavigationRequest::action):
(NavigationRequest::setAction):
(QtWebPagePolicyClient::decidePolicyForNavigationAction):
* UIProcess/qt/QtWebPagePolicyClient.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@101086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml [moved from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationPolicyForUrl.qml with 80% similarity]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro
Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.cpp
Source/WebKit2/UIProcess/qt/QtWebPagePolicyClient.h