Commit 2e7a7cda authored by weinig@apple.com's avatar weinig@apple.com

WebKit2: Can't add files to an <input type=file>

https://bugs.webkit.org/show_bug.cgi?id=51087

Reviewed by Anders Carlsson.

WebCore: 

Add exported function.

* WebCore.exp.in:

WebKit2: 

* Scripts/webkit2/messages.py:
Adds new types.

* Shared/API/c/WKBase.h:
Adds WKOpenPanelParametersRef and WKOpenPanelResultListenerRef.

* Shared/APIObject.h:
Adds TypeOpenPanelParameters and TypeOpenPanelResultListener.

* Shared/WebOpenPanelParameters.cpp: Added.
(WebKit::WebOpenPanelParameters::create):
(WebKit::WebOpenPanelParameters::WebOpenPanelParameters):
(WebKit::WebOpenPanelParameters::~WebOpenPanelParameters):
(WebKit::WebOpenPanelParameters::Data::encode):
(WebKit::WebOpenPanelParameters::Data::decode):
* Shared/WebOpenPanelParameters.h: Added.
(WebKit::WebOpenPanelParameters::allowMultipleFiles):
(WebKit::WebOpenPanelParameters::type):
Class representing options one can pass to open panel.

* UIProcess/API/C/WKAPICast.h:
Add casts for WebOpenPanelParameters and WebOpenPanelResultListenerProxy.

* UIProcess/API/C/WKOpenPanelParameters.cpp: Added.
(WKOpenPanelParametersGetTypeID):
(WKOpenPanelParametersGetAllowsMultipleFiles):
* UIProcess/API/C/WKOpenPanelParameters.h: Added.
* UIProcess/API/C/WKOpenPanelResultListener.cpp: Added.
(WKOpenPanelResultListenerGetTypeID):
(WKOpenPanelResultListenerChooseFiles):
(WKOpenPanelResultListenerCancel):
* UIProcess/API/C/WKOpenPanelResultListener.h: Added.
Add API wrappers.

* UIProcess/API/C/WKPage.h:
Add new UI callback, WKPageRunOpenPanelCallback.

* UIProcess/API/C/WebKit2.h:
Add includes for new API headers.

* UIProcess/API/qt/qwkpage.cpp:
(QWKPage::QWKPage):
Stub out the runOpenPanel callback.

* UIProcess/WebOpenPanelResultListenerProxy.cpp: Added.
(WebKit::WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy):
(WebKit::WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy):
(WebKit::WebOpenPanelResultListenerProxy::chooseFiles):
(WebKit::WebOpenPanelResultListenerProxy::cancel):
(WebKit::WebOpenPanelResultListenerProxy::invalidate):
* UIProcess/WebOpenPanelResultListenerProxy.h: Added.
(WebKit::WebOpenPanelResultListenerProxy::create):
(WebKit::WebOpenPanelResultListenerProxy::type):
Adds the listener used to choose files for <input type=file>

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runOpenPanel):
(WebKit::WebPageProxy::didChooseFilesForOpenPanel):
(WebKit::WebPageProxy::didCancelForOpenPanel):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runOpenPanel):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runOpenPanel):
* WebProcess/WebPage/WebOpenPanelResultListener.cpp: Added.
(WebKit::WebOpenPanelResultListener::create):
(WebKit::WebOpenPanelResultListener::WebOpenPanelResultListener):
(WebKit::WebOpenPanelResultListener::~WebOpenPanelResultListener):
(WebKit::WebOpenPanelResultListener::didChooseFiles):
* WebProcess/WebPage/WebOpenPanelResultListener.h: Added.
(WebKit::WebOpenPanelResultListener::disconnectFromPage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
(WebKit::WebPage::setActiveOpenPanelResultListener):
(WebKit::WebPage::didChooseFilesForOpenPanel):
(WebKit::WebPage::didCancelForOpenPanel):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::activeOpenPanelResultListener):
* WebProcess/WebPage/WebPage.messages.in:
Pipe through file choosing.

* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:
Add new files.

WebKitTools: 

* MiniBrowser/mac/BrowserWindowController.m:
(runOpenPanel):
(-[BrowserWindowController awakeFromNib]):
Add simple implementation of runOpenPanel callback.

* MiniBrowser/win/BrowserView.cpp:
(BrowserView::create):
* WebKitTestRunner/TestController.cpp:
(WTR::createOtherPage):
(WTR::TestController::initialize):
Stub out runOpenPanel callback. 



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74139 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4d3c46df
2010-12-15 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
WebKit2: Can't add files to an <input type=file>
https://bugs.webkit.org/show_bug.cgi?id=51087
Add exported function.
* WebCore.exp.in:
2010-12-15 Andreas Kling <andreas.kling@nokia.com>
Reviewed by Antonio Gomes.
......
......@@ -223,10 +223,10 @@ __ZN7WebCore12EventHandler15handleAccessKeyERKNS_21PlatformKeyboardEventE
__ZN7WebCore12EventHandler15sendScrollEventEv
__ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE
__ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE
__ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE
__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEjRKNS_7IntSizeE
__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE
__ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv
__ZN7WebCore12EventHandler7mouseUpEP7NSEvent
__ZN7WebCore12EventHandler8keyEventEP7NSEvent
......@@ -273,6 +273,7 @@ __ZN7WebCore12SharedBuffer12createNSDataEv
__ZN7WebCore12SharedBuffer24createWithContentsOfFileERKN3WTF6StringE
__ZN7WebCore12SharedBufferC1EPKci
__ZN7WebCore12SharedBufferD1Ev
__ZN7WebCore12SpellChecker8didCheckEiRKN3WTF6VectorINS_19SpellCheckingResultELm0EEE
__ZN7WebCore12TextEncodingC1ERKN3WTF6StringE
__ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb
__ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib
......@@ -519,9 +520,9 @@ __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16Doc
__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
__ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE
__ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
__ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore24contextMenuItemTagItalicEv
__ZN7WebCore24contextMenuItemTagStylesEv
......@@ -924,7 +925,6 @@ __ZN7WebCore9makeRangeERKNS_15VisiblePositionES2_
__ZN7WebCore9pageCacheEv
__ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorE
__ZN7WebCore9toElementEN3JSC7JSValueE
__ZN7WebCore12SpellChecker8didCheckEiRKN3WTF6VectorINS_19SpellCheckingResultELm0EEE
__ZNK3JSC8Bindings10RootObject12globalObjectEv
__ZNK3WTF6String14createCFStringEv
__ZNK7WebCore10Credential11persistenceEv
......@@ -1090,6 +1090,7 @@ __ZNK7WebCore4Font10floatWidthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDat
__ZNK7WebCore4Font8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEii
__ZNK7WebCore4KURL11createCFURLEv
__ZNK7WebCore4KURL11isLocalFileEv
__ZNK7WebCore4KURL14fileSystemPathEv
__ZNK7WebCore4KURL17lastPathComponentEv
__ZNK7WebCore4KURL4hostEv
__ZNK7WebCore4KURL4pathEv
......
2010-12-15 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
WebKit2: Can't add files to an <input type=file>
https://bugs.webkit.org/show_bug.cgi?id=51087
* Scripts/webkit2/messages.py:
Adds new types.
* Shared/API/c/WKBase.h:
Adds WKOpenPanelParametersRef and WKOpenPanelResultListenerRef.
* Shared/APIObject.h:
Adds TypeOpenPanelParameters and TypeOpenPanelResultListener.
* Shared/WebOpenPanelParameters.cpp: Added.
(WebKit::WebOpenPanelParameters::create):
(WebKit::WebOpenPanelParameters::WebOpenPanelParameters):
(WebKit::WebOpenPanelParameters::~WebOpenPanelParameters):
(WebKit::WebOpenPanelParameters::Data::encode):
(WebKit::WebOpenPanelParameters::Data::decode):
* Shared/WebOpenPanelParameters.h: Added.
(WebKit::WebOpenPanelParameters::allowMultipleFiles):
(WebKit::WebOpenPanelParameters::type):
Class representing options one can pass to open panel.
* UIProcess/API/C/WKAPICast.h:
Add casts for WebOpenPanelParameters and WebOpenPanelResultListenerProxy.
* UIProcess/API/C/WKOpenPanelParameters.cpp: Added.
(WKOpenPanelParametersGetTypeID):
(WKOpenPanelParametersGetAllowsMultipleFiles):
* UIProcess/API/C/WKOpenPanelParameters.h: Added.
* UIProcess/API/C/WKOpenPanelResultListener.cpp: Added.
(WKOpenPanelResultListenerGetTypeID):
(WKOpenPanelResultListenerChooseFiles):
(WKOpenPanelResultListenerCancel):
* UIProcess/API/C/WKOpenPanelResultListener.h: Added.
Add API wrappers.
* UIProcess/API/C/WKPage.h:
Add new UI callback, WKPageRunOpenPanelCallback.
* UIProcess/API/C/WebKit2.h:
Add includes for new API headers.
* UIProcess/API/qt/qwkpage.cpp:
(QWKPage::QWKPage):
Stub out the runOpenPanel callback.
* UIProcess/WebOpenPanelResultListenerProxy.cpp: Added.
(WebKit::WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy):
(WebKit::WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy):
(WebKit::WebOpenPanelResultListenerProxy::chooseFiles):
(WebKit::WebOpenPanelResultListenerProxy::cancel):
(WebKit::WebOpenPanelResultListenerProxy::invalidate):
* UIProcess/WebOpenPanelResultListenerProxy.h: Added.
(WebKit::WebOpenPanelResultListenerProxy::create):
(WebKit::WebOpenPanelResultListenerProxy::type):
Adds the listener used to choose files for <input type=file>
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runOpenPanel):
(WebKit::WebPageProxy::didChooseFilesForOpenPanel):
(WebKit::WebPageProxy::didCancelForOpenPanel):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runOpenPanel):
* UIProcess/WebUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runOpenPanel):
* WebProcess/WebPage/WebOpenPanelResultListener.cpp: Added.
(WebKit::WebOpenPanelResultListener::create):
(WebKit::WebOpenPanelResultListener::WebOpenPanelResultListener):
(WebKit::WebOpenPanelResultListener::~WebOpenPanelResultListener):
(WebKit::WebOpenPanelResultListener::didChooseFiles):
* WebProcess/WebPage/WebOpenPanelResultListener.h: Added.
(WebKit::WebOpenPanelResultListener::disconnectFromPage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
(WebKit::WebPage::setActiveOpenPanelResultListener):
(WebKit::WebPage::didChooseFilesForOpenPanel):
(WebKit::WebPage::didCancelForOpenPanel):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::activeOpenPanelResultListener):
* WebProcess/WebPage/WebPage.messages.in:
Pipe through file choosing.
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:
Add new files.
2010-12-15 Anders Carlsson <andersca@apple.com>
Reviewed by Maciej Stachowiak.
......@@ -249,8 +249,8 @@ def message_to_struct_declaration(message):
def struct_or_class(namespace, type):
structs = frozenset([
'WebCore::KeypressCommand',
'WebCore::CompositionUnderline',
'WebCore::KeypressCommand',
'WebCore::PluginInfo',
'WebCore::ViewportArguments',
'WebCore::WindowFeatures',
......@@ -258,6 +258,7 @@ def struct_or_class(namespace, type):
'WebKit::PlatformPopupMenuData',
'WebKit::PluginProcessCreationParameters',
'WebKit::WebNavigationDataStore',
'WebKit::WebOpenPanelParameters::Data',
'WebKit::WebPageCreationParameters',
'WebKit::WebPreferencesStore',
'WebKit::WebProcessCreationParameters',
......@@ -411,13 +412,13 @@ def headers_for_type(type):
special_cases = {
'WTF::String': '<wtf/text/WTFString.h>',
'WebCore::CompositionUnderline': '<WebCore/Editor.h>',
'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>',
'WebCore::PluginInfo': '<WebCore/PluginData.h>',
'WebCore::CompositionUnderline': '<WebCore/Editor.h>',
'WebKit::WebKeyboardEvent': '"WebEvent.h"',
'WebKit::WebMouseEvent': '"WebEvent.h"',
'WebKit::WebWheelEvent': '"WebEvent.h"',
'WebKit::WebTouchEvent': '"WebEvent.h"',
'WebKit::WebWheelEvent': '"WebEvent.h"',
}
if type in special_cases:
return [special_cases[type]]
......
......@@ -73,6 +73,8 @@ typedef const struct OpaqueWKFrame* WKFrameRef;
typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
typedef const struct OpaqueWKInspector* WKInspectorRef;
typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
typedef const struct OpaqueWKOpenPanelParameters* WKOpenPanelParametersRef;
typedef const struct OpaqueWKOpenPanelResultListener* WKOpenPanelResultListenerRef;
typedef const struct OpaqueWKPage* WKPageRef;
typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
typedef const struct OpaqueWKPreferences* WKPreferencesRef;
......
......@@ -69,6 +69,8 @@ public:
TypeFramePolicyListener,
TypeInspector,
TypeNavigationData,
TypeOpenPanelParameters,
TypeOpenPanelResultListener,
TypePage,
TypePageGroup,
TypePreferences,
......
/*
* Copyright (C) 2010 Apple Inc. 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 "WebOpenPanelParameters.h"
#include "WebCoreArgumentCoders.h"
namespace WebKit {
PassRefPtr<WebOpenPanelParameters> WebOpenPanelParameters::create(const Data& data)
{
return adoptRef(new WebOpenPanelParameters(data));
}
WebOpenPanelParameters::WebOpenPanelParameters(const Data& data)
: m_data(data)
{
}
WebOpenPanelParameters::~WebOpenPanelParameters()
{
}
void WebOpenPanelParameters::Data::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(CoreIPC::In(allowMultipleFiles, allowsDirectoryUpload, acceptTypes, filenames));
}
bool WebOpenPanelParameters::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result)
{
return decoder->decode(CoreIPC::Out(result.allowMultipleFiles, result.allowsDirectoryUpload, result.acceptTypes, result.filenames));
}
} // namespace WebCore
/*
* Copyright (C) 2010 Apple Inc. 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 WebOpenPanelParameters_h
#define WebOpenPanelParameters_h
#include "APIObject.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace CoreIPC {
class ArgumentDecoder;
class ArgumentEncoder;
}
namespace WebKit {
class WebOpenPanelParameters : public APIObject {
public:
static const Type APIType = TypeOpenPanelParameters;
struct Data {
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, Data&);
bool allowMultipleFiles;
bool allowsDirectoryUpload;
String acceptTypes;
Vector<String> filenames;
};
static PassRefPtr<WebOpenPanelParameters> create(const Data&);
~WebOpenPanelParameters();
bool allowMultipleFiles() const { return m_data.allowMultipleFiles; }
private:
explicit WebOpenPanelParameters(const Data&);
virtual Type type() const { return APIType; }
Data m_data;
};
} // namespace WebKit
#endif // WebOpenPanelParameters_h
......@@ -53,6 +53,8 @@ class WebFramePolicyListenerProxy;
class WebFrameProxy;
class WebInspectorProxy;
class WebNavigationData;
class WebOpenPanelParameters;
class WebOpenPanelResultListenerProxy;
class WebPageGroup;
class WebPageProxy;
class WebPreferences;
......@@ -70,6 +72,8 @@ WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)
WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy)
WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
......
/*
* Copyright (C) 2010 Apple Inc. 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 "WKOpenPanelParameters.h"
#include "WKAPICast.h"
#include "WebOpenPanelParameters.h"
using namespace WebKit;
WKTypeID WKOpenPanelParametersGetTypeID()
{
return toAPI(WebOpenPanelParameters::APIType);
}
bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parametersRef)
{
return toImpl(parametersRef)->allowMultipleFiles();
}
/*
* Copyright (C) 2010 Apple Inc. 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 WKOpenPanelParameters_h
#define WKOpenPanelParameters_h
#include <WebKit2/WKBase.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKTypeID WKOpenPanelParametersGetTypeID();
WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parameters);
#ifdef __cplusplus
}
#endif
#endif /* WKOpenPanelParameters_h */
/*
* Copyright (C) 2010 Apple Inc. 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 "WKOpenPanelResultListener.h"
#include "WKAPICast.h"
#include "WebOpenPanelResultListenerProxy.h"
using namespace WebKit;
WKTypeID WKOpenPanelResultListenerGetTypeID()
{
return toAPI(WebOpenPanelResultListenerProxy::APIType);
}
void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef)
{
toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef));
}
void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef)
{
toImpl(listenerRef)->cancel();
}
/*
* Copyright (C) 2010 Apple Inc. 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 WKOpenPanelResultListener_h
#define WKOpenPanelResultListener_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKTypeID WKOpenPanelResultListenerGetTypeID();
WK_EXPORT void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listener, WKArrayRef fileURLs);
WK_EXPORT void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listener);
#ifdef __cplusplus
}
#endif
#endif /* WKOpenPanelResultListener_h */
......@@ -154,7 +154,7 @@ typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStri
typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo);
struct WKPageUIClient {
int version;
......@@ -182,6 +182,7 @@ struct WKPageUIClient {
WKPageDidDrawCallback didDraw;
WKPageDidScrollCallback pageDidScroll;
WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota;
WKPageRunOpenPanelCallback runOpenPanel;
};
typedef struct WKPageUIClient WKPageUIClient;
......
......@@ -43,6 +43,8 @@
#include <WebKit2/WKMutableDictionary.h>
#include <WebKit2/WKNavigationData.h>
#include <WebKit2/WKNumber.h>
#include <WebKit2/WKOpenPanelParameters.h>
#include <WebKit2/WKOpenPanelResultListener.h>
#include <WebKit2/WKPage.h>
#include <WebKit2/WKPageGroup.h>
#include <WebKit2/WKPreferences.h>
......
......@@ -360,7 +360,8 @@ QWKPage::QWKPage(QWKContext* context)
0, /* runBeforeUnloadConfirmPanel */
0, /* didDraw */
0, /* pageDidScroll */
0 /* exceededDatabaseQuota */
0, /* exceededDatabaseQuota */
0 /* runOpenPanel */
};
WKPageSetPageUIClient(pageRef(), &uiClient);
}
......
/*
* Copyright (C) 2010 Apple Inc. 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 "WebOpenPanelResultListenerProxy.h"
#include "ImmutableArray.h"
#include "WebPageProxy.h"
#include <WebCore/KURL.h>
#include <wtf/Vector.h>
using namespace WebCore;
namespace WebKit {
WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy(WebPageProxy* page)
: m_page(page)
{
}
WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy()
{
}
void WebOpenPanelResultListenerProxy::chooseFiles(ImmutableArray* fileURLsArray)
{
if (!m_page)
return;
size_t size = fileURLsArray->size();
Vector<String> filePaths;
filePaths.reserveInitialCapacity(size);