From 611984b68a97a4dac1b9f0cc5c7f7e4be83dc12f Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Thu, 9 Feb 2012 06:12:47 +0000 Subject: [PATCH] [WK2][EFL] creating dummy class derived from ResourceHandleClient for Efl download module. https://bugs.webkit.org/show_bug.cgi?id=76171 Patch by Keunsoon Lee on 2012-02-08 Reviewed by Andreas Kling. FileDownloaderEfl is a practical class to operate file download. It communicates with Download class to start download and to notify downloading states to user(e.g. client application). Besides FileDownloaderEfl derives from ResourceHandleClient and receives chunked data from ResourceHandle directly or redirects data flow which is started from MainResourceLoader by mean of exchanging ResourceHandle's existing client for FileDownloaderEfl. This patch has only dummy functions to make easy to review. Working patch will be uploaded on another bug thread. * PlatformEfl.cmake: added new file to compile. * WebProcess/Downloads/Download.h: added FileDownloaderEfl's instance as a form of OwnPtr. (WebKit): (Download): * WebProcess/Downloads/efl/DownloadEfl.cpp: (WebKit::Download::start): calling to FileDownloaderEfl::start() to start download for passing ResourceRequest. * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Added. a practical class to operate file download. (WebKit): (WebKit::FileDownloaderEfl::create): create function, which returns PassOwnPtr. (WebKit::FileDownloaderEfl::FileDownloaderEfl): constructor, which receives Download* as a parameter. (WebKit::FileDownloaderEfl::~FileDownloaderEfl): deconstructor. (WebKit::FileDownloaderEfl::start): a function to start downloading for passed ResourceRequest. It does nothing for now, but shows how Download class can call FileDownloaderEfl's function. (WebKit::FileDownloaderEfl::didReceiveResponse): virtual function for ResourceHandleClient. It will receive response header information from ResourceHandle. (WebKit::FileDownloaderEfl::didReceiveData): virtual function for ResourceHandleClient. It will receive chunk data from ResourceHandle. (WebKit::FileDownloaderEfl::didFinishLoading): virtual function for ResourceHandleClient. It will be notified loading is finished from ResourceHandle. (WebKit::FileDownloaderEfl::didFail): virtual function for ResourceHandleClient. It will be notified loading is fail with ResourceError from ResourceHandle. (WebKit::FileDownloaderEfl::shouldUseCredentialStorage): virtual function for ResourceHandleClient. It returns whether to use credential storage or not. (WebKit::FileDownloaderEfl::didReceiveAuthenticationChallenge): virtual function for ResourceHandleClient. It will receive AuthenticationChallenge. (WebKit::FileDownloaderEfl::didCancelAuthenticationChallenge): virtual function for ResourceHandleClient. It will be notified AuthenticationChallenge is canceled. (WebKit::FileDownloaderEfl::receivedCancellation): virtual function for ResourceHandleClient. * WebProcess/Downloads/efl/FileDownloaderEfl.h: Added. (WebCore): (WebKit): (FileDownloaderEfl): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107180 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 51 +++++++++++++ Source/WebKit2/PlatformEfl.cmake | 2 + Source/WebKit2/WebProcess/Downloads/Download.h | 11 +++ .../WebProcess/Downloads/efl/DownloadEfl.cpp | 4 +- .../WebProcess/Downloads/efl/FileDownloaderEfl.cpp | 89 ++++++++++++++++++++++ .../WebProcess/Downloads/efl/FileDownloaderEfl.h | 69 +++++++++++++++++ 6 files changed, 225 insertions(+), 1 deletion(-) create mode 100644 Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp create mode 100644 Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index af850d1..35d30bb 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,54 @@ +2012-02-08 Keunsoon Lee + + [WK2][EFL] creating dummy class derived from ResourceHandleClient for Efl download module. + https://bugs.webkit.org/show_bug.cgi?id=76171 + + Reviewed by Andreas Kling. + + FileDownloaderEfl is a practical class to operate file download. + It communicates with Download class to start download + and to notify downloading states to user(e.g. client application). + Besides FileDownloaderEfl derives from ResourceHandleClient + and receives chunked data from ResourceHandle directly + or redirects data flow which is started from MainResourceLoader + by mean of exchanging ResourceHandle's existing client for FileDownloaderEfl. + + This patch has only dummy functions to make easy to review. + Working patch will be uploaded on another bug thread. + + * PlatformEfl.cmake: added new file to compile. + * WebProcess/Downloads/Download.h: added FileDownloaderEfl's instance as a form of OwnPtr. + (WebKit): + (Download): + * WebProcess/Downloads/efl/DownloadEfl.cpp: + (WebKit::Download::start): calling to FileDownloaderEfl::start() to start download for passing ResourceRequest. + * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Added. a practical class to operate file download. + (WebKit): + (WebKit::FileDownloaderEfl::create): create function, which returns PassOwnPtr. + (WebKit::FileDownloaderEfl::FileDownloaderEfl): constructor, which receives Download* as a parameter. + (WebKit::FileDownloaderEfl::~FileDownloaderEfl): deconstructor. + (WebKit::FileDownloaderEfl::start): a function to start downloading for passed ResourceRequest. + It does nothing for now, but shows how Download class can call FileDownloaderEfl's function. + (WebKit::FileDownloaderEfl::didReceiveResponse): virtual function for ResourceHandleClient. + It will receive response header information from ResourceHandle. + (WebKit::FileDownloaderEfl::didReceiveData): virtual function for ResourceHandleClient. + It will receive chunk data from ResourceHandle. + (WebKit::FileDownloaderEfl::didFinishLoading): virtual function for ResourceHandleClient. + It will be notified loading is finished from ResourceHandle. + (WebKit::FileDownloaderEfl::didFail): virtual function for ResourceHandleClient. + It will be notified loading is fail with ResourceError from ResourceHandle. + (WebKit::FileDownloaderEfl::shouldUseCredentialStorage): virtual function for ResourceHandleClient. + It returns whether to use credential storage or not. + (WebKit::FileDownloaderEfl::didReceiveAuthenticationChallenge): virtual function for ResourceHandleClient. + It will receive AuthenticationChallenge. + (WebKit::FileDownloaderEfl::didCancelAuthenticationChallenge): virtual function for ResourceHandleClient. + It will be notified AuthenticationChallenge is canceled. + (WebKit::FileDownloaderEfl::receivedCancellation): virtual function for ResourceHandleClient. + * WebProcess/Downloads/efl/FileDownloaderEfl.h: Added. + (WebCore): + (WebKit): + (FileDownloaderEfl): + 2012-02-07 MORITA Hajime Replacement text should be available from the marker. diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 1591dfb..ef5f395 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -45,6 +45,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/Plugins/efl/PluginProcessProxyEfl.cpp WebProcess/Downloads/efl/DownloadEfl.cpp + WebProcess/Downloads/efl/FileDownloaderEfl.cpp WebProcess/efl/WebProcessEfl.cpp WebProcess/efl/WebProcessMainEfl.cpp @@ -65,6 +66,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBKIT2_DIR}/Shared/efl" "${WEBKIT2_DIR}/UIProcess/API/efl/" + "${WEBKIT2_DIR}/WebProcess/Downloads/efl" "${WEBKIT2_DIR}/WebProcess/efl" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" ${Cairo_INCLUDE_DIRS} diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h index 0387efa..2688b72 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.h +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -47,6 +47,10 @@ OBJC_CLASS WKDownloadAsDelegate; #include #endif +#if PLATFORM(EFL) +#include +#endif + namespace CoreIPC { class DataReference; } @@ -69,6 +73,10 @@ class WebPage; class QtFileDownloader; #endif +#if PLATFORM(EFL) +class FileDownloaderEfl; +#endif + class Download : public CoreIPC::MessageSender { WTF_MAKE_NONCOPYABLE(Download); public: @@ -146,6 +154,9 @@ private: OwnPtr m_downloadClient; RefPtr m_resourceHandle; #endif +#if PLATFORM(EFL) + OwnPtr m_fileDownloader; +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp index 7d098f1..9828c2b 100755 --- a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp +++ b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "Download.h" +#include "FileDownloaderEfl.h" #include using namespace WebCore; @@ -28,7 +29,8 @@ namespace WebKit { void Download::start(WebPage* initiatingWebPage) { - notImplemented(); + m_fileDownloader = FileDownloaderEfl::create(this); + m_fileDownloader->start(initiatingWebPage, m_request); } void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceResponse& response) diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp new file mode 100644 index 0000000..8f17840 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "FileDownloaderEfl.h" + +#include + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr FileDownloaderEfl::create(Download* download) +{ + return adoptPtr(new FileDownloaderEfl(download)); +} + +FileDownloaderEfl::FileDownloaderEfl(Download* download) + : m_download(download) +{ + ASSERT(download); +} + +FileDownloaderEfl::~FileDownloaderEfl() +{ +} + +void FileDownloaderEfl::start(WebPage*, ResourceRequest&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didReceiveResponse(ResourceHandle*, const ResourceResponse&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didReceiveData(ResourceHandle*, const char*, int, int) +{ + notImplemented(); +} + +void FileDownloaderEfl::didFinishLoading(ResourceHandle*, double) +{ + notImplemented(); +} + +void FileDownloaderEfl::didFail(ResourceHandle*, const ResourceError&) +{ + notImplemented(); +} + +bool FileDownloaderEfl::shouldUseCredentialStorage(ResourceHandle*) +{ + return false; +} + +void FileDownloaderEfl::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FileDownloaderEfl::receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h new file mode 100644 index 0000000..d8f998b --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef FileDownloaderEfl_h +#define FileDownloaderEfl_h + +#include +#include +#include +#include +#include +#include + +namespace WebCore { +class AuthenticationChallenge; +class ResourceError; +class ResourceHandle; +class ResourceHandleClient; +class ResourceRequest; +class ResourceResponse; +} + +namespace WebKit { + +class Download; +class WebPage; + +class FileDownloaderEfl : public WebCore::ResourceHandleClient { +public: + static PassOwnPtr create(Download*); + virtual ~FileDownloaderEfl(); + + void start(WebPage*, WebCore::ResourceRequest&); + + // callbacks for ResourceHandleClient, which are called by ResourceHandle + virtual void didReceiveResponse(WebCore::ResourceHandle*, const WebCore::ResourceResponse&) OVERRIDE; + virtual void didReceiveData(WebCore::ResourceHandle*, const char* data, int length, int encodedDataLength) OVERRIDE; + virtual void didFinishLoading(WebCore::ResourceHandle*, double finishTime) OVERRIDE; + virtual void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) OVERRIDE; + virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE; + virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + +private: + FileDownloaderEfl(Download*); + + Download* m_download; +}; + +} // namespace WebKit + +#endif // FileDownloaderEfl_h -- 2.7.4