Diff
Modified: trunk/Source/WebKit2/ChangeLog (97336 => 97337)
--- trunk/Source/WebKit2/ChangeLog 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-13 02:51:06 UTC (rev 97337)
@@ -3,6 +3,54 @@
Pass Parsed Accept Attribute MIME Types to WebKit Clients
https://bugs.webkit.org/show_bug.cgi?id=69598
+ Reviewed by Anders Carlsson.
+
+ The WebOpenPanelParameters::Data struct was a mirror of
+ the already existing WebCore::FileChooserSettings struct.
+ So eliminate the excess struct and generate default
+ WebCore coders for the WebCore::FileChooserSettings struct.
+
+ * Scripts/webkit2/messages.py:
+ Switch to the new type. FileChooserSetting's header needs
+ to be special cased to FileChooser.h.
+
+ * Shared/WebCoreArgumentCoders.h:
+ * Shared/WebCoreArgumentCoders.cpp:
+ (CoreIPC::::encode):
+ (CoreIPC::::decode):
+ Encode and decode all, non-deprecated, values. So we
+ ignore deprecatedAcceptTypes. A follow-up patch will add it.
+
+ * Shared/WebOpenPanelParameters.cpp:
+ (WebKit::WebOpenPanelParameters::create):
+ (WebKit::WebOpenPanelParameters::WebOpenPanelParameters):
+ Switch to the new type.
+
+ * Shared/WebOpenPanelParameters.h:
+ (WebKit::WebOpenPanelParameters::allowMultipleFiles):
+ (WebKit::WebOpenPanelParameters::selectedFileNames):
+ FileChooserSettings had different property names.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::runOpenPanel):
+ Generate the WebOpenPanelParameters object here, before
+ passing into the WebUIClient. This seems to be the convention
+ to not have WebCore types in WebUIClient.
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/WebUIClient.cpp:
+ (WebKit::WebUIClient::runOpenPanel):
+ * UIProcess/WebUIClient.h:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::runOpenPanel):
+ Switch to the new type.
+
+2011-10-12 Joseph Pecoraro <[email protected]>
+
+ Pass Parsed Accept Attribute MIME Types to WebKit Clients
+ https://bugs.webkit.org/show_bug.cgi?id=69598
+
Reviewed by Kent Tamura.
Switch to deprecated for now, but the next patches will
Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (97336 => 97337)
--- trunk/Source/WebKit2/Scripts/webkit2/messages.py 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py 2011-10-13 02:51:06 UTC (rev 97337)
@@ -171,6 +171,7 @@
'WebCore::EditorCommandsForKeyEvent',
'WebCore::CompositionUnderline',
'WebCore::FloatPoint3D',
+ 'WebCore::FileChooserSettings',
'WebCore::GrammarDetail',
'WebCore::IdentityTransformOperation',
'WebCore::KeypressCommand',
@@ -203,7 +204,6 @@
'WebKit::StatisticsData',
'WebKit::TextCheckerState',
'WebKit::WebNavigationDataStore',
- 'WebKit::WebOpenPanelParameters::Data',
'WebKit::WebPageCreationParameters',
'WebKit::WebPreferencesStore',
'WebKit::WebProcessCreationParameters',
@@ -376,6 +376,7 @@
'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'],
'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'],
+ 'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
'WebKit::InjectedBundleUserMessageEncoder': [],
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (97336 => 97337)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2011-10-13 02:51:06 UTC (rev 97337)
@@ -32,6 +32,7 @@
#include <WebCore/Cursor.h>
#include <WebCore/DatabaseDetails.h>
#include <WebCore/Editor.h>
+#include <WebCore/FileChooser.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/Image.h>
#include <WebCore/PluginData.h>
@@ -518,6 +519,30 @@
}
+void ArgumentCoder<FileChooserSettings>::encode(ArgumentEncoder* encoder, const FileChooserSettings& settings)
+{
+ encoder->encode(settings.allowsMultipleFiles);
+#if ENABLE(DIRECTORY_UPLOAD)
+ encoder->encode(settings.allowsDirectoryUpload);
+#endif
+ encoder->encode(settings.selectedFiles);
+}
+
+bool ArgumentCoder<FileChooserSettings>::decode(ArgumentDecoder* decoder, FileChooserSettings& settings)
+{
+ if (!decoder->decode(settings.allowsMultipleFiles))
+ return false;
+#if ENABLE(DIRECTORY_UPLOAD)
+ if (!decoder->decode(settings.allowsDirectoryUpload))
+ return false;
+#endif
+ if (!decoder->decode(settings.selectedFiles))
+ return false;
+
+ return true;
+}
+
+
void ArgumentCoder<GrammarDetail>::encode(ArgumentEncoder* encoder, const GrammarDetail& detail)
{
encoder->encode(detail.location);
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (97336 => 97337)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2011-10-13 02:51:06 UTC (rev 97337)
@@ -46,6 +46,7 @@
class ResourceRequest;
class ResourceResponse;
struct CompositionUnderline;
+ struct FileChooserSettings;
struct GrammarDetail;
struct MimeClassInfo;
struct PluginInfo;
@@ -192,6 +193,11 @@
static bool decode(ArgumentDecoder*, WebCore::DatabaseDetails&);
};
+template<> struct ArgumentCoder<WebCore::FileChooserSettings> {
+ static void encode(ArgumentEncoder*, const WebCore::FileChooserSettings&);
+ static bool decode(ArgumentDecoder*, WebCore::FileChooserSettings&);
+};
+
template<> struct ArgumentCoder<WebCore::GrammarDetail> {
static void encode(ArgumentEncoder*, const WebCore::GrammarDetail&);
static bool decode(ArgumentDecoder*, WebCore::GrammarDetail&);
Modified: trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp (97336 => 97337)
--- trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp 2011-10-13 02:51:06 UTC (rev 97337)
@@ -26,17 +26,17 @@
#include "config.h"
#include "WebOpenPanelParameters.h"
-#include "WebCoreArgumentCoders.h"
+using namespace WebCore;
namespace WebKit {
-PassRefPtr<WebOpenPanelParameters> WebOpenPanelParameters::create(const Data& data)
+PassRefPtr<WebOpenPanelParameters> WebOpenPanelParameters::create(const FileChooserSettings& settings)
{
- return adoptRef(new WebOpenPanelParameters(data));
+ return adoptRef(new WebOpenPanelParameters(settings));
}
-WebOpenPanelParameters::WebOpenPanelParameters(const Data& data)
- : m_data(data)
+WebOpenPanelParameters::WebOpenPanelParameters(const FileChooserSettings& settings)
+ : m_settings(settings)
{
}
@@ -44,26 +44,4 @@
{
}
-void WebOpenPanelParameters::Data::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(allowMultipleFiles);
- encoder->encode(allowsDirectoryUpload);
- encoder->encode(acceptTypes);
- encoder->encode(filenames);
-}
-
-bool WebOpenPanelParameters::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result)
-{
- if (!decoder->decode(result.allowMultipleFiles))
- return false;
- if (!decoder->decode(result.allowsDirectoryUpload))
- return false;
- if (!decoder->decode(result.acceptTypes))
- return false;
- if (!decoder->decode(result.filenames))
- return false;
-
- return true;
-}
-
} // namespace WebCore
Modified: trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h (97336 => 97337)
--- trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h 2011-10-13 02:51:06 UTC (rev 97337)
@@ -27,42 +27,28 @@
#define WebOpenPanelParameters_h
#include "APIObject.h"
+#include <WebCore/FileChooser.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&);
+ static PassRefPtr<WebOpenPanelParameters> create(const WebCore::FileChooserSettings&);
~WebOpenPanelParameters();
- bool allowMultipleFiles() const { return m_data.allowMultipleFiles; }
- Vector<String> selectedFileNames() const { return m_data.filenames; }
+ bool allowMultipleFiles() const { return m_settings.allowsMultipleFiles; }
+ Vector<String> selectedFileNames() const { return m_settings.selectedFiles; }
private:
- explicit WebOpenPanelParameters(const Data&);
+ explicit WebOpenPanelParameters(const WebCore::FileChooserSettings&);
virtual Type type() const { return APIType; }
- Data m_data;
+ WebCore::FileChooserSettings m_settings;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (97336 => 97337)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-10-13 02:51:06 UTC (rev 97337)
@@ -2147,7 +2147,7 @@
#endif
}
-void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data& data)
+void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
{
if (m_openPanelResultListener) {
m_openPanelResultListener->invalidate();
@@ -2157,12 +2157,13 @@
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
// Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
process()->responsivenessTimer()->stop();
- if (!m_uiClient.runOpenPanel(this, frame, data, m_openPanelResultListener.get()))
+ if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
didCancelForOpenPanel();
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (97336 => 97337)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-10-13 02:51:06 UTC (rev 97337)
@@ -82,6 +82,7 @@
class FloatRect;
class IntSize;
class ProtectionSpace;
+ struct FileChooserSettings;
struct TextCheckingResult;
struct ViewportArguments;
struct WindowFeatures;
@@ -644,7 +645,7 @@
void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
void didChangeViewportData(const WebCore::ViewportArguments&);
void pageDidScroll();
- void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&);
+ void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&);
void printFrame(uint64_t frameID);
void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, uint64_t& newQuota);
void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (97336 => 97337)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2011-10-13 02:51:06 UTC (rev 97337)
@@ -57,7 +57,7 @@
WindowToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame)
RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
PageDidScroll()
- RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
+ RunOpenPanel(uint64_t frameID, WebCore::FileChooserSettings parameters)
PrintFrame(uint64_t frameID) -> ()
RunModal()
NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb)
Modified: trunk/Source/WebKit2/UIProcess/WebUIClient.cpp (97336 => 97337)
--- trunk/Source/WebKit2/UIProcess/WebUIClient.cpp 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/UIProcess/WebUIClient.cpp 2011-10-13 02:51:06 UTC (rev 97337)
@@ -313,13 +313,12 @@
return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.clientInfo);
}
-bool WebUIClient::runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, const WebOpenPanelParameters::Data& parameterData, WebOpenPanelResultListenerProxy* listener)
+bool WebUIClient::runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener)
{
if (!m_client.runOpenPanel)
return false;
- RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(parameterData);
- m_client.runOpenPanel(toAPI(page), toAPI(frame), toAPI(parameters.get()), toAPI(listener), m_client.clientInfo);
+ m_client.runOpenPanel(toAPI(page), toAPI(frame), toAPI(parameters), toAPI(listener), m_client.clientInfo);
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/WebUIClient.h (97336 => 97337)
--- trunk/Source/WebKit2/UIProcess/WebUIClient.h 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/UIProcess/WebUIClient.h 2011-10-13 02:51:06 UTC (rev 97337)
@@ -97,7 +97,7 @@
unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
- bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*);
+ bool runOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*);
bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
// Printing.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (97336 => 97337)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2011-10-13 02:50:50 UTC (rev 97336)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2011-10-13 02:51:06 UTC (rev 97337)
@@ -614,18 +614,7 @@
RefPtr<FileChooser> fileChooser = prpFileChooser;
m_page->setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser.get()));
-
- WebOpenPanelParameters::Data parameters;
- parameters.allowMultipleFiles = fileChooser->settings().allowsMultipleFiles;
-#if ENABLE(DIRECTORY_UPLOAD)
- parameters.allowsDirectoryUpload = fileChooser->settings().allowsDirectoryUpload;
-#else
- parameters.allowsDirectoryUpload = false;
-#endif
- parameters.acceptTypes = fileChooser->settings().deprecatedAcceptTypes;
- parameters.filenames = fileChooser->settings().selectedFiles;
-
- m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), parameters));
+ m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), fileChooser->settings()));
}
void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)