Commit 9dfea8cc authored by ahf@0x90.dk's avatar ahf@0x90.dk
Browse files

[Qt][WK2] Pass Origin information to the DatabaseQuotaDialogContextObject...

[Qt][WK2] Pass Origin information to the DatabaseQuotaDialogContextObject https://bugs.webkit.org/show_bug.cgi?id=81910

Reviewed by Simon Hausmann.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::exceededDatabaseQuota):
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/qt/QtDialogRunner.cpp:
(DatabaseQuotaDialogContextObject):
(DatabaseQuotaDialogContextObject::DatabaseQuotaDialogContextObject):
(DatabaseQuotaDialogContextObject::securityOrigin):
(QtDialogRunner::initForDatabaseQuotaDialog):
* UIProcess/qt/QtDialogRunner.h:
(QtDialogRunner):
* UIProcess/qt/QtWebPageUIClient.cpp:
(QtWebPageUIClient::exceededDatabaseQuota):
* UIProcess/qt/QtWebPageUIClient.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent de5e2926
2012-03-22 Alexander Færøy <alexander.faeroy@nokia.com>
[Qt][WK2] Pass Origin information to the DatabaseQuotaDialogContextObject
https://bugs.webkit.org/show_bug.cgi?id=81910
Reviewed by Simon Hausmann.
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::exceededDatabaseQuota):
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/qt/QtDialogRunner.cpp:
(DatabaseQuotaDialogContextObject):
(DatabaseQuotaDialogContextObject::DatabaseQuotaDialogContextObject):
(DatabaseQuotaDialogContextObject::securityOrigin):
(QtDialogRunner::initForDatabaseQuotaDialog):
* UIProcess/qt/QtDialogRunner.h:
(QtDialogRunner):
* UIProcess/qt/QtWebPageUIClient.cpp:
(QtWebPageUIClient::exceededDatabaseQuota):
* UIProcess/qt/QtWebPageUIClient.h:
2012-03-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2012-03-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
   
[Qt] Don't resume the suspended page if the user is continuously flicking. [Qt] Don't resume the suspended page if the user is continuously flicking.
...@@ -399,14 +399,14 @@ void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, ...@@ -399,14 +399,14 @@ void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef,
} }
quint64 QQuickWebViewPrivate::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) quint64 QQuickWebViewPrivate::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage)
{ {
if (!databaseQuotaDialog) if (!databaseQuotaDialog)
return 0; return 0;
Q_Q(QQuickWebView); Q_Q(QQuickWebView);
QtDialogRunner dialogRunner; QtDialogRunner dialogRunner;
if (!dialogRunner.initForDatabaseQuotaDialog(databaseQuotaDialog, q, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage)) if (!dialogRunner.initForDatabaseQuotaDialog(databaseQuotaDialog, q, databaseName, displayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage))
return 0; return 0;
execDialogRunner(dialogRunner); execDialogRunner(dialogRunner);
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString); void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString);
void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, QtWebPageUIClient::FileChooserType); void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, QtWebPageUIClient::FileChooserType);
quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage); quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage);
void runJavaScriptAlert(const QString&); void runJavaScriptAlert(const QString&);
bool runJavaScriptConfirm(const QString&); bool runJavaScriptConfirm(const QString&);
QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok); QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#include "config.h" #include "config.h"
#include "QtDialogRunner.h" #include "QtDialogRunner.h"
#include "WKRetainPtr.h"
#include "WKStringQt.h"
#include "qwebpermissionrequest_p.h"
#include <QtDeclarative/QDeclarativeComponent> #include <QtDeclarative/QDeclarativeComponent>
#include <QtDeclarative/QDeclarativeContext> #include <QtDeclarative/QDeclarativeContext>
...@@ -190,9 +193,10 @@ class DatabaseQuotaDialogContextObject : public QObject { ...@@ -190,9 +193,10 @@ class DatabaseQuotaDialogContextObject : public QObject {
Q_PROPERTY(quint64 currentOriginUsage READ currentOriginUsage CONSTANT) Q_PROPERTY(quint64 currentOriginUsage READ currentOriginUsage CONSTANT)
Q_PROPERTY(quint64 currentDatabaseUsage READ currentDatabaseUsage CONSTANT) Q_PROPERTY(quint64 currentDatabaseUsage READ currentDatabaseUsage CONSTANT)
Q_PROPERTY(quint64 expectedUsage READ expectedUsage CONSTANT) Q_PROPERTY(quint64 expectedUsage READ expectedUsage CONSTANT)
Q_PROPERTY(QtWebSecurityOrigin* origin READ securityOrigin CONSTANT)
public: public:
DatabaseQuotaDialogContextObject(const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) DatabaseQuotaDialogContextObject(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage)
: QObject() : QObject()
, m_databaseName(databaseName) , m_databaseName(databaseName)
, m_displayName(displayName) , m_displayName(displayName)
...@@ -201,6 +205,12 @@ public: ...@@ -201,6 +205,12 @@ public:
, m_currentDatabaseUsage(currentDatabaseUsage) , m_currentDatabaseUsage(currentDatabaseUsage)
, m_expectedUsage(expectedUsage) , m_expectedUsage(expectedUsage)
{ {
WKRetainPtr<WKStringRef> scheme = adoptWK(WKSecurityOriginCopyProtocol(securityOrigin));
WKRetainPtr<WKStringRef> host = adoptWK(WKSecurityOriginCopyHost(securityOrigin));
m_securityOrigin.setScheme(WKStringCopyQString(scheme.get()));
m_securityOrigin.setHost(WKStringCopyQString(host.get()));
m_securityOrigin.setPort(static_cast<int>(WKSecurityOriginGetPort(securityOrigin)));
} }
QString databaseName() const { return m_databaseName; } QString databaseName() const { return m_databaseName; }
...@@ -209,6 +219,7 @@ public: ...@@ -209,6 +219,7 @@ public:
quint64 currentOriginUsage() const { return m_currentOriginUsage; } quint64 currentOriginUsage() const { return m_currentOriginUsage; }
quint64 currentDatabaseUsage() const { return m_currentDatabaseUsage; } quint64 currentDatabaseUsage() const { return m_currentDatabaseUsage; }
quint64 expectedUsage() const { return m_expectedUsage; } quint64 expectedUsage() const { return m_expectedUsage; }
QtWebSecurityOrigin* securityOrigin() { return &m_securityOrigin; }
public slots: public slots:
void accept(quint64 size) { emit accepted(size); } void accept(quint64 size) { emit accepted(size); }
...@@ -225,6 +236,7 @@ private: ...@@ -225,6 +236,7 @@ private:
quint64 m_currentOriginUsage; quint64 m_currentOriginUsage;
quint64 m_currentDatabaseUsage; quint64 m_currentDatabaseUsage;
quint64 m_expectedUsage; quint64 m_expectedUsage;
QtWebSecurityOrigin m_securityOrigin;
}; };
bool QtDialogRunner::initForAlert(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& message) bool QtDialogRunner::initForAlert(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& message)
...@@ -313,9 +325,9 @@ bool QtDialogRunner::initForFilePicker(QDeclarativeComponent* component, QQuickI ...@@ -313,9 +325,9 @@ bool QtDialogRunner::initForFilePicker(QDeclarativeComponent* component, QQuickI
return true; return true;
} }
bool QtDialogRunner::initForDatabaseQuotaDialog(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) bool QtDialogRunner::initForDatabaseQuotaDialog(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage)
{ {
DatabaseQuotaDialogContextObject* contextObject = new DatabaseQuotaDialogContextObject(databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); DatabaseQuotaDialogContextObject* contextObject = new DatabaseQuotaDialogContextObject(databaseName, displayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
if (!createDialog(component, dialogParent, contextObject)) if (!createDialog(component, dialogParent, contextObject))
return false; return false;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#ifndef QtDialogRunner_h #ifndef QtDialogRunner_h
#define QtDialogRunner_h #define QtDialogRunner_h
#include "WKSecurityOrigin.h"
#include <QtCore/QEventLoop> #include <QtCore/QEventLoop>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <wtf/OwnPtr.h> #include <wtf/OwnPtr.h>
...@@ -43,7 +44,7 @@ public: ...@@ -43,7 +44,7 @@ public:
bool initForCertificateVerification(QDeclarativeComponent*, QQuickItem*, const QString& hostname); bool initForCertificateVerification(QDeclarativeComponent*, QQuickItem*, const QString& hostname);
bool initForProxyAuthentication(QDeclarativeComponent*, QQuickItem*, const QString& hostname, uint16_t port, const QString& prefilledUsername); bool initForProxyAuthentication(QDeclarativeComponent*, QQuickItem*, const QString& hostname, uint16_t port, const QString& prefilledUsername);
bool initForFilePicker(QDeclarativeComponent*, QQuickItem*, const QStringList& selectedFiles); bool initForFilePicker(QDeclarativeComponent*, QQuickItem*, const QStringList& selectedFiles);
bool initForDatabaseQuotaDialog(QDeclarativeComponent*, QQuickItem*, const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage); bool initForDatabaseQuotaDialog(QDeclarativeComponent*, QQuickItem*, const QString& databaseName, const QString& displayName, WKSecurityOriginRef, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage);
QQuickItem* dialog() const { return m_dialog.get(); } QQuickItem* dialog() const { return m_dialog.get(); }
......
...@@ -48,9 +48,9 @@ QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView) ...@@ -48,9 +48,9 @@ QtWebPageUIClient::QtWebPageUIClient(WKPageRef pageRef, QQuickWebView* webView)
WKPageSetPageUIClient(pageRef, &uiClient); WKPageSetPageUIClient(pageRef, &uiClient);
} }
quint64 QtWebPageUIClient::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) quint64 QtWebPageUIClient::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage)
{ {
return m_webView->d_func()->exceededDatabaseQuota(databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); return m_webView->d_func()->exceededDatabaseQuota(databaseName, displayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
} }
void QtWebPageUIClient::runJavaScriptAlert(const QString& message) void QtWebPageUIClient::runJavaScriptAlert(const QString& message)
...@@ -94,11 +94,11 @@ static QtWebPageUIClient* toQtWebPageUIClient(const void* clientInfo) ...@@ -94,11 +94,11 @@ static QtWebPageUIClient* toQtWebPageUIClient(const void* clientInfo)
return reinterpret_cast<QtWebPageUIClient*>(const_cast<void*>(clientInfo)); return reinterpret_cast<QtWebPageUIClient*>(const_cast<void*>(clientInfo));
} }
unsigned long long QtWebPageUIClient::exceededDatabaseQuota(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo) unsigned long long QtWebPageUIClient::exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef securityOrigin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo)
{ {
QString qDisplayName = WKStringCopyQString(displayName); QString qDisplayName = WKStringCopyQString(displayName);
QString qDatabaseName = WKStringCopyQString(databaseName); QString qDatabaseName = WKStringCopyQString(databaseName);
return toQtWebPageUIClient(clientInfo)->exceededDatabaseQuota(qDatabaseName, qDisplayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); return toQtWebPageUIClient(clientInfo)->exceededDatabaseQuota(qDatabaseName, qDisplayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
} }
void QtWebPageUIClient::runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo) void QtWebPageUIClient::runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo)
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
QtWebPageUIClient(WKPageRef, QQuickWebView*); QtWebPageUIClient(WKPageRef, QQuickWebView*);
private: private:
quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage); quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage);
void runJavaScriptAlert(const QString& message); void runJavaScriptAlert(const QString& message);
bool runJavaScriptConfirm(const QString& message); bool runJavaScriptConfirm(const QString& message);
QString runJavaScriptPrompt(const QString& message, const QString& defaultValue, bool& ok); QString runJavaScriptPrompt(const QString& message, const QString& defaultValue, bool& ok);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment