[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:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 6909766d80bae3ab9e8289b37a4ca860a3ec3918
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 15 19:48:40 2010 +0000
Add decideDestinationWithSuggestedFilename WKContextDownloadClient callback
https://bugs.webkit.org/show_bug.cgi?id=49554
Reviewed by Sam Weinig.
* Platform/CoreIPC/MessageSender.h:
(CoreIPC::MessageSender::sendSync):
Add sendSync capabilities to Messagesender.
* UIProcess/API/C/WKContext.h:
AdddecideDestinationWithSuggestedFilename callback.
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
Call WebDownloadClient::decideDestinationWithSuggestedFilename.
* UIProcess/Downloads/DownloadProxy.messages.in:
Add DecideDestinationWithSuggestedFilename.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::didReceiveSyncMessage):
Process MessageClassDownloadProxy messages.
* UIProcess/WebDownloadClient.cpp:
(WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename):
Ask the WKContextDownloadClient for the destination.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveSyncMessage):
MessageClassDownloadProxy messages should go to the WebContext.
* WebProcess/Downloads/Download.cpp:
(WebKit::Download::decideDestinationWithSuggestedFilename):
Send the DecideDestinationWithSuggestedFilename message.
* WebProcess/Downloads/Download.h:
* WebProcess/Downloads/mac/DownloadMac.mm:
(-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]):
call Download::decideDestinationWithSuggestedFilename and set the destination.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72018 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 21e54cc..637ec84 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,45 @@
+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
+
+ * Platform/CoreIPC/MessageSender.h:
+ (CoreIPC::MessageSender::sendSync):
+ Add sendSync capabilities to Messagesender.
+
+ * UIProcess/API/C/WKContext.h:
+ AdddecideDestinationWithSuggestedFilename callback.
+
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
+ Call WebDownloadClient::decideDestinationWithSuggestedFilename.
+
+ * UIProcess/Downloads/DownloadProxy.messages.in:
+ Add DecideDestinationWithSuggestedFilename.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::didReceiveSyncMessage):
+ Process MessageClassDownloadProxy messages.
+
+ * UIProcess/WebDownloadClient.cpp:
+ (WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename):
+ Ask the WKContextDownloadClient for the destination.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didReceiveSyncMessage):
+ MessageClassDownloadProxy messages should go to the WebContext.
+
+ * WebProcess/Downloads/Download.cpp:
+ (WebKit::Download::decideDestinationWithSuggestedFilename):
+ Send the DecideDestinationWithSuggestedFilename message.
+
+ * WebProcess/Downloads/Download.h:
+ * WebProcess/Downloads/mac/DownloadMac.mm:
+ (-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]):
+ call Download::decideDestinationWithSuggestedFilename and set the destination.
+
2010-11-15 Andreas Kling <kling at webkit.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/Platform/CoreIPC/MessageSender.h b/WebKit2/Platform/CoreIPC/MessageSender.h
index 5714553..e2ba0b5 100644
--- a/WebKit2/Platform/CoreIPC/MessageSender.h
+++ b/WebKit2/Platform/CoreIPC/MessageSender.h
@@ -53,6 +53,19 @@ public:
return connection->sendMessage(messageID, argumentEncoder);
}
+
+ template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, double timeout = Connection::NoTimeout)
+ {
+ return sendSync(message, reply, static_cast<T*>(this)->destinationID(), timeout);
+ }
+
+ template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = Connection::NoTimeout)
+ {
+ Connection* connection = static_cast<T*>(this)->connection();
+ ASSERT(connection);
+
+ return connection->sendSync(message, reply, destinationID, timeout);
+ }
};
} // namespace CoreIPC
diff --git a/WebKit2/UIProcess/API/C/WKContext.h b/WebKit2/UIProcess/API/C/WKContext.h
index 2159bf4..c8117cf 100644
--- a/WebKit2/UIProcess/API/C/WKContext.h
+++ b/WebKit2/UIProcess/API/C/WKContext.h
@@ -73,6 +73,7 @@ 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 void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo);
typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo);
@@ -82,6 +83,7 @@ struct WKContextDownloadClient {
WKContextDownloadDidStartCallback didStart;
WKContextDownloadDidReceiveResponseCallback didReceiveResponse;
WKContextDownloadDidReceiveDataCallback didReceiveData;
+ WKContextDownloadDecideDestinationWithSuggestedFilenameCallback decideDestinationWithSuggestedFilename;
WKContextDownloadDidCreateDestinationCallback didCreateDestination;
WKContextDownloadDidFinishCallback didFinish;
};
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index d0cef44..66ecc28 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -87,6 +87,14 @@ void DownloadProxy::didReceiveData(uint64_t length)
m_webContext->downloadClient().didReceiveData(m_webContext, this, length);
}
+void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination)
+{
+ if (!m_webContext)
+ return;
+
+ destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename);
+}
+
void DownloadProxy::didCreateDestination(const String& path)
{
if (!m_webContext)
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.h b/WebKit2/UIProcess/Downloads/DownloadProxy.h
index e918406..4b35af4 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.h
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.h
@@ -27,16 +27,11 @@
#define DownloadProxy_h
#include "APIObject.h"
+#include "Connection.h"
#include <WebCore/ResourceRequest.h>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
-namespace CoreIPC {
- class ArgumentDecoder;
- class Connection;
- class MessageID;
-}
-
namespace WebCore {
class ResourceResponse;
}
@@ -58,6 +53,7 @@ public:
void invalidate();
void didReceiveDownloadProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncDownloadProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
private:
explicit DownloadProxy(WebContext*);
@@ -68,6 +64,7 @@ private:
void didStart(const WebCore::ResourceRequest&);
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
+ void decideDestinationWithSuggestedFilename(const String& filename, String& destination);
void didCreateDestination(const String& path);
void didFinish();
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
index 7d357c7..9d44c97 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
@@ -24,6 +24,7 @@ messages -> DownloadProxy {
DidStart(WebCore::ResourceRequest request)
DidReceiveResponse(WebCore::ResourceResponse response)
DidReceiveData(uint64_t length)
+ DecideDestinationWithSuggestedFilename(String filename) -> (String destination)
DidCreateDestination(WTF::String path)
DidFinish()
}
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index 7244e6b..64b1057 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -474,6 +474,13 @@ CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* co
if (messageID.is<CoreIPC::MessageClassWebContext>())
return didReceiveSyncWebContextMessage(connection, messageID, arguments, reply);
+ if (messageID.is<CoreIPC::MessageClassDownloadProxy>()) {
+ if (DownloadProxy* downloadProxy = m_downloads.get(arguments->destinationID()).get())
+ return downloadProxy->didReceiveSyncDownloadProxyMessage(connection, messageID, arguments, reply);
+
+ return CoreIPC::AutomaticReply;
+ }
+
switch (messageID.get<WebContextLegacyMessage::Kind>()) {
case WebContextLegacyMessage::PostSynchronousMessage: {
// FIXME: We should probably encode something in the case that the arguments do not decode correctly.
diff --git a/WebKit2/UIProcess/WebDownloadClient.cpp b/WebKit2/UIProcess/WebDownloadClient.cpp
index 1eb4165..8ff08c8 100644
--- a/WebKit2/UIProcess/WebDownloadClient.cpp
+++ b/WebKit2/UIProcess/WebDownloadClient.cpp
@@ -27,6 +27,7 @@
#include "WKAPICast.h"
#include "WebURLResponse.h"
+#include "WKRetainPtr.h"
using namespace WebCore;
@@ -56,6 +57,15 @@ 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)
+{
+ if (!m_client.decideDestinationWithSuggestedFilename)
+ return String();
+
+ WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(webContext), toAPI(downloadProxy), toAPI(filename.impl()), m_client.clientInfo));
+ return toWTFString(destination.get());
+}
+
void WebDownloadClient::didCreateDestination(WebContext* webContext, DownloadProxy* downloadProxy, const String& path)
{
if (!m_client.didCreateDestination)
diff --git a/WebKit2/UIProcess/WebDownloadClient.h b/WebKit2/UIProcess/WebDownloadClient.h
index 3d9968e..6cea5bd 100644
--- a/WebKit2/UIProcess/WebDownloadClient.h
+++ b/WebKit2/UIProcess/WebDownloadClient.h
@@ -44,6 +44,7 @@ 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);
void didCreateDestination(WebContext*, DownloadProxy*, const String& path);
void didFinish(WebContext*, DownloadProxy*);
};
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index a3f5c21..0d45c91 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -239,7 +239,7 @@ CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connectio
}
#endif
- if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>())
+ if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() || messageID.is<CoreIPC::MessageClassDownloadProxy>())
return m_context->didReceiveSyncMessage(connection, messageID, arguments, reply);
uint64_t pageID = arguments->destinationID();
diff --git a/WebKit2/WebProcess/Downloads/Download.cpp b/WebKit2/WebProcess/Downloads/Download.cpp
index 7751be0..329ce05 100644
--- a/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/WebKit2/WebProcess/Downloads/Download.cpp
@@ -71,6 +71,15 @@ void Download::didReceiveData(uint64_t length)
send(Messages::DownloadProxy::DidReceiveData(length));
}
+String Download::decideDestinationWithSuggestedFilename(const String& filename)
+{
+ String destination;
+ if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination)))
+ return String();
+
+ return destination;
+}
+
void Download::didCreateDestination(const String& path)
{
send(Messages::DownloadProxy::DidCreateDestination(path));
diff --git a/WebKit2/WebProcess/Downloads/Download.h b/WebKit2/WebProcess/Downloads/Download.h
index 1aec7eb..29cff24 100644
--- a/WebKit2/WebProcess/Downloads/Download.h
+++ b/WebKit2/WebProcess/Downloads/Download.h
@@ -64,6 +64,7 @@ public:
void didStart();
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
+ String decideDestinationWithSuggestedFilename(const String& filename);
void didCreateDestination(const String& path);
void didFinish();
diff --git a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index 0992a9d..da6d3f1 100644
--- a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -145,8 +145,13 @@ void Download::platformInvalidate()
- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
{
- // FIXME: Implement.
- notImplemented();
+ String destination;
+ if (_download)
+ destination = _download->decideDestinationWithSuggestedFilename(filename);
+
+ // FIXME: AllowOverwrite should come from the client too.
+ if (!destination.isNull())
+ [download setDestination:destination allowOverwrite:YES];
}
- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list