[WK2][EFL] creating dummy class derived from ResourceHandleClient for Efl download...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 06:12:47 +0000 (06:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 06:12:47 +0000 (06:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76171

Patch by Keunsoon Lee <keunsoon.lee@samsung.com> 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<FileDownloaderEfl>.
(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<FileDownloaderEfl>.
(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
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/WebProcess/Downloads/Download.h
Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp
Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h [new file with mode: 0644]

index af850d1..35d30bb 100644 (file)
@@ -1,3 +1,54 @@
+2012-02-08  Keunsoon Lee  <keunsoon.lee@samsung.com>
+
+        [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<FileDownloaderEfl>.
+        (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<FileDownloaderEfl>.
+        (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  <morrita@google.com>
 
         Replacement text should be available from the marker.
index 1591dfb..ef5f395 100644 (file)
@@ -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}
index 0387efa..2688b72 100644 (file)
@@ -47,6 +47,10 @@ OBJC_CLASS WKDownloadAsDelegate;
 #include <CFNetwork/CFURLDownloadPriv.h>
 #endif
 
+#if PLATFORM(EFL)
+#include <FileDownloaderEfl.h>
+#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<Download> {
     WTF_MAKE_NONCOPYABLE(Download);
 public:
@@ -146,6 +154,9 @@ private:
     OwnPtr<WebCore::ResourceHandleClient> m_downloadClient;
     RefPtr<WebCore::ResourceHandle> m_resourceHandle;
 #endif
+#if PLATFORM(EFL)
+    OwnPtr<FileDownloaderEfl> m_fileDownloader;
+#endif
 };
 
 } // namespace WebKit
index 7d098f1..9828c2b 100755 (executable)
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "Download.h"
 
+#include "FileDownloaderEfl.h"
 #include <WebCore/NotImplemented.h>
 
 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 (file)
index 0000000..8f17840
--- /dev/null
@@ -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 <WebCore/NotImplemented.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassOwnPtr<FileDownloaderEfl> 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 (file)
index 0000000..d8f998b
--- /dev/null
@@ -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 <WebCore/ResourceError.h>
+#include <WebCore/ResourceHandle.h>
+#include <WebCore/ResourceHandleClient.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/ResourceResponse.h>
+#include <wtf/PassOwnPtr.h>
+
+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<FileDownloaderEfl> 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