Changeset 95631 in webkit
- Timestamp:
- Sep 21, 2011 8:10:43 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95621 r95631 1 2011-09-21 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 3 [Qt][WK2] Implement Download support in WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=68153 5 6 Reviewed by Andreas Kling. 7 8 Refactored QNetworkReplyHandler::finish() in order to add 9 and use the static function QNetworkReplyHandler::errorForReply(). 10 This will be used by our Download implementation in WebKit2 (WebProcess) 11 when handling ResourceError. 12 13 * platform/network/qt/QNetworkReplyHandler.cpp: 14 (WebCore::QNetworkReplyHandler::finish): 15 (WebCore::QNetworkReplyHandler::errorForReply): 16 * platform/network/qt/QNetworkReplyHandler.h: 17 * platform/network/qt/ResourceRequest.h: 18 1 19 2011-09-21 Pavel Feldman <pfeldman@google.com> 2 20 -
trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
r91189 r95631 456 456 if (!m_replyWrapper->reply()->error() || shouldIgnoreHttpError(m_replyWrapper->reply(), m_replyWrapper->responseContainsData())) 457 457 client->didFinishLoading(m_resourceHandle, 0); 458 else { 459 QUrl url = m_replyWrapper->reply()->url(); 460 int httpStatusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); 461 462 if (httpStatusCode) { 463 ResourceError error("HTTP", httpStatusCode, url.toString(), m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()); 464 client->didFail(m_resourceHandle, error); 465 } else { 466 ResourceError error("QtNetwork", m_replyWrapper->reply()->error(), url.toString(), m_replyWrapper->reply()->errorString()); 467 client->didFail(m_resourceHandle, error); 468 } 469 } 458 else 459 client->didFail(m_resourceHandle, errorForReply(m_replyWrapper->reply())); 470 460 471 461 m_replyWrapper = nullptr; … … 695 685 } 696 686 687 ResourceError QNetworkReplyHandler::errorForReply(QNetworkReply* reply) 688 { 689 QUrl url = reply->url(); 690 int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); 691 692 if (httpStatusCode) 693 return ResourceError("HTTP", httpStatusCode, url.toString(), reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()); 694 695 return ResourceError("QtNetwork", reply->error(), url.toString(), reply->errorString()); 696 } 697 697 698 } 698 699 -
trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h
r91189 r95631 37 37 38 38 class FormDataIODevice; 39 class ResourceError; 39 40 class ResourceHandle; 40 41 class ResourceRequest; … … 134 135 void sendResponseIfNeeded(); 135 136 137 static ResourceError errorForReply(QNetworkReply*); 138 136 139 private slots: 137 140 void uploadProgress(qint64 bytesSent, qint64 bytesTotal); -
trunk/Source/WebCore/platform/network/qt/ResourceRequest.h
r68762 r95631 60 60 } 61 61 62 QNetworkRequest toNetworkRequest(QObject* originatingObject ) const;62 QNetworkRequest toNetworkRequest(QObject* originatingObject = 0) const; 63 63 64 64 private: -
trunk/Source/WebKit2/ChangeLog
r95607 r95631 1 2011-09-21 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 3 [Qt][WK2] Implement Download support in WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=68153 5 6 Reviewed by Andreas Kling. 7 8 We implement the necessary functions of Download.h, and our QtFileDownloader 9 to handle all network communication and call the necessary functions of Download. 10 11 We use the download policy for any MIME type not supported by WebKit. This 12 behaves like Qt non-WebKit2 except that we don't force download when 13 we encounter Content-Disposition: attachment. We still use the "filename=" 14 field for file name suggestion though. 15 16 Based on original patches by: Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>, 17 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Simon Hausmann <simon.hausmann@nokia.com> 18 and Zalan Bujtas <zalan.bujtas@nokia.com>. 19 20 * UIProcess/API/qt/qweberror.cpp: Adding DownloadError 21 (QWebError::type): 22 * UIProcess/API/qt/qweberror.h: Adding DownloadError 23 * WebKit2.pro: 24 * WebProcess/Downloads/Download.cpp: Adding QtFileDownloader, Qt platform specific 25 (WebKit::Download::Download): 26 * WebProcess/Downloads/Download.h: Adding QtFileDownloader, Qt platform specific 27 * WebProcess/Downloads/qt/DownloadQt.cpp: 28 (WebKit::Download::start): 29 (WebKit::Download::startWithHandle): 30 (WebKit::Download::cancel): 31 (WebKit::Download::platformInvalidate): 32 (WebKit::Download::didDecideDestination): 33 * WebProcess/Downloads/qt/QtFileDownloader.cpp: Added. 34 (WebKit::QtFileDownloader::QtFileDownloader): 35 (WebKit::QtFileDownloader::~QtFileDownloader): 36 (WebKit::QtFileDownloader::determineFilename): 37 (WebKit::QtFileDownloader::decidedDestination): 38 (WebKit::QtFileDownloader::abortDownloadWritingAndEmitError): 39 (WebKit::QtFileDownloader::onReadyRead): 40 (WebKit::QtFileDownloader::onFinished): 41 (WebKit::QtFileDownloader::onError): 42 (WebKit::QtFileDownloader::cancel): 43 * WebProcess/Downloads/qt/QtFileDownloader.h: Added. 44 1 45 2011-09-21 Mark Rowe <mrowe@apple.com> 2 46 -
trunk/Source/WebKit2/UIProcess/API/qt/qweberror.cpp
r90820 r95631 66 66 if (errorDomain == "HTTP") 67 67 return QWebError::HttpError; 68 if (errorDomain == "Download") 69 return QWebError::DownloadError; 68 70 // FIXME: Redirection overflow currently puts the URL hostname in the errorDomain field. 69 71 // We should expose that error somehow. Source is QNetworkReplyHandler::redirect(). -
trunk/Source/WebKit2/UIProcess/API/qt/qweberror.h
r95492 r95631 37 37 EngineError, 38 38 NetworkError, 39 HttpError 39 HttpError, 40 DownloadError 40 41 }; 41 42 -
trunk/Source/WebKit2/WebKit2.pro
r95551 r95631 272 272 WebProcess/Downloads/Download.h \ 273 273 WebProcess/Downloads/DownloadManager.h \ 274 WebProcess/Downloads/qt/QtFileDownloader.h \ 274 275 WebProcess/FullScreen/WebFullScreenManager.h \ 275 276 WebProcess/FullScreen/qt/WebFullScreenManagerQt.h \ … … 514 515 WebProcess/Downloads/DownloadManager.cpp \ 515 516 WebProcess/Downloads/qt/DownloadQt.cpp \ 517 WebProcess/Downloads/qt/QtFileDownloader.cpp \ 516 518 WebProcess/FullScreen/WebFullScreenManager.cpp \ 517 519 WebProcess/FullScreen/qt/WebFullScreenManagerQt.cpp \ … … 525 527 WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp \ 526 528 WebProcess/InjectedBundle/InjectedBundleClient.cpp \ 527 WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ 529 WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ 528 530 WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ 529 531 WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ -
trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp
r84610 r95631 51 51 #if USE(CFNETWORK) 52 52 , m_allowOverwrite(false) 53 #endif 54 #if PLATFORM(QT) 55 , m_qtDownloader(0) 53 56 #endif 54 57 { -
trunk/Source/WebKit2/WebProcess/Downloads/Download.h
r84610 r95631 60 60 class SandboxExtension; 61 61 class WebPage; 62 63 #if PLATFORM(QT) 64 class QtFileDownloader; 65 #endif 62 66 63 67 class Download : public CoreIPC::MessageSender<Download> { … … 127 131 RefPtr<DownloadAuthenticationClient> m_authenticationClient; 128 132 #endif 133 #if PLATFORM(QT) 134 QtFileDownloader* m_qtDownloader; 135 #endif 129 136 }; 130 137 -
trunk/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
r82364 r95631 1 1 /* 2 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 27 28 #include "Download.h" 28 29 30 #include "QtFileDownloader.h" 31 #include "WebProcess.h" 29 32 #include <WebCore/NotImplemented.h> 33 #include <WebCore/QNetworkReplyHandler.h> 34 #include <WebCore/ResourceHandle.h> 35 #include <WebCore/ResourceHandleInternal.h> 36 #include <WebCore/ResourceResponse.h> 30 37 31 38 using namespace WebCore; … … 35 42 void Download::start(WebPage* initiatingWebPage) 36 43 { 37 notImplemented(); 44 QNetworkAccessManager* manager = WebProcess::shared().networkAccessManager(); 45 ASSERT(manager); 46 ASSERT(!m_qtDownloader); 47 48 m_qtDownloader = new QtFileDownloader(this, adoptPtr(manager->get(m_request.toNetworkRequest()))); 38 49 } 39 50 40 void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* , const ResourceRequest& initialRequest, const ResourceResponse&)51 void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& resp) 41 52 { 42 notImplemented(); 53 ASSERT(!m_qtDownloader); 54 m_qtDownloader = new QtFileDownloader(this, adoptPtr(handle->getInternal()->m_job->release())); 43 55 } 44 56 45 57 void Download::cancel() 46 58 { 47 notImplemented(); 59 ASSERT(m_qtDownloader); 60 m_qtDownloader->cancel(); 48 61 } 49 62 50 63 void Download::platformInvalidate() 51 64 { 52 notImplemented(); 65 ASSERT(m_qtDownloader); 66 m_qtDownloader->deleteLater(); 67 m_qtDownloader = 0; 53 68 } 54 69 55 70 void Download::didDecideDestination(const String& destination, bool allowOverwrite) 56 71 { 57 notImplemented();72 m_qtDownloader->decidedDestination(destination, allowOverwrite); 58 73 } 59 74
Note: See TracChangeset
for help on using the changeset viewer.