[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 15:52:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4e9b35026507f8aa09b6e6b3ef7cd9be40d41f1e
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 15 20:46:39 2010 +0000

    Add shouldDecodeSourceDataOfMIMEType WKContextDownloadClient callback
    https://bugs.webkit.org/show_bug.cgi?id=49558
    
    Reviewed by Sam Weinig.
    
    * UIProcess/API/C/WKContext.h:
    Add shouldDecodeSourceDataOfMIMEType callback.
    
    * UIProcess/Downloads/DownloadProxy.cpp:
    (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
    Call WebDownloadClient::shouldDecodeSourceDataOfMIMEType.
    
    (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
    Add allowOverwrite out parameter.
    
    * UIProcess/Downloads/DownloadProxy.h:
    * UIProcess/Downloads/DownloadProxy.messages.in:
    Add ShouldDecodeSourceDataOfMIMEType message.
    
    * UIProcess/WebDownloadClient.cpp:
    (WebKit::WebDownloadClient::shouldDecodeSourceDataOfMIMEType):
    Call the WKContextDownloadClient.
    
    (WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename):
    Add allowOverwrite out parameter.
    
    * UIProcess/WebDownloadClient.h:
    * WebProcess/Downloads/Download.cpp:
    (WebKit::Download::shouldDecodeSourceDataOfMIMEType):
    Send the ShouldDecodeSourceDataOfMIMEType message.
    
    (WebKit::Download::decideDestinationWithSuggestedFilename):
    Add allowOverwrite reply parameter.
    
    * WebProcess/Downloads/mac/DownloadMac.mm:
    (-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]):
    Call Download::shouldDecodeSourceDataOfMIMEType.
    
    (-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]):
    Add allowOverwrite parameter.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72023 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 637ec84..37c2052 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,49 @@
 
         Reviewed by Sam Weinig.
 
+        Add shouldDecodeSourceDataOfMIMEType WKContextDownloadClient callback
+        https://bugs.webkit.org/show_bug.cgi?id=49558
+
+        * UIProcess/API/C/WKContext.h:
+        Add shouldDecodeSourceDataOfMIMEType callback.
+
+        * UIProcess/Downloads/DownloadProxy.cpp:
+        (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
+        Call WebDownloadClient::shouldDecodeSourceDataOfMIMEType.
+
+        (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
+        Add allowOverwrite out parameter.
+
+        * UIProcess/Downloads/DownloadProxy.h:
+        * UIProcess/Downloads/DownloadProxy.messages.in:
+        Add ShouldDecodeSourceDataOfMIMEType message.
+
+        * UIProcess/WebDownloadClient.cpp:
+        (WebKit::WebDownloadClient::shouldDecodeSourceDataOfMIMEType):
+        Call the WKContextDownloadClient.
+
+        (WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename):
+        Add allowOverwrite out parameter.
+
+        * UIProcess/WebDownloadClient.h:
+        * WebProcess/Downloads/Download.cpp:
+        (WebKit::Download::shouldDecodeSourceDataOfMIMEType):
+        Send the ShouldDecodeSourceDataOfMIMEType message.
+
+        (WebKit::Download::decideDestinationWithSuggestedFilename):
+        Add allowOverwrite reply parameter.
+
+        * WebProcess/Downloads/mac/DownloadMac.mm:
+        (-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]):
+        Call Download::shouldDecodeSourceDataOfMIMEType.
+
+        (-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]):
+        Add allowOverwrite parameter.
+
+2010-11-15  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add decideDestinationWithSuggestedFilename WKContextDownloadClient callback
         https://bugs.webkit.org/show_bug.cgi?id=49554
 
@@ -10,7 +53,7 @@
         Add sendSync capabilities to Messagesender.
         
         * UIProcess/API/C/WKContext.h:
-        AdddecideDestinationWithSuggestedFilename callback.
+        Add decideDestinationWithSuggestedFilename callback.
 
         * UIProcess/Downloads/DownloadProxy.cpp:
         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
diff --git a/WebKit2/UIProcess/API/C/WKContext.h b/WebKit2/UIProcess/API/C/WKContext.h
index c8117cf..4585561 100644
--- a/WebKit2/UIProcess/API/C/WKContext.h
+++ b/WebKit2/UIProcess/API/C/WKContext.h
@@ -73,7 +73,8 @@ typedef struct WKContextHistoryClient WKContextHistoryClient;
 typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo);
 typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo);
 typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo);
-typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, const void *clientInfo);
+typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo);
+typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, bool* allowOverwrite, const void *clientInfo);
 typedef void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo);
 typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo);
 
@@ -83,6 +84,7 @@ struct WKContextDownloadClient {
     WKContextDownloadDidStartCallback                                   didStart;
     WKContextDownloadDidReceiveResponseCallback                         didReceiveResponse;
     WKContextDownloadDidReceiveDataCallback                             didReceiveData;
+    WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback           shouldDecodeSourceDataOfMIMEType;
     WKContextDownloadDecideDestinationWithSuggestedFilenameCallback     decideDestinationWithSuggestedFilename;
     WKContextDownloadDidCreateDestinationCallback                       didCreateDestination;
     WKContextDownloadDidFinishCallback                                  didFinish;
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index 66ecc28..b3c6efc 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -87,12 +87,20 @@ void DownloadProxy::didReceiveData(uint64_t length)
     m_webContext->downloadClient().didReceiveData(m_webContext, this, length);
 }
 
-void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination)
+void DownloadProxy::shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result)
 {
     if (!m_webContext)
         return;
 
-    destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename);
+    result = m_webContext->downloadClient().shouldDecodeSourceDataOfMIMEType(m_webContext, this, mimeType);
+}
+
+void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite)
+{
+    if (!m_webContext)
+        return;
+
+    destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename, allowOverwrite);
 }
 
 void DownloadProxy::didCreateDestination(const String& path)
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.h b/WebKit2/UIProcess/Downloads/DownloadProxy.h
index 4b35af4..a7a5511 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.h
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.h
@@ -64,7 +64,8 @@ private:
     void didStart(const WebCore::ResourceRequest&);
     void didReceiveResponse(const WebCore::ResourceResponse&);
     void didReceiveData(uint64_t length);
-    void decideDestinationWithSuggestedFilename(const String& filename, String& destination);
+    void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result);
+    void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite);
     void didCreateDestination(const String& path);
     void didFinish();
 
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
index 9d44c97..9ccf4d0 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
@@ -24,7 +24,8 @@ messages -> DownloadProxy {
     DidStart(WebCore::ResourceRequest request)
     DidReceiveResponse(WebCore::ResourceResponse response)
     DidReceiveData(uint64_t length)
-    DecideDestinationWithSuggestedFilename(String filename) -> (String destination)
+    ShouldDecodeSourceDataOfMIMEType(String mimeType) -> (bool result)
+    DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite)
     DidCreateDestination(WTF::String path)
     DidFinish()
 }
diff --git a/WebKit2/UIProcess/WebDownloadClient.cpp b/WebKit2/UIProcess/WebDownloadClient.cpp
index 8ff08c8..a8e7798 100644
--- a/WebKit2/UIProcess/WebDownloadClient.cpp
+++ b/WebKit2/UIProcess/WebDownloadClient.cpp
@@ -57,12 +57,20 @@ void WebDownloadClient::didReceiveData(WebContext* webContext, DownloadProxy* do
     m_client.didReceiveData(toAPI(webContext), toAPI(downloadProxy), length, m_client.clientInfo);
 }
 
-String WebDownloadClient::decideDestinationWithSuggestedFilename(WebContext* webContext, DownloadProxy* downloadProxy, const String& filename)
+bool WebDownloadClient::shouldDecodeSourceDataOfMIMEType(WebContext* webContext, DownloadProxy* downloadProxy, const String& mimeType)
+{
+    if (!m_client.shouldDecodeSourceDataOfMIMEType)
+        return true;
+
+    return m_client.shouldDecodeSourceDataOfMIMEType(toAPI(webContext), toAPI(downloadProxy), toAPI(mimeType.impl()), m_client.clientInfo);
+}
+
+String WebDownloadClient::decideDestinationWithSuggestedFilename(WebContext* webContext, DownloadProxy* downloadProxy, const String& filename, bool& allowOverwrite)
 {
     if (!m_client.decideDestinationWithSuggestedFilename)
         return String();
 
-    WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(webContext), toAPI(downloadProxy), toAPI(filename.impl()), m_client.clientInfo));
+    WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(webContext), toAPI(downloadProxy), toAPI(filename.impl()), &allowOverwrite, m_client.clientInfo));
     return toWTFString(destination.get());
 }
 
diff --git a/WebKit2/UIProcess/WebDownloadClient.h b/WebKit2/UIProcess/WebDownloadClient.h
index 6cea5bd..adf1879 100644
--- a/WebKit2/UIProcess/WebDownloadClient.h
+++ b/WebKit2/UIProcess/WebDownloadClient.h
@@ -44,7 +44,8 @@ public:
     void didStart(WebContext*, DownloadProxy*);
     void didReceiveResponse(WebContext*, DownloadProxy*, const WebCore::ResourceResponse&);
     void didReceiveData(WebContext*, DownloadProxy*, uint64_t length);
-    String decideDestinationWithSuggestedFilename(WebContext*, DownloadProxy*, const String& filename);
+    bool shouldDecodeSourceDataOfMIMEType(WebContext*, DownloadProxy*, const String& mimeType);
+    String decideDestinationWithSuggestedFilename(WebContext*, DownloadProxy*, const String& filename, bool& allowOverwrite);
     void didCreateDestination(WebContext*, DownloadProxy*, const String& path);
     void didFinish(WebContext*, DownloadProxy*);
 };
diff --git a/WebKit2/WebProcess/Downloads/Download.cpp b/WebKit2/WebProcess/Downloads/Download.cpp
index 329ce05..62f106f 100644
--- a/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/WebKit2/WebProcess/Downloads/Download.cpp
@@ -71,10 +71,19 @@ void Download::didReceiveData(uint64_t length)
     send(Messages::DownloadProxy::DidReceiveData(length));
 }
 
-String Download::decideDestinationWithSuggestedFilename(const String& filename)
+bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType)
+{
+    bool result;
+    if (!sendSync(Messages::DownloadProxy::ShouldDecodeSourceDataOfMIMEType(mimeType), Messages::DownloadProxy::ShouldDecodeSourceDataOfMIMEType::Reply(result)))
+        return true;
+
+    return result;
+}
+
+String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
 {
     String destination;
-    if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination)))
+    if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination, allowOverwrite)))
         return String();
 
     return destination;
diff --git a/WebKit2/WebProcess/Downloads/Download.h b/WebKit2/WebProcess/Downloads/Download.h
index 29cff24..c70f1f8 100644
--- a/WebKit2/WebProcess/Downloads/Download.h
+++ b/WebKit2/WebProcess/Downloads/Download.h
@@ -64,7 +64,8 @@ public:
     void didStart();
     void didReceiveResponse(const WebCore::ResourceResponse&);
     void didReceiveData(uint64_t length);
-    String decideDestinationWithSuggestedFilename(const String& filename);
+    bool shouldDecodeSourceDataOfMIMEType(const String& mimeType);
+    String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite);
     void didCreateDestination(const String& path);
     void didFinish();
 
diff --git a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index da6d3f1..91b1a13 100644
--- a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -138,20 +138,21 @@ void Download::platformInvalidate()
 
 - (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
 {
-    // FIXME: Implement.
-    notImplemented();
+    if (!_download)
+        return _download->shouldDecodeSourceDataOfMIMEType(encodingType);
+
     return YES;
 }
 
 - (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
 {
     String destination;
+    bool allowOverwrite;
     if (_download)
-        destination = _download->decideDestinationWithSuggestedFilename(filename);
+        destination = _download->decideDestinationWithSuggestedFilename(filename, allowOverwrite);
 
-    // FIXME: AllowOverwrite should come from the client too.
     if (!destination.isNull())
-        [download setDestination:destination allowOverwrite:YES];
+        [download setDestination:destination allowOverwrite:allowOverwrite];
 }
 
 - (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list