summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/WebFrame.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index c5f117e..42eacc1 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -34,9 +34,11 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <JavaScriptCore/APICast.h>
+#include <JavaScriptCore/JSContextRef.h>
#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>
@@ -455,6 +457,17 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
}
+WebFrame* WebFrame::frameForContext(JSContextRef context)
+{
+ JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
+ JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
+ if (strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell") != 0)
+ return 0;
+
+ Frame* coreFrame = static_cast<JSDOMWindowShell*>(globalObjectObj)->window()->impl()->frame();
+ return static_cast<WebFrameLoaderClient*>(coreFrame->loader()->client())->webFrame();
+}
+
JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleNodeHandle* nodeHandle, InjectedBundleScriptWorld* world)
{
JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
@@ -514,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