Changeset 102779 in webkit
- Timestamp:
- Dec 14, 2011 8:04:21 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102771 r102779 1 2011-12-14 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 [Qt] [WK2] Move download handling out of QtWebPageProxy 4 https://bugs.webkit.org/show_bug.cgi?id=74506 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Also moves the creation of QtWebContext out of QtWebPageProxy. 9 10 * UIProcess/API/qt/qquickwebview.cpp: 11 (QQuickWebViewPrivate::initialize): 12 (QQuickWebViewPrivate::handleDownloadRequest): 13 (QQuickWebViewPrivate::_q_onReceivedResponseFromDownload): 14 * UIProcess/API/qt/qquickwebview_p.h: 15 * UIProcess/API/qt/qquickwebview_p_p.h: 16 * UIProcess/API/qt/qwebdownloaditem_p.h: 17 * UIProcess/qt/QtPageClient.cpp: 18 (QtPageClient::handleDownloadRequest): 19 * UIProcess/qt/QtPageClient.h: 20 * UIProcess/qt/QtWebPageProxy.cpp: 21 (QtWebPageProxy::QtWebPageProxy): 22 * UIProcess/qt/QtWebPageProxy.h: 23 1 24 2011-12-14 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 25 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r102771 r102779 22 22 #include "qquickwebview_p.h" 23 23 24 #include "DownloadProxy.h" 24 25 #include "DrawingAreaProxyImpl.h" 25 26 #include "QtDialogRunner.h" 27 #include "QtDownloadManager.h" 28 #include "QtWebContext.h" 26 29 #include "QtWebPageEventHandler.h" 27 30 #include "QtWebPageProxy.h" … … 33 36 #include "qquickwebpage_p_p.h" 34 37 #include "qquickwebview_p_p.h" 38 #include "qwebdownloaditem_p_p.h" 35 39 #include "qwebnavigationhistory_p.h" 36 40 #include "qwebnavigationhistory_p_p.h" … … 38 42 39 43 #include <JavaScriptCore/InitializeThreading.h> 44 #include <QDeclarativeEngine> 40 45 #include <QFileDialog> 41 46 #include <QtQuick/QQuickCanvas> … … 66 71 void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) 67 72 { 73 context = contextRef ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext(); 68 74 QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d; 69 setPageProxy(new QtWebPageProxy(q_ptr, &pageClient, context Ref, pageGroupRef));75 setPageProxy(new QtWebPageProxy(q_ptr, &pageClient, context, pageGroupRef)); 70 76 pageViewPrivate->initialize(webPageProxy()); 71 77 … … 234 240 } 235 241 242 void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download) 243 { 244 Q_Q(QQuickWebView); 245 // This function is responsible for hooking up a DownloadProxy to our API layer 246 // by creating a QWebDownloadItem. It will then wait for the QWebDownloadItem to be 247 // ready (filled with the ResourceResponse information) so we can pass it through to 248 // our WebViews. 249 QWebDownloadItem* downloadItem = new QWebDownloadItem(); 250 downloadItem->d->downloadProxy = download; 251 252 q->connect(downloadItem->d, SIGNAL(receivedResponse(QWebDownloadItem*)), q, SLOT(_q_onReceivedResponseFromDownload(QWebDownloadItem*))); 253 context->downloadManager()->addDownload(download, downloadItem); 254 } 255 236 256 void QQuickWebViewPrivate::updateVisibleContentRectAndScale() 237 257 { … … 262 282 { 263 283 webPageProxy()->viewStateDidChange(WebPageProxy::ViewIsVisible); 284 } 285 286 void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem) 287 { 288 // Now that our downloadItem has everything we need we can emit downloadRequested. 289 if (!downloadItem) 290 return; 291 292 Q_Q(QQuickWebView); 293 QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::JavaScriptOwnership); 294 emit q->experimental()->downloadRequested(downloadItem); 264 295 } 265 296 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
r102674 r102779 134 134 Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result)); 135 135 Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged()); 136 Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*)); 136 137 // Hides QObject::d_ptr allowing us to use the convenience macros. 137 138 QScopedPointer<QQuickWebViewPrivate> d_ptr; -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r102771 r102779 37 37 #include <QtCore/QScopedPointer> 38 38 #include <wtf/OwnPtr.h> 39 #include <wtf/RefPtr.h> 39 40 40 41 namespace WebKit { 42 class DownloadProxy; 43 class QtWebContext; 41 44 class WebPageProxy; 42 45 } … … 85 88 void _q_onOpenPanelFinished(int result); 86 89 void _q_onVisibleChanged(); 90 void _q_onReceivedResponseFromDownload(QWebDownloadItem*); 87 91 88 92 void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, QtWebPageUIClient::FileChooserType); … … 104 108 void didRelaunchProcess(); 105 109 PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 110 void handleDownloadRequest(DownloadProxy*); 106 111 107 112 private: … … 135 140 }; 136 141 142 RefPtr<QtWebContext> context; 143 137 144 QtPageClient pageClient; 138 145 QtWebUndoController undoController; -
trunk/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p.h
r100602 r102779 81 81 82 82 friend class WebKit::QtDownloadManager; 83 friend class Q tWebPageProxy;83 friend class QQuickWebViewPrivate; 84 84 }; 85 85 -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
r102765 r102779 93 93 void QtPageClient::handleDownloadRequest(DownloadProxy* download) 94 94 { 95 m_qtWebPageProxy->handleDownloadRequest(download);95 QQuickWebViewPrivate::get(m_webView)->handleDownloadRequest(download); 96 96 } 97 97 -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h
r102765 r102779 51 51 virtual void didRelaunchProcess(); 52 52 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 53 virtual void handleDownloadRequest(DownloadProxy*); 53 54 54 55 virtual void displayView(); … … 90 91 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); 91 92 virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&); 92 virtual void handleDownloadRequest(DownloadProxy*);93 93 94 94 #if ENABLE(TOUCH_EVENTS) -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r102771 r102779 22 22 #include "QtWebPageProxy.h" 23 23 24 #include <qdeclarativeengine.h>25 24 #include <QtQuick/qquickcanvas.h> 26 25 #include "qquickwebview_p.h" 27 26 #include "qquickwebview_p_p.h" 28 #include "qwebdownloaditem_p.h"29 #include "qwebdownloaditem_p_p.h"30 27 #include "qwebpreferences_p.h" 31 28 #include "qwebpreferences_p_p.h" 32 29 33 #include "DownloadProxy.h"34 #include "QtDownloadManager.h"35 30 #include "QtPageClient.h" 31 #include "QtWebContext.h" 36 32 #include "WebBackForwardList.h" 37 33 #include "WKStringQt.h" … … 43 39 using namespace WebCore; 44 40 45 QtWebPageProxy::QtWebPageProxy(QQuickWebView* qmlWebView, QtPageClient *pageClient, WKContextRef contextRef, WKPageGroupRef pageGroupRef)41 QtWebPageProxy::QtWebPageProxy(QQuickWebView* qmlWebView, QtPageClient *pageClient, PassRefPtr<QtWebContext> context, WKPageGroupRef pageGroupRef) 46 42 : m_qmlWebView(qmlWebView) 47 , m_context(context Ref ? QtWebContext::create(toImpl(contextRef)) : QtWebContext::defaultContext())43 , m_context(context) 48 44 , m_navigatorQtObjectEnabled(false) 49 45 { … … 154 150 } 155 151 156 void QtWebPageProxy::handleDownloadRequest(DownloadProxy* download)157 {158 // This function is responsible for hooking up a DownloadProxy to our API layer159 // by creating a QWebDownloadItem. It will then wait for the QWebDownloadItem to be160 // ready (filled with the ResourceResponse information) so we can pass it through to161 // our WebViews.162 QWebDownloadItem* downloadItem = new QWebDownloadItem();163 downloadItem->d->downloadProxy = download;164 165 connect(downloadItem->d, SIGNAL(receivedResponse(QWebDownloadItem*)), this, SLOT(didReceiveDownloadResponse(QWebDownloadItem*)));166 m_context->downloadManager()->addDownload(download, downloadItem);167 }168 169 void QtWebPageProxy::didReceiveDownloadResponse(QWebDownloadItem* downloadItem)170 {171 // Now that our downloadItem has everything we need we can emit downloadRequested.172 if (!downloadItem)173 return;174 175 QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::JavaScriptOwnership);176 emit m_qmlWebView->experimental()->downloadRequested(downloadItem);177 }178 179 152 #include "moc_QtWebPageProxy.cpp" -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r102771 r102779 22 22 #define QtWebPageProxy_h 23 23 24 #include "QtWebContext.h"25 24 #include "WebPageProxy.h" 25 #include <wtf/PassRefPtr.h> 26 26 #include <wtf/RefPtr.h> 27 27 #include <QMenu> … … 29 29 30 30 class QtPageClient; 31 class QQuickWebPage;32 31 class QQuickWebView; 33 class QWebDownloadItem;34 32 class QWebPreferences; 35 33 … … 45 43 46 44 public: 47 QtWebPageProxy(QQuickWebView*, QtPageClient*, WKContextRef = 0, WKPageGroupRef = 0);45 QtWebPageProxy(QQuickWebView*, QtPageClient*, PassRefPtr<QtWebContext>, WKPageGroupRef = 0); 48 46 ~QtWebPageProxy(); 49 47 … … 71 69 } 72 70 73 void handleDownloadRequest(DownloadProxy*);74 71 void init(); 75 72 76 73 void showContextMenu(QSharedPointer<QMenu>); 77 74 void hideContextMenu(); 78 79 public Q_SLOTS:80 void didReceiveDownloadResponse(QWebDownloadItem* downloadItem);81 75 82 76 public:
Note: See TracChangeset
for help on using the changeset viewer.