Title: [123019] trunk/Source/WebKit2
Revision
123019
Author
commit-qu...@webkit.org
Date
2012-07-18 14:31:34 -0700 (Wed, 18 Jul 2012)

Log Message

[EFL][WK2] EFL should use DownloadSoup instead of defining DownloadEfl
https://bugs.webkit.org/show_bug.cgi?id=91602

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-07-18
Reviewed by Kenneth Rohde Christiansen.

Reuse WebProcess/Downloads/soup/DownloadSoup.cpp in EFL port
instead of redefining our own DownloadEfl.cpp. The EFL port
is also using libsoup so it is best to avoid code duplication.

* GNUmakefile.am:
* GNUmakefile.list.am:
* PlatformEfl.cmake:
* WebProcess/Downloads/Download.h:
(WebKit):
(Download):
* WebProcess/Downloads/efl/DownloadEfl.cpp: Removed.
* WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp: Added.
(WebKit):
(WebKit::platformDownloadNetworkError):
(WebKit::platformDownloadDestinationError):
* WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Removed.
* WebProcess/Downloads/efl/FileDownloaderEfl.h: Removed.
* WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp: Added.
(WebKit):
(WebKit::platformDownloadNetworkError):
(WebKit::platformDownloadDestinationError):
* WebProcess/Downloads/soup/DownloadSoup.cpp: Make the code
compile for other ports than GTK.
(WebKit::DownloadClient::didReceiveResponse):
(WebKit::DownloadClient::didReceiveData):
(WebKit::DownloadClient::didFail):
(WebKit::Download::continueWithoutCredential):
(WebKit):
(WebKit::Download::useCredential):
(WebKit::Download::cancelAuthenticationChallenge):
* WebProcess/Downloads/soup/DownloadSoupErrors.h: Added.
(WebKit):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (123018 => 123019)


--- trunk/Source/WebKit2/ChangeLog	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-18 21:31:34 UTC (rev 123019)
@@ -1,5 +1,45 @@
 2012-07-18  Christophe Dumez  <christophe.du...@intel.com>
 
+        [EFL][WK2] EFL should use DownloadSoup instead of defining DownloadEfl
+        https://bugs.webkit.org/show_bug.cgi?id=91602
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Reuse WebProcess/Downloads/soup/DownloadSoup.cpp in EFL port
+        instead of redefining our own DownloadEfl.cpp. The EFL port
+        is also using libsoup so it is best to avoid code duplication.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * PlatformEfl.cmake:
+        * WebProcess/Downloads/Download.h:
+        (WebKit):
+        (Download):
+        * WebProcess/Downloads/efl/DownloadEfl.cpp: Removed.
+        * WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp: Added.
+        (WebKit):
+        (WebKit::platformDownloadNetworkError):
+        (WebKit::platformDownloadDestinationError):
+        * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Removed.
+        * WebProcess/Downloads/efl/FileDownloaderEfl.h: Removed.
+        * WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp: Added.
+        (WebKit):
+        (WebKit::platformDownloadNetworkError):
+        (WebKit::platformDownloadDestinationError):
+        * WebProcess/Downloads/soup/DownloadSoup.cpp: Make the code
+        compile for other ports than GTK.
+        (WebKit::DownloadClient::didReceiveResponse):
+        (WebKit::DownloadClient::didReceiveData):
+        (WebKit::DownloadClient::didFail):
+        (WebKit::Download::continueWithoutCredential):
+        (WebKit):
+        (WebKit::Download::useCredential):
+        (WebKit::Download::cancelAuthenticationChallenge):
+        * WebProcess/Downloads/soup/DownloadSoupErrors.h: Added.
+        (WebKit):
+
+2012-07-18  Christophe Dumez  <christophe.du...@intel.com>
+
         [WK2] Add C API for Network Information API
         https://bugs.webkit.org/show_bug.cgi?id=90762
 

Modified: trunk/Source/WebKit2/GNUmakefile.am (123018 => 123019)


--- trunk/Source/WebKit2/GNUmakefile.am	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/GNUmakefile.am	2012-07-18 21:31:34 UTC (rev 123019)
@@ -63,6 +63,7 @@
 	-I$(srcdir)/Source/WebKit2/WebProcess/Battery \
 	-I$(srcdir)/Source/WebKit2/WebProcess/Cookies \
 	-I$(srcdir)/Source/WebKit2/WebProcess/Downloads \
+	-I$(srcdir)/Source/WebKit2/WebProcess/Downloads/soup \
 	-I$(srcdir)/Source/WebKit2/WebProcess/FullScreen \
 	-I$(srcdir)/Source/WebKit2/WebProcess/Geolocation \
 	-I$(srcdir)/Source/WebKit2/WebProcess/gtk \

Modified: trunk/Source/WebKit2/GNUmakefile.list.am (123018 => 123019)


--- trunk/Source/WebKit2/GNUmakefile.list.am	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/GNUmakefile.list.am	2012-07-18 21:31:34 UTC (rev 123019)
@@ -929,7 +929,9 @@
 	Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \
 	Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp \
 	Source/WebKit2/WebProcess/Downloads/DownloadManager.h \
+	Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp \
 	Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp \
+	Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h \
 	Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp \
 	Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h \
 	Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123018 => 123019)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2012-07-18 21:31:34 UTC (rev 123019)
@@ -71,8 +71,8 @@
     WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
     WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp
 
-    WebProcess/Downloads/efl/DownloadEfl.cpp
-    WebProcess/Downloads/efl/FileDownloaderEfl.cpp
+    WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp
+    WebProcess/Downloads/soup/DownloadSoup.cpp
 
     WebProcess/efl/WebProcessEfl.cpp
     WebProcess/efl/WebProcessMainEfl.cpp
@@ -109,7 +109,7 @@
     "${WEBKIT2_DIR}/UIProcess/API/C/soup"
     "${WEBKIT2_DIR}/UIProcess/API/efl"
     "${WEBKIT2_DIR}/UIProcess/soup"
-    "${WEBKIT2_DIR}/WebProcess/Downloads/efl"
+    "${WEBKIT2_DIR}/WebProcess/Downloads/soup"
     "${WEBKIT2_DIR}/WebProcess/efl"
     "${WEBKIT2_DIR}/WebProcess/soup"
     "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl"

Modified: trunk/Source/WebKit2/WebProcess/Downloads/Download.h (123018 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/Download.h	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/WebProcess/Downloads/Download.h	2012-07-18 21:31:34 UTC (rev 123019)
@@ -38,7 +38,7 @@
 OBJC_CLASS WKDownloadAsDelegate;
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(EFL)
 #include <WebCore/ResourceHandle.h>
 #include <WebCore/ResourceHandleClient.h>
 #endif
@@ -47,10 +47,6 @@
 #include <CFNetwork/CFURLDownloadPriv.h>
 #endif
 
-#if PLATFORM(EFL)
-#include <FileDownloaderEfl.h>
-#endif
-
 namespace CoreIPC {
     class DataReference;
 }
@@ -73,10 +69,6 @@
 class QtFileDownloader;
 #endif
 
-#if PLATFORM(EFL)
-class FileDownloaderEfl;
-#endif
-
 class Download : public CoreIPC::MessageSender<Download> {
     WTF_MAKE_NONCOPYABLE(Download);
 public:
@@ -150,13 +142,10 @@
 #if PLATFORM(QT)
     QtFileDownloader* m_qtDownloader;
 #endif
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(EFL)
     OwnPtr<WebCore::ResourceHandleClient> m_downloadClient;
     RefPtr<WebCore::ResourceHandle> m_resourceHandle;
 #endif
-#if PLATFORM(EFL)
-    OwnPtr<FileDownloaderEfl> m_fileDownloader;
-#endif
 };
 
 } // namespace WebKit

Deleted: trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp (123018 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp	2012-07-18 21:31:34 UTC (rev 123019)
@@ -1,91 +0,0 @@
-/*
- * 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 "Download.h"
-
-#include "FileDownloaderEfl.h"
-#include <WebCore/NotImplemented.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void Download::start(WebPage* initiatingWebPage)
-{
-    m_fileDownloader = FileDownloaderEfl::create(this);
-    m_fileDownloader->start(initiatingWebPage, m_request);
-}
-
-void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceResponse& response)
-{
-    notImplemented();
-}
-
-void Download::cancel()
-{
-    notImplemented();
-}
-
-void Download::platformInvalidate()
-{
-    notImplemented();
-}
-
-void Download::didDecideDestination(const String& destination, bool allowOverwrite)
-{
-    notImplemented();
-}
-
-void Download::platformDidFinish()
-{
-    notImplemented();
-}
-
-void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
-{
-    notImplemented();
-}
-
-void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
-{
-    notImplemented();
-}
-
-void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
-{
-    notImplemented();
-}
-
-void Download::useCredential(const WebCore::AuthenticationChallenge& authenticationChallenge, const WebCore::Credential& credential)
-{
-    notImplemented();
-}
-
-void Download::continueWithoutCredential(const WebCore::AuthenticationChallenge& authenticationChallenge)
-{
-    notImplemented();
-}
-
-void Download::cancelAuthenticationChallenge(const WebCore::AuthenticationChallenge& authenticationChallenge)
-{
-    notImplemented();
-}
-
-} // namespace WebKit

Added: trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp (0 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp	2012-07-18 21:31:34 UTC (rev 123019)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DownloadSoupErrors.h"
+
+#include <WebCore/ErrorsEfl.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription)
+{
+    return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription));
+}
+
+ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message)
+{
+    return downloadDestinationError(response, message);
+}
+
+} // namespace WebKit

Deleted: trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp (123018 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp	2012-07-18 21:31:34 UTC (rev 123019)
@@ -1,89 +0,0 @@
-/*
- * 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

Deleted: trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h (123018 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h	2012-07-18 21:31:34 UTC (rev 123019)
@@ -1,69 +0,0 @@
-/*
- * 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

Added: trunk/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp (0 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp	2012-07-18 21:31:34 UTC (rev 123019)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DownloadSoupErrors.h"
+
+#include <WebCore/ErrorsGtk.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription)
+{
+    return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription));
+}
+
+ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message)
+{
+    return downloadDestinationError(response, message);
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp (123018 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp	2012-07-18 21:28:05 UTC (rev 123018)
+++ trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp	2012-07-18 21:31:34 UTC (rev 123019)
@@ -28,15 +28,18 @@
 #include "Download.h"
 
 #include "DataReference.h"
-#include <WebCore/ErrorsGtk.h>
+#include "DownloadSoupErrors.h"
 #include <WebCore/NotImplemented.h>
 #include <WebCore/ResourceHandleInternal.h>
 #include <gio/gio.h>
-#include <glib/gi18n-lib.h>
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/gobject/GRefPtr.h>
 #include <wtf/text/CString.h>
 
+#if PLATFORM(GTK)
+#include <glib/gi18n-lib.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -60,8 +63,7 @@
         m_download->didReceiveResponse(response);
 
         if (response.httpStatusCode() >= 400) {
-            downloadFailed(downloadNetworkError(ResourceError(errorDomainDownload, response.httpStatusCode(),
-                                                              response.url().string(), response.httpStatusText())));
+            downloadFailed(platformDownloadNetworkError(response.httpStatusCode(), response.url().string(), response.httpStatusText()));
             return;
         }
 
@@ -76,9 +78,13 @@
         bool overwrite;
         String destinationURI = m_download->decideDestinationWithSuggestedFilename(suggestedFilename.utf8().data(), overwrite);
         if (destinationURI.isEmpty()) {
-            GOwnPtr<char> errorMessage(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"),
-                                                       suggestedFilename.utf8().data()));
-            downloadFailed(downloadDestinationError(response, errorMessage.get()));
+#if PLATFORM(GTK)
+            GOwnPtr<char> buffer(g_strdup_printf(_("Cannot determine destination URI for download with suggested filename %s"), suggestedFilename.utf8().data()));
+            String errorMessage = String::fromUTF8(buffer.get());
+#else
+            String errorMessage = makeString("Cannot determine destination URI for download with suggested filename ", suggestedFilename);
+#endif
+            downloadFailed(platformDownloadDestinationError(response, errorMessage));
             return;
         }
 
@@ -86,7 +92,7 @@
         GOwnPtr<GError> error;
         m_outputStream = adoptGRef(g_file_replace(file.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr()));
         if (!m_outputStream) {
-            downloadFailed(downloadDestinationError(response, error->message));
+            downloadFailed(platformDownloadDestinationError(response, error->message));
             return;
         }
 
@@ -99,7 +105,7 @@
         GOwnPtr<GError> error;
         g_output_stream_write_all(G_OUTPUT_STREAM(m_outputStream.get()), data, length, &bytesWritten, 0, &error.outPtr());
         if (error) {
-            downloadFailed(downloadDestinationError(ResourceResponse(m_response.get()), error->message));
+            downloadFailed(platformDownloadDestinationError(ResourceResponse(m_response.get()), error->message));
             return;
         }
         m_download->didReceiveData(bytesWritten);
@@ -113,7 +119,7 @@
 
     void didFail(ResourceHandle*, const ResourceError& error)
     {
-        downloadFailed(downloadNetworkError(error));
+        downloadFailed(platformDownloadNetworkError(error.errorCode(), error.failingURL(), error.localizedDescription()));
     }
 
     void wasBlocked(ResourceHandle*)
@@ -198,4 +204,19 @@
     notImplemented();
 }
 
+void Download::continueWithoutCredential(const AuthenticationChallenge &)
+{
+    notImplemented();
+}
+
+void Download::useCredential(const AuthenticationChallenge&, const Credential&)
+{
+    notImplemented();
+}
+
+void Download::cancelAuthenticationChallenge(const AuthenticationChallenge&)
+{
+    notImplemented();
+}
+
 } // namespace WebKit

Added: trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h (0 => 123019)


--- trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoupErrors.h	2012-07-18 21:31:34 UTC (rev 123019)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DownloadSoupErrors_h
+#define DownloadSoupErrors_h
+
+#include <WebCore/ResourceHandle.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+WebCore::ResourceError platformDownloadNetworkError(int errorCode, const String& failingURL, const String& localizedDescription);
+WebCore::ResourceError platformDownloadDestinationError(const WebCore::ResourceResponse&, const String& message);
+
+} // namespace WebKit
+
+#endif // DownloadSoupErrors_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to