[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
beidson at apple.com
beidson at apple.com
Sun Feb 20 23:35:22 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 40c8608681c18d015900e26ce81df3a6afeadb2c
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 21 22:12:17 2011 +0000
<rdar://problem/8894125> and https://bugs.webkit.org/show_bug.cgi?id=52916
Expose "suggested filename" for a resource based on its resource response.
Reviewed by Adam Roben.
API pieces:
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameCopySuggestedFilenameForResourceURL):
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
Implementation:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::suggestedFilenameForResourceURL): See if the DocumentLoader has
a resource for this URL and, if so, return the response's suggested filename.
* WebProcess/WebPage/WebFrame.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76394 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 3b4d998..5a350c4 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-21 Brady Eidson <beidson at apple.com>
+
+ Reviewed by Adam Roben.
+
+ <rdar://problem/8894125> and https://bugs.webkit.org/show_bug.cgi?id=52916
+ Expose "suggested filename" for a resource based on its resource response.
+
+ API pieces:
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+ (WKBundleFrameCopySuggestedFilenameForResourceURL):
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
+
+ Implementation:
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::suggestedFilenameForResourceURL): See if the DocumentLoader has
+ a resource for this URL and, if so, return the response's suggested filename.
+ * WebProcess/WebPage/WebFrame.h:
+
2011-01-21 Anders Carlsson <andersca at apple.com>
Reviewed by Dan Bernstein.
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index ec1c7bd..f02044c 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -202,3 +202,8 @@ WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef)
return toAPI(view->scrollOffset());
}
+
+WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
+{
+ return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index eff82d9..59c2d75 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -59,6 +59,8 @@ WK_EXPORT WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frame);
WK_EXPORT WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frame);
WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frame);
+WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 8dcabf0..42eacc1 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -38,6 +38,7 @@
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/JSValueRef.h>
#include <WebCore/AnimationController.h>
+#include <WebCore/ArchiveResource.h>
#include <WebCore/CSSComputedStyleDeclaration.h>
#include <WebCore/Chrome.h>
#include <WebCore/DocumentLoader.h>
@@ -526,4 +527,20 @@ String WebFrame::provisionalURL() const
return m_coreFrame->loader()->provisionalDocumentLoader()->url().string();
}
+String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
+{
+ if (!m_coreFrame)
+ return String();
+
+ DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
+ if (!loader)
+ return String();
+
+ RefPtr<ArchiveResource> resource = loader->subresource(url);
+ if (!resource)
+ return String();
+
+ return resource->response().suggestedFilename();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index 0115dee..f254e7a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -109,6 +109,7 @@ public:
bool allowsFollowingLink(const WebCore::KURL&) const;
String provisionalURL() const;
+ String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const;
// Simple listener class used by plug-ins to know when frames finish or fail loading.
class LoadListener {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list