[Mac] Add API for open panel handling to WKWebView
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 21:21:57 +0000 (21:21 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 21:21:57 +0000 (21:21 +0000)
commit194f3bc8174f18586557333b5732145428783727
tree4048eaf0b948c70813498acb32daf91b6779e930
parentf0e198cc3224006dc2bd6ccda522cb300d39d3d9
[Mac] Add API for open panel handling to WKWebView
https://bugs.webkit.org/show_bug.cgi?id=137759
rdar://problem/23278623

Reviewed by Tim Horton.

Source/WebKit2:

Based on a patch by Brian Michel.

* Shared/API/Cocoa/WebKit.h:
Import WKOpenPanelParameters.h.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
Create a WKOpenPanelParameters for Type::OpenPanelParameters.

* UIProcess/API/APIOpenPanelParameters.cpp: Renamed from Source/WebKit2/Shared/WebOpenPanelParameters.cpp.
* UIProcess/API/APIOpenPanelParameters.h: Renamed from Source/WebKit2/Shared/WebOpenPanelParameters.h.
Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters.

* UIProcess/API/APIUIClient.h:
(API::UIClient::runOpenPanel):
Change this to take a SecurityOriginData.

* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKOpenPanelParametersRef.cpp:
(WKOpenPanelParametersGetTypeID):
Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters.

* UIProcess/API/C/WKOpenPanelResultListener.cpp:
(filePathsFromFileURLs):
(WKOpenPanelResultListenerChooseFiles):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
Change chooseFiles to take a Vector<String> instead of an API::Array of URLs.

* UIProcess/API/Cocoa/WKOpenPanelParameters.h: Added.
* UIProcess/API/Cocoa/WKOpenPanelParameters.mm: Added.
(-[WKOpenPanelParameters allowsMultipleSelection]):
(-[WKOpenPanelParameters _apiObject]):
* UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h:
Add a WKOpenPanelParameters class which contains information about a file upload control.

* UIProcess/API/Cocoa/WKUIDelegate.h:
Add new delegate method.

* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
Record whether the UI delegate implements the new delegate method.

(WebKit::UIDelegate::UIClient::runOpenPanel):
Invoke the new delegate method.

* UIProcess/PageClient.h:
(WebKit::PageClient::handleRunOpenPanel):
Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters.

* UIProcess/WebOpenPanelResultListenerProxy.cpp:
(WebKit::WebOpenPanelResultListenerProxy::chooseFiles):
* UIProcess/WebOpenPanelResultListenerProxy.h:
Change chooseFiles to take a Vector<String> instead of an API::Array of URLs.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runOpenPanel):
* UIProcess/WebPageProxy.h:
Change this to take a SecurityOriginData.

* UIProcess/WebPageProxy.messages.in:
Change RunOpenPanel to take a SecurityOriginData.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::handleRunOpenPanel):
Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showRunOpenPanel:resultListener:]):
Change chooseFiles to take a Vector<String> instead of an API::Array of URLs.

* UIProcess/ios/forms/WKFileUploadPanel.h:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _chooseFiles:displayString:iconImage:]):
Change chooseFiles to take a Vector<String> instead of an API::Array of URLs.

(-[WKFileUploadPanel presentWithParameters:resultListener:]):
Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters.

* WebKit2.xcodeproj/project.pbxproj:
Add new file.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runOpenPanel):
Pass the security origin of the frame along.

Tools:

Have MiniBrowser implement the new delegate method.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WebKit.h
Source/WebKit2/Shared/Cocoa/APIObject.mm
Source/WebKit2/UIProcess/API/APIOpenPanelParameters.cpp [moved from Source/WebKit2/Shared/WebOpenPanelParameters.cpp with 77% similarity]
Source/WebKit2/UIProcess/API/APIOpenPanelParameters.h [moved from Source/WebKit2/Shared/WebOpenPanelParameters.h with 78% similarity]
Source/WebKit2/UIProcess/API/APIUIClient.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKOpenPanelParametersRef.cpp
Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParameters.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParameters.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h
Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.h
Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Tools/ChangeLog
Tools/MiniBrowser/mac/WK2BrowserWindowController.m