Title: [108232] trunk/Source/WebKit2
Revision
108232
Author
[email protected]
Date
2012-02-20 04:25:14 -0800 (Mon, 20 Feb 2012)

Log Message

[Qt][WK2] Implement proxy authentication handling.
https://bugs.webkit.org/show_bug.cgi?id=78792

Patch by Michael BrĂ¼ning <[email protected]> on 2012-02-20
Reviewed by Simon Hausmann.

This patch implements the proxy authentication handling
for the Qt port in a similar matter to the http authentication
implementation.

Since there is a need to pass the proxy port, which is of type uint16_t,
from the WebProcess to the UIProcess, an encoder and a decoder for
this type was added because it did not exist.

The message that was added to the WebPageProxy is called synchronously
as this is needed by the implementation of the network access manager
and has also been implemented this way already for the http
authentication.

* Platform/CoreIPC/ArgumentDecoder.cpp:
(CoreIPC::ArgumentDecoder::decodeUInt16):
(CoreIPC):
* Platform/CoreIPC/ArgumentDecoder.h:
(ArgumentDecoder):
(CoreIPC::ArgumentDecoder::decode):
(CoreIPC):
* Platform/CoreIPC/ArgumentEncoder.cpp:
(CoreIPC::ArgumentEncoder::encodeUInt16):
(CoreIPC):
* Platform/CoreIPC/ArgumentEncoder.h:
(ArgumentEncoder):
(CoreIPC::ArgumentEncoder::encode):
(CoreIPC):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebViewPrivate::handleProxyAuthenticationRequiredRequest):
(QQuickWebViewExperimental::proxyAuthenticationDialog):
(QQuickWebViewExperimental::setProxyAuthenticationDialog):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/PageClient.h:
(PageClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::proxyAuthenticationRequiredRequest):
(WebKit):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/qt/QtDialogRunner.cpp:
(ProxyAuthenticationDialogContextObject):
(ProxyAuthenticationDialogContextObject::ProxyAuthenticationDialogContextObject):
(ProxyAuthenticationDialogContextObject::hostname):
(ProxyAuthenticationDialogContextObject::port):
(ProxyAuthenticationDialogContextObject::prefilledUsername):
(ProxyAuthenticationDialogContextObject::accept):
(ProxyAuthenticationDialogContextObject::reject):
(QtDialogRunner::initForProxyAuthentication):
* UIProcess/qt/QtDialogRunner.h:
(QtDialogRunner):
* UIProcess/qt/QtPageClient.cpp:
(QtPageClient::handleProxyAuthenticationRequiredRequest):
* UIProcess/qt/QtPageClient.h:
(QtPageClient):
* WebProcess/WebPage/DecoderAdapter.cpp:
(WebKit::DecoderAdapter::decodeUInt16):
(WebKit):
* WebProcess/WebPage/DecoderAdapter.h:
(DecoderAdapter):
* WebProcess/WebPage/EncoderAdapter.cpp:
(WebKit::EncoderAdapter::encodeUInt16):
(WebKit):
* WebProcess/WebPage/EncoderAdapter.h:
(EncoderAdapter):
* WebProcess/qt/QtNetworkAccessManager.cpp:
(WebKit::QtNetworkAccessManager::onProxyAuthenticationRequired):
(WebKit):
* WebProcess/qt/QtNetworkAccessManager.h:
(QtNetworkAccessManager):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (108231 => 108232)


--- trunk/Source/WebKit2/ChangeLog	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-20 12:25:14 UTC (rev 108232)
@@ -1,3 +1,84 @@
+2012-02-20  Michael BrĂ¼ning  <[email protected]>
+
+        [Qt][WK2] Implement proxy authentication handling.
+        https://bugs.webkit.org/show_bug.cgi?id=78792
+
+        Reviewed by Simon Hausmann.
+
+        This patch implements the proxy authentication handling
+        for the Qt port in a similar matter to the http authentication
+        implementation.
+
+        Since there is a need to pass the proxy port, which is of type uint16_t,
+        from the WebProcess to the UIProcess, an encoder and a decoder for
+        this type was added because it did not exist.
+        
+        The message that was added to the WebPageProxy is called synchronously
+        as this is needed by the implementation of the network access manager
+        and has also been implemented this way already for the http 
+        authentication.
+
+        * Platform/CoreIPC/ArgumentDecoder.cpp:
+        (CoreIPC::ArgumentDecoder::decodeUInt16):
+        (CoreIPC):
+        * Platform/CoreIPC/ArgumentDecoder.h:
+        (ArgumentDecoder):
+        (CoreIPC::ArgumentDecoder::decode):
+        (CoreIPC):
+        * Platform/CoreIPC/ArgumentEncoder.cpp:
+        (CoreIPC::ArgumentEncoder::encodeUInt16):
+        (CoreIPC):
+        * Platform/CoreIPC/ArgumentEncoder.h:
+        (ArgumentEncoder):
+        (CoreIPC::ArgumentEncoder::encode):
+        (CoreIPC):
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebViewPrivate::handleProxyAuthenticationRequiredRequest):
+        (QQuickWebViewExperimental::proxyAuthenticationDialog):
+        (QQuickWebViewExperimental::setProxyAuthenticationDialog):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+        * UIProcess/PageClient.h:
+        (PageClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::proxyAuthenticationRequiredRequest):
+        (WebKit):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/qt/QtDialogRunner.cpp:
+        (ProxyAuthenticationDialogContextObject):
+        (ProxyAuthenticationDialogContextObject::ProxyAuthenticationDialogContextObject):
+        (ProxyAuthenticationDialogContextObject::hostname):
+        (ProxyAuthenticationDialogContextObject::port):
+        (ProxyAuthenticationDialogContextObject::prefilledUsername):
+        (ProxyAuthenticationDialogContextObject::accept):
+        (ProxyAuthenticationDialogContextObject::reject):
+        (QtDialogRunner::initForProxyAuthentication):
+        * UIProcess/qt/QtDialogRunner.h:
+        (QtDialogRunner):
+        * UIProcess/qt/QtPageClient.cpp:
+        (QtPageClient::handleProxyAuthenticationRequiredRequest):
+        * UIProcess/qt/QtPageClient.h:
+        (QtPageClient):
+        * WebProcess/WebPage/DecoderAdapter.cpp:
+        (WebKit::DecoderAdapter::decodeUInt16):
+        (WebKit):
+        * WebProcess/WebPage/DecoderAdapter.h:
+        (DecoderAdapter):
+        * WebProcess/WebPage/EncoderAdapter.cpp:
+        (WebKit::EncoderAdapter::encodeUInt16):
+        (WebKit):
+        * WebProcess/WebPage/EncoderAdapter.h:
+        (EncoderAdapter):
+        * WebProcess/qt/QtNetworkAccessManager.cpp:
+        (WebKit::QtNetworkAccessManager::onProxyAuthenticationRequired):
+        (WebKit):
+        * WebProcess/qt/QtNetworkAccessManager.h:
+        (QtNetworkAccessManager):
+
 2012-02-20  Patrick Gansterer  <[email protected]>
 
         [CMake] Update and sort list of source files.

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp (108231 => 108232)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -141,6 +141,16 @@
     return true;
 }
 
+bool ArgumentDecoder::decodeUInt16(uint16_t& result)
+{
+    if (!alignBufferPosition(sizeof(result), sizeof(result)))
+        return false;
+
+    result = *reinterpret_cast<uint16_t*>(m_bufferPos);
+    m_bufferPos += sizeof(result);
+    return true;
+}
+
 bool ArgumentDecoder::decodeUInt32(uint32_t& result)
 {
     if (!alignBufferPosition(sizeof(result), sizeof(result)))

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h (108231 => 108232)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -53,6 +53,7 @@
     bool decodeVariableLengthByteArray(DataReference&);
 
     bool decodeBool(bool&);
+    bool decodeUInt16(uint16_t&);
     bool decodeUInt32(uint32_t&);
     bool decodeUInt64(uint64_t&);
     bool decodeInt32(int32_t&);
@@ -126,6 +127,11 @@
     return decodeBool(n);
 }
 
+template<> inline bool ArgumentDecoder::decode(uint16_t& n)
+{
+    return decodeUInt16(n);
+}
+
 template<> inline bool ArgumentDecoder::decode(uint32_t& n)
 {
     return decodeUInt32(n);

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp (108231 => 108232)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -115,6 +115,13 @@
     *reinterpret_cast<bool*>(buffer) = n;
 }
 
+void ArgumentEncoder::encodeUInt16(uint16_t n)
+{
+    uint8_t* buffer = grow(sizeof(n), sizeof(n));
+
+    *reinterpret_cast<uint16_t*>(buffer) = n;
+}
+
 void ArgumentEncoder::encodeUInt32(uint32_t n)
 {
     uint8_t* buffer = grow(sizeof(n), sizeof(n));

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h (108231 => 108232)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -46,6 +46,7 @@
     void encodeVariableLengthByteArray(const DataReference&);
 
     void encodeBool(bool);
+    void encodeUInt16(uint16_t);
     void encodeUInt32(uint32_t);
     void encodeUInt64(uint64_t);
     void encodeInt32(int32_t);
@@ -94,6 +95,11 @@
     encodeBool(n);
 }
 
+template<> inline void ArgumentEncoder::encode(const uint16_t& n)
+{
+    encodeUInt16(n);
+}
+
 template<> inline void ArgumentEncoder::encode(const uint32_t& n)
 {
     encodeUInt32(n);

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -74,6 +74,7 @@
     , authenticationDialog(0)
     , certificateVerificationDialog(0)
     , itemSelector(0)
+    , proxyAuthenticationDialog(0)
     , userDidOverrideContentWidth(false)
     , userDidOverrideContentHeight(false)
     , m_navigatorQtObjectEnabled(false)
@@ -311,6 +312,25 @@
     password = dialogRunner.password();
 }
 
+void QQuickWebViewPrivate::handleProxyAuthenticationRequiredRequest(const QString& hostname, uint16_t port, const QString& prefilledUsername, QString& username, QString& password)
+{
+    if (!proxyAuthenticationDialog)
+        return;
+
+    Q_Q(QQuickWebView);
+    QtDialogRunner dialogRunner;
+    if (!dialogRunner.initForProxyAuthentication(proxyAuthenticationDialog, q, hostname, port, prefilledUsername))
+        return;
+
+    setViewInAttachedProperties(dialogRunner.dialog());
+    disableMouseEvents();
+    dialogRunner.exec();
+    enableMouseEvents();
+
+    username = dialogRunner.username();
+    password = dialogRunner.password();
+}
+
 bool QQuickWebViewPrivate::handleCertificateVerificationRequest(const QString& hostname)
 {
     if (!certificateVerificationDialog)
@@ -842,6 +862,20 @@
     emit authenticationDialogChanged();
 }
 
+QDeclarativeComponent* QQuickWebViewExperimental::proxyAuthenticationDialog() const
+{
+    Q_D(const QQuickWebView);
+    return d->proxyAuthenticationDialog;
+}
+
+void QQuickWebViewExperimental::setProxyAuthenticationDialog(QDeclarativeComponent* proxyAuthenticationDialog)
+{
+    Q_D(QQuickWebView);
+    if (d->proxyAuthenticationDialog == proxyAuthenticationDialog)
+        return;
+    d->proxyAuthenticationDialog = proxyAuthenticationDialog;
+    emit proxyAuthenticationDialogChanged();
+}
 QDeclarativeComponent* QQuickWebViewExperimental::certificateVerificationDialog() const
 {
     Q_D(const QQuickWebView);

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -227,6 +227,7 @@
     Q_PROPERTY(QDeclarativeComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* authenticationDialog READ authenticationDialog WRITE setAuthenticationDialog NOTIFY authenticationDialogChanged)
+    Q_PROPERTY(QDeclarativeComponent* proxyAuthenticationDialog READ proxyAuthenticationDialog WRITE setProxyAuthenticationDialog NOTIFY proxyAuthenticationDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
     Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
@@ -254,6 +255,8 @@
     void setCertificateVerificationDialog(QDeclarativeComponent*);
     QDeclarativeComponent* itemSelector() const;
     void setItemSelector(QDeclarativeComponent*);
+    QDeclarativeComponent* proxyAuthenticationDialog() const;
+    void setProxyAuthenticationDialog(QDeclarativeComponent*);
 
     QWebViewportInfo* viewportInfo();
 
@@ -305,6 +308,7 @@
     void downloadRequested(QWebDownloadItem* downloadItem);
     void permissionRequested(QWebPermissionRequest* permission);
     void messageReceived(const QVariantMap& message);
+    void proxyAuthenticationDialogChanged();
 
 private:
     QQuickWebView* q_ptr;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -102,6 +102,7 @@
 
     void handleAuthenticationRequiredRequest(const QString& hostname, const QString& realm, const QString& prefilledUsername, QString& username, QString& password);
     bool handleCertificateVerificationRequest(const QString& hostname);
+    void handleProxyAuthenticationRequiredRequest(const QString& hostname, uint16_t port, const QString& prefilledUsername, QString& username, QString& password);
 
     void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; }
     void setViewInAttachedProperties(QObject*);
@@ -145,6 +146,7 @@
     QDeclarativeComponent* authenticationDialog;
     QDeclarativeComponent* certificateVerificationDialog;
     QDeclarativeComponent* itemSelector;
+    QDeclarativeComponent* proxyAuthenticationDialog;
 
     WebCore::ViewportArguments viewportArguments;
     QFileDialog* fileDialog;

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -111,6 +111,7 @@
     virtual void updateTextInputState() = 0;
     virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0;
     virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0;
+    virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0;
 #endif // PLATFORM(QT).
 
 #if PLATFORM(QT) || PLATFORM(GTK)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -2396,6 +2396,11 @@
     m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
 }
 
+void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
+{
+    m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
+}
+
 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
 {
     m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -322,6 +322,7 @@
     void sendApplicationSchemeReply(const QQuickNetworkReply*);
     void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
     void certificateVerificationRequest(const String& hostname, bool& ignoreErrors);
+    void proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
 #endif // PLATFORM(QT).
 
 #if PLATFORM(QT)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-02-20 12:25:14 UTC (rev 108232)
@@ -76,6 +76,7 @@
     DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
     AuthenticationRequiredRequest(WTF::String hostname, WTF::String realm, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password)
     CertificateVerificationRequest(WTF::String hostname) -> (bool ignoreErrors)
+    ProxyAuthenticationRequiredRequest(WTF::String hostname, uint16_t port, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password)
 #endif
 #if ENABLE(TOUCH_EVENTS)
     NeedTouchEvents(bool needTouchEvents)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -102,6 +102,39 @@
     QString m_prefilledUsername;
 };
 
+class ProxyAuthenticationDialogContextObject : public QObject {
+    Q_OBJECT
+    Q_PROPERTY(QString hostname READ hostname CONSTANT)
+    Q_PROPERTY(quint16 port READ port CONSTANT)
+    Q_PROPERTY(QString prefilledUsername READ prefilledUsername CONSTANT)
+
+public:
+    ProxyAuthenticationDialogContextObject(const QString& hostname, quint16 port, const QString& prefilledUsername)
+        : QObject()
+        , m_hostname(hostname)
+        , m_port(port)
+        , m_prefilledUsername(prefilledUsername)
+    {
+    }
+
+    QString hostname() const { return m_hostname; }
+    quint16 port() const { return m_port; }
+    QString prefilledUsername() const { return m_prefilledUsername; }
+
+public slots:
+    void accept(const QString& username, const QString& password) { emit accepted(username, password); }
+    void reject() { emit rejected(); }
+
+signals:
+    void accepted(const QString& username, const QString& password);
+    void rejected();
+
+private:
+    QString m_hostname;
+    quint16 m_port;
+    QString m_prefilledUsername;
+};
+
 class CertificateVerificationDialogContextObject : public QObject {
     Q_OBJECT
     Q_PROPERTY(QString hostname READ hostname CONSTANT)
@@ -174,6 +207,19 @@
     return true;
 }
 
+bool QtDialogRunner::initForProxyAuthentication(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& hostname, uint16_t port, const QString& prefilledUsername)
+{
+    ProxyAuthenticationDialogContextObject* contextObject = new ProxyAuthenticationDialogContextObject(hostname, port, prefilledUsername);
+    if (!createDialog(component, dialogParent, contextObject))
+        return false;
+
+    connect(contextObject, SIGNAL(accepted(QString, QString)), SLOT(onAuthenticationAccepted(QString, QString)));
+    connect(contextObject, SIGNAL(accepted(QString, QString)), SLOT(quit()));
+    connect(contextObject, SIGNAL(rejected()), SLOT(quit()));
+
+    return true;
+}
+
 bool QtDialogRunner::initForCertificateVerification(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& hostname)
 {
     CertificateVerificationDialogContextObject* contextObject = new CertificateVerificationDialogContextObject(hostname);

Modified: trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -40,6 +40,7 @@
     bool initForPrompt(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& message, const QString& defaultValue);
     bool initForAuthentication(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& hostname, const QString& realm, const QString& prefilledUsername);
     bool initForCertificateVerification(QDeclarativeComponent*, QQuickItem*, const QString& hostname);
+    bool initForProxyAuthentication(QDeclarativeComponent*, QQuickItem*, const QString& hostname, uint16_t port, const QString& prefilledUsername);
 
     QQuickItem* dialog() const { return m_dialog.get(); }
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -123,6 +123,17 @@
     ignoreErrors = QQuickWebViewPrivate::get(m_webView)->handleCertificateVerificationRequest(hostname);
 }
 
+void QtPageClient::handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
+{
+    QString qUsername;
+    QString qPassword;
+
+    QQuickWebViewPrivate::get(m_webView)->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, qUsername, qPassword);
+
+    username = qUsername;
+    password = qPassword;
+}
+
 void QtPageClient::setCursor(const WebCore::Cursor& cursor)
 {
     // FIXME: This is a temporary fix until we get cursor support in QML items.

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (108231 => 108232)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -56,6 +56,7 @@
     virtual void handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData>);
     virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
     virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors);
+    virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
 
     virtual void displayView();
     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -52,6 +52,11 @@
     return m_decoder.decodeBool(value);
 }
 
+bool DecoderAdapter::decodeUInt16(uint16_t& value)
+{
+    return m_decoder.decodeUInt16(value);
+}
+
 bool DecoderAdapter::decodeUInt32(uint32_t& value)
 {
     return m_decoder.decodeUInt32(value);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -39,6 +39,7 @@
 private:
     virtual bool decodeBytes(Vector<uint8_t>&);
     virtual bool decodeBool(bool&);
+    virtual bool decodeUInt16(uint16_t&);
     virtual bool decodeUInt32(uint32_t&);
     virtual bool decodeUInt64(uint64_t&);
     virtual bool decodeInt32(int32_t&);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -52,6 +52,11 @@
     m_encoder->encodeBool(value);
 }
 
+void EncoderAdapter::encodeUInt16(uint16_t value)
+{
+    m_encoder->encodeUInt16(value);
+}
+
 void EncoderAdapter::encodeUInt32(uint32_t value)
 {
     m_encoder->encodeUInt32(value);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -46,6 +46,7 @@
 private:
     virtual void encodeBytes(const uint8_t*, size_t);
     virtual void encodeBool(bool);
+    virtual void encodeUInt16(uint16_t value);
     virtual void encodeUInt32(uint32_t);
     virtual void encodeUInt64(uint64_t);
     virtual void encodeInt32(int32_t);

Modified: trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp	2012-02-20 12:25:14 UTC (rev 108232)
@@ -33,6 +33,7 @@
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
 #include <QAuthenticator>
+#include <QNetworkProxy>
 #include <QNetworkReply>
 #include <QNetworkRequest>
 
@@ -73,6 +74,27 @@
     m_applicationSchemes.insert(page, scheme.toLower());
 }
 
+void QtNetworkAccessManager::onProxyAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
+{
+    WebPage* webPage = obtainOriginatingWebPage(reply->request());
+
+    String hostname = proxy().hostName();
+    uint16_t port = static_cast<uint16_t>(proxy().port());
+    String prefilledUsername = authenticator->user();
+    String username;
+    String password;
+
+    if (webPage->sendSync(
+         Messages::WebPageProxy::ProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername),
+         Messages::WebPageProxy::ProxyAuthenticationRequiredRequest::Reply(username, password))) {
+         if (!username.isEmpty())
+             authenticator->setUser(username);
+         if (!password.isEmpty())
+             authenticator->setPassword(password);
+     }
+
+}
+
 void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
 {
     WebPage* webPage = obtainOriginatingWebPage(reply->request());

Modified: trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h (108231 => 108232)


--- trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h	2012-02-20 12:16:23 UTC (rev 108231)
+++ trunk/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h	2012-02-20 12:25:14 UTC (rev 108232)
@@ -47,6 +47,7 @@
 
 private Q_SLOTS:
     void onAuthenticationRequired(QNetworkReply *, QAuthenticator *);
+    void onProxyAuthenticationRequired(QNetworkReply *, QAuthenticator *);
     void onSslErrors(QNetworkReply*, const QList<QSslError>&);
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to