Changeset 199554 in webkit
- Timestamp:
- Apr 14, 2016 2:21:57 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
- 3 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r199532 r199554 1 2016-04-14 Anders Carlsson <andersca@apple.com> 2 3 [Mac] Add API for open panel handling to WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=137759 5 rdar://problem/23278623 6 7 Reviewed by Tim Horton. 8 9 Based on a patch by Brian Michel. 10 11 * Shared/API/Cocoa/WebKit.h: 12 Import WKOpenPanelParameters.h. 13 14 * Shared/Cocoa/APIObject.mm: 15 (API::Object::newObject): 16 Create a WKOpenPanelParameters for Type::OpenPanelParameters. 17 18 * UIProcess/API/APIOpenPanelParameters.cpp: Renamed from Source/WebKit2/Shared/WebOpenPanelParameters.cpp. 19 * UIProcess/API/APIOpenPanelParameters.h: Renamed from Source/WebKit2/Shared/WebOpenPanelParameters.h. 20 Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters. 21 22 * UIProcess/API/APIUIClient.h: 23 (API::UIClient::runOpenPanel): 24 Change this to take a SecurityOriginData. 25 26 * UIProcess/API/C/WKAPICast.h: 27 * UIProcess/API/C/WKOpenPanelParametersRef.cpp: 28 (WKOpenPanelParametersGetTypeID): 29 Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters. 30 31 * UIProcess/API/C/WKOpenPanelResultListener.cpp: 32 (filePathsFromFileURLs): 33 (WKOpenPanelResultListenerChooseFiles): 34 * UIProcess/API/C/WKPage.cpp: 35 (WKPageSetPageUIClient): 36 Change chooseFiles to take a Vector<String> instead of an API::Array of URLs. 37 38 * UIProcess/API/Cocoa/WKOpenPanelParameters.h: Added. 39 * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: Added. 40 (-[WKOpenPanelParameters allowsMultipleSelection]): 41 (-[WKOpenPanelParameters _apiObject]): 42 * UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h: 43 Add a WKOpenPanelParameters class which contains information about a file upload control. 44 45 * UIProcess/API/Cocoa/WKUIDelegate.h: 46 Add new delegate method. 47 48 * UIProcess/Cocoa/UIDelegate.h: 49 * UIProcess/Cocoa/UIDelegate.mm: 50 (WebKit::UIDelegate::setDelegate): 51 Record whether the UI delegate implements the new delegate method. 52 53 (WebKit::UIDelegate::UIClient::runOpenPanel): 54 Invoke the new delegate method. 55 56 * UIProcess/PageClient.h: 57 (WebKit::PageClient::handleRunOpenPanel): 58 Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters. 59 60 * UIProcess/WebOpenPanelResultListenerProxy.cpp: 61 (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): 62 * UIProcess/WebOpenPanelResultListenerProxy.h: 63 Change chooseFiles to take a Vector<String> instead of an API::Array of URLs. 64 65 * UIProcess/WebPageProxy.cpp: 66 (WebKit::WebPageProxy::runOpenPanel): 67 * UIProcess/WebPageProxy.h: 68 Change this to take a SecurityOriginData. 69 70 * UIProcess/WebPageProxy.messages.in: 71 Change RunOpenPanel to take a SecurityOriginData. 72 73 * UIProcess/ios/PageClientImplIOS.h: 74 * UIProcess/ios/PageClientImplIOS.mm: 75 (WebKit::PageClientImpl::handleRunOpenPanel): 76 Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters. 77 78 * UIProcess/ios/WKContentViewInteraction.h: 79 * UIProcess/ios/WKContentViewInteraction.mm: 80 (-[WKContentView _showRunOpenPanel:resultListener:]): 81 Change chooseFiles to take a Vector<String> instead of an API::Array of URLs. 82 83 * UIProcess/ios/forms/WKFileUploadPanel.h: 84 * UIProcess/ios/forms/WKFileUploadPanel.mm: 85 (-[WKFileUploadPanel _chooseFiles:displayString:iconImage:]): 86 Change chooseFiles to take a Vector<String> instead of an API::Array of URLs. 87 88 (-[WKFileUploadPanel presentWithParameters:resultListener:]): 89 Rename WebKit::WebOpenPanelParameters to API::OpenPanelParameters. 90 91 * WebKit2.xcodeproj/project.pbxproj: 92 Add new file. 93 94 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 95 (WebKit::WebChromeClient::runOpenPanel): 96 Pass the security origin of the frame along. 97 1 98 2016-04-14 Alex Christensen <achristensen@webkit.org> 2 99 -
trunk/Source/WebKit2/Shared/API/Cocoa/WebKit.h
r198070 r199554 34 34 #import <WebKit/WKNavigationDelegate.h> 35 35 #import <WebKit/WKNavigationResponse.h> 36 #import <WebKit/WKOpenPanelParameters.h> 36 37 #import <WebKit/WKPreferences.h> 37 38 #import <WebKit/WKPreviewActionItem.h> -
trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm
r197172 r199554 47 47 #import "WKNavigationInternal.h" 48 48 #import "WKNavigationResponseInternal.h" 49 #import "WKOpenPanelParametersInternal.h" 49 50 #import "WKPreferencesInternal.h" 50 51 #import "WKProcessPoolInternal.h" … … 182 183 break; 183 184 185 case Type::OpenPanelParameters: 186 wrapper = [WKOpenPanelParameters alloc]; 187 break; 188 184 189 case Type::PageGroup: 185 190 wrapper = [WKBrowsingContextGroup alloc]; -
trunk/Source/WebKit2/UIProcess/API/APIOpenPanelParameters.cpp
r199552 r199554 26 26 27 27 #include "config.h" 28 #include " WebOpenPanelParameters.h"28 #include "APIOpenPanelParameters.h" 29 29 30 30 #include "APIArray.h" … … 34 34 using namespace WebCore; 35 35 36 namespace WebKit{36 namespace API { 37 37 38 PassRefPtr<WebOpenPanelParameters> WebOpenPanelParameters::create(const FileChooserSettings& settings)38 Ref<OpenPanelParameters> OpenPanelParameters::create(const FileChooserSettings& settings) 39 39 { 40 return adoptRef( new WebOpenPanelParameters(settings));40 return adoptRef(*new OpenPanelParameters(settings)); 41 41 } 42 42 43 WebOpenPanelParameters::WebOpenPanelParameters(const FileChooserSettings& settings)43 OpenPanelParameters::OpenPanelParameters(const FileChooserSettings& settings) 44 44 : m_settings(settings) 45 45 { 46 46 } 47 47 48 WebOpenPanelParameters::~WebOpenPanelParameters()48 OpenPanelParameters::~OpenPanelParameters() 49 49 { 50 50 } 51 51 52 Ref<API::Array> WebOpenPanelParameters::acceptMIMETypes() const52 Ref<API::Array> OpenPanelParameters::acceptMIMETypes() const 53 53 { 54 54 return API::Array::createStringArray(m_settings.acceptMIMETypes); … … 56 56 57 57 #if ENABLE(MEDIA_CAPTURE) 58 bool WebOpenPanelParameters::capture() const58 bool OpenPanelParameters::capture() const 59 59 { 60 60 return m_settings.capture; … … 62 62 #endif 63 63 64 Ref<API::Array> WebOpenPanelParameters::selectedFileNames() const64 Ref<API::Array> OpenPanelParameters::selectedFileNames() const 65 65 { 66 66 return API::Array::createStringArray(m_settings.selectedFiles); -
trunk/Source/WebKit2/UIProcess/API/APIOpenPanelParameters.h
r199552 r199554 25 25 */ 26 26 27 #ifndef WebOpenPanelParameters_h 28 #define WebOpenPanelParameters_h 27 #pragma once 29 28 30 29 #include "APIObject.h" 31 30 #include <WebCore/FileChooser.h> 32 #include <wtf/Vector.h>33 #include <wtf/text/WTFString.h>34 31 35 32 namespace API { 33 36 34 class Array; 37 }38 35 39 namespace WebKit { 40 41 class WebOpenPanelParameters : public API::ObjectImpl<API::Object::Type::OpenPanelParameters> { 36 class OpenPanelParameters : public API::ObjectImpl<API::Object::Type::OpenPanelParameters> { 42 37 public: 43 static PassRefPtr<WebOpenPanelParameters> create(const WebCore::FileChooserSettings&);44 ~ WebOpenPanelParameters();38 static Ref<OpenPanelParameters> create(const WebCore::FileChooserSettings&); 39 ~OpenPanelParameters(); 45 40 46 41 bool allowMultipleFiles() const { return m_settings.allowsMultipleFiles; } … … 52 47 53 48 private: 54 explicit WebOpenPanelParameters(const WebCore::FileChooserSettings&);49 explicit OpenPanelParameters(const WebCore::FileChooserSettings&); 55 50 56 51 WebCore::FileChooserSettings m_settings; 57 52 }; 58 53 59 } // namespace WebKit 60 61 #endif // WebOpenPanelParameters_h 54 } // namespace API -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r197114 r199554 56 56 class WebColorPickerResultListenerProxy; 57 57 class WebFrameProxy; 58 class WebOpenPanelParameters;59 58 class WebOpenPanelResultListenerProxy; 60 59 class WebPageProxy; … … 71 70 class Dictionary; 72 71 class Object; 72 class OpenPanelParameters; 73 73 class SecurityOrigin; 74 74 … … 131 131 } 132 132 133 virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebOpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }133 virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::SecurityOriginData&, OpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; } 134 134 virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, SecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; } 135 135 virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy&) { return false; } -
trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h
r197114 r199554 59 59 class NavigationData; 60 60 class NavigationResponse; 61 class OpenPanelParameters; 61 62 class PageConfiguration; 62 63 class ProcessPoolConfiguration; … … 98 99 class WebNotificationManagerProxy; 99 100 class WebNotificationProvider; 100 class WebOpenPanelParameters;101 101 class WebOpenPanelResultListenerProxy; 102 102 class WebPageGroup; … … 147 147 WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider) 148 148 WK_ADD_API_MAPPING(WKNotificationRef, WebNotification) 149 WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)149 WK_ADD_API_MAPPING(WKOpenPanelParametersRef, API::OpenPanelParameters) 150 150 WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) 151 151 WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup) -
trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParametersRef.cpp
r199311 r199554 29 29 30 30 #include "APIArray.h" 31 #include "APIOpenPanelParameters.h" 31 32 #include "WKAPICast.h" 32 #include "WebOpenPanelParameters.h"33 33 34 34 using namespace WebKit; … … 36 36 WKTypeID WKOpenPanelParametersGetTypeID() 37 37 { 38 return toAPI( WebOpenPanelParameters::APIType);38 return toAPI(API::OpenPanelParameters::APIType); 39 39 } 40 40 -
trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp
r95901 r199554 29 29 #include "WKAPICast.h" 30 30 #include "WebOpenPanelResultListenerProxy.h" 31 #include <WebCore/URL.h> 31 32 32 33 using namespace WebKit; … … 37 38 } 38 39 40 static Vector<String> filePathsFromFileURLs(const API::Array& fileURLs) 41 { 42 Vector<String> filePaths; 43 44 size_t size = fileURLs.size(); 45 filePaths.reserveInitialCapacity(size); 46 47 for (size_t i = 0; i < size; ++i) { 48 API::URL* apiURL = fileURLs.at<API::URL>(i); 49 if (apiURL) 50 filePaths.uncheckedAppend(WebCore::URL(WebCore::URL(), apiURL->string()).fileSystemPath()); 51 } 52 53 return filePaths; 54 } 55 39 56 void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef) 40 57 { 41 toImpl(listenerRef)->chooseFiles( toImpl(fileURLsRef));58 toImpl(listenerRef)->chooseFiles(filePathsFromFileURLs(*toImpl(fileURLsRef))); 42 59 } 43 60 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r198476 r199554 41 41 #include "APINavigationClient.h" 42 42 #include "APINavigationResponse.h" 43 #include "APIOpenPanelParameters.h" 43 44 #include "APIPageConfiguration.h" 44 45 #include "APIPolicyClient.h" … … 62 63 #include "WebImage.h" 63 64 #include "WebInspectorProxy.h" 64 #include "WebOpenPanelParameters.h"65 65 #include "WebOpenPanelResultListenerProxy.h" 66 66 #include "WebPageGroup.h" … … 2054 2054 } 2055 2055 2056 bool runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override2056 bool runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, const WebCore::SecurityOriginData&, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override 2057 2057 { 2058 2058 if (!m_client.runOpenPanel) -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParameters.h
r199552 r199554 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #include "config.h" 27 #include "WKOpenPanelResultListener.h" 26 #import <WebKit/WKFoundation.h> 28 27 29 #include "WKAPICast.h" 30 #include "WebOpenPanelResultListenerProxy.h" 28 #if WK_API_ENABLED 31 29 32 using namespace WebKit; 30 #import <Foundation/Foundation.h> 33 31 34 WKTypeID WKOpenPanelResultListenerGetTypeID() 35 { 36 return toAPI(WebOpenPanelResultListenerProxy::APIType); 37 } 32 NS_ASSUME_NONNULL_BEGIN 38 33 39 void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef) 40 { 41 toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef)); 42 } 34 /*! WKOpenPanelParameters contains parameters that a file upload control has specified. 35 */ 36 WK_CLASS_AVAILABLE(WK_MAC_TBA, NA) 37 @interface WKOpenPanelParameters : NSObject 43 38 44 void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef) 45 { 46 toImpl(listenerRef)->cancel(); 47 } 39 /*! @abstract Whether the file upload control supports multiple files. 40 */ 41 @property (nonatomic, readonly) BOOL allowsMultipleSelection; 42 43 @end 44 45 NS_ASSUME_NONNULL_END 46 47 #endif -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParameters.mm
r199552 r199554 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i nclude"config.h"27 #i nclude "WKOpenPanelResultListener.h"26 #import "config.h" 27 #import "WKOpenPanelParametersInternal.h" 28 28 29 #include "WKAPICast.h" 30 #include "WebOpenPanelResultListenerProxy.h" 29 #if WK_API_ENABLED 31 30 32 using namespace WebKit; 31 @implementation WKOpenPanelParameters 33 32 34 WKTypeID WKOpenPanelResultListenerGetTypeID() 33 - (BOOL)allowsMultipleSelection 35 34 { 36 return toAPI(WebOpenPanelResultListenerProxy::APIType);35 return _openPanelParameters->allowMultipleFiles(); 37 36 } 38 37 39 void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef) 38 #pragma mark WKObject protocol implementation 39 40 - (API::Object&)_apiObject 40 41 { 41 toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef));42 return *_openPanelParameters; 42 43 } 43 44 44 void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef) 45 { 46 toImpl(listenerRef)->cancel(); 47 } 45 @end 46 47 #endif -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h
r199552 r199554 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #include "config.h" 27 #include "WKOpenPanelResultListener.h" 26 #import "WKOpenPanelParameters.h" 28 27 29 #include "WKAPICast.h" 30 #include "WebOpenPanelResultListenerProxy.h" 28 #if WK_API_ENABLED 31 29 32 using namespace WebKit; 30 #import "APIOpenPanelParameters.h" 31 #import "WKObject.h" 33 32 34 WKTypeID WKOpenPanelResultListenerGetTypeID() 33 namespace API { 34 35 inline WKOpenPanelParameters *wrapper(OpenPanelParameters& openPanelParameters) 35 36 { 36 return toAPI(WebOpenPanelResultListenerProxy::APIType); 37 ASSERT([openPanelParameters.wrapper() isKindOfClass:[WKOpenPanelParameters class]]); 38 39 return (WKOpenPanelParameters *)openPanelParameters.wrapper(); 37 40 } 38 41 39 void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef)40 {41 toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef));42 42 } 43 43 44 void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef) 45 { 46 toImpl(listenerRef)->cancel();44 @interface WKOpenPanelParameters () <WKObject> { 45 @package 46 API::ObjectStorage<API::OpenPanelParameters> _openPanelParameters; 47 47 } 48 @end 49 50 #endif -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h
r198070 r199554 35 35 @class WKFrameInfo; 36 36 @class WKNavigationAction; 37 @class WKOpenPanelParameters; 37 38 @class WKPreviewElementInfo; 38 39 @class WKWebViewConfiguration; … … 144 145 if a non-nil view controller was returned. 145 146 */ 146 - (nullable UIViewController *)webView:(WKWebView *)webView previewingViewControllerForElement:(WKPreviewElementInfo *)elementInfo defaultActions:(NSArray 147 - (nullable UIViewController *)webView:(WKWebView *)webView previewingViewControllerForElement:(WKPreviewElementInfo *)elementInfo defaultActions:(NSArray<id <WKPreviewActionItem>> *)previewActions WK_AVAILABLE(NA, WK_IOS_TBA); 147 148 148 149 /*! @abstract Allows your app to pop to the view controller it created. … … 154 155 #endif // TARGET_OS_IPHONE 155 156 157 #if !TARGET_OS_IPHONE 158 159 /*! @abstract Displays a file upload panel. 160 @param webView The web view invoking the delegate method. 161 @param parameters Parameters describing the file upload control. 162 @param frame Information about the frame whose file upload control initiated this call. 163 @param completionHandler The completion handler to call after open panel has been dismissed. Pass the selected URLs if the user chose OK, otherwise nil. 164 165 If you do not implement this method, the web view will behave as if the user selected the Cancel button. 166 */ 167 - (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * WK_NULLABLE_SPECIFIER URLs))completionHandler WK_AVAILABLE(WK_MAC_TBA, NA); 168 169 #endif 170 156 171 @end 157 172 -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
r197563 r199554 87 87 void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const WTF::String& databaseName, const WTF::String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)>) override; 88 88 void reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) override; 89 #if PLATFORM(MAC) 90 bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) override; 91 #endif 89 92 void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override; 90 93 #if PLATFORM(IOS) … … 109 112 bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; 110 113 bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; 114 #if PLATFORM(MAC) 115 bool webViewRunOpenPanelWithParametersInitiatedByFrameCompletionHandler : 1; 116 #endif 111 117 bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1; 112 118 bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1; -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
r195623 r199554 33 33 #import "WKFrameInfoInternal.h" 34 34 #import "WKNavigationActionInternal.h" 35 #import "WKOpenPanelParametersInternal.h" 35 36 #import "WKSecurityOriginInternal.h" 36 37 #import "WKWebViewConfigurationInternal.h" … … 38 39 #import "WKWindowFeaturesInternal.h" 39 40 #import "WKUIDelegatePrivate.h" 41 #import "WebOpenPanelResultListenerProxy.h" 40 42 #import "_WKContextMenuElementInfo.h" 41 43 #import "_WKFrameHandleInternal.h" … … 79 81 m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; 80 82 m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; 83 84 #if PLATFORM(MAC) 85 m_delegateMethods.webViewRunOpenPanelWithParametersInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:)]; 86 #endif 87 81 88 m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)]; 82 89 m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)]; … … 251 258 } 252 259 260 #if PLATFORM(MAC) 261 bool UIDelegate::UIClient::runOpenPanel(WebPageProxy*, WebFrameProxy* webFrameProxy, const WebCore::SecurityOriginData& securityOriginData, API::OpenPanelParameters* openPanelParameters, WebOpenPanelResultListenerProxy* listener) 262 { 263 if (!m_uiDelegate.m_delegateMethods.webViewRunOpenPanelWithParametersInitiatedByFrameCompletionHandler) 264 return false; 265 266 auto delegate = m_uiDelegate.m_delegate.get(); 267 if (!delegate) 268 return false; 269 270 auto frame = API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin()); 271 RefPtr<WebOpenPanelResultListenerProxy> resultListener = listener; 272 273 RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:)); 274 275 [delegate webView:m_uiDelegate.m_webView runOpenPanelWithParameters:wrapper(*openPanelParameters) initiatedByFrame:wrapper(frame) completionHandler:[checker, resultListener](NSArray<NSURL *> *URLs) { 276 checker->didCallCompletionHandler(); 277 278 if (!URLs) { 279 resultListener->cancel(); 280 return; 281 } 282 283 Vector<String> filenames; 284 for (NSURL *url in URLs) 285 filenames.append(url.fileSystemRepresentation); 286 287 resultListener->chooseFiles(filenames); 288 }]; 289 290 return true; 291 } 292 #endif 293 253 294 void UIDelegate::UIClient::reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin& securityOrigin, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) 254 295 { -
trunk/Source/WebKit2/UIProcess/PageClient.h
r199233 r199554 152 152 virtual void handleDownloadRequest(DownloadProxy*) = 0; 153 153 154 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) { return false; }154 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) { return false; } 155 155 156 156 virtual void didChangeContentSize(const WebCore::IntSize&) = 0; -
trunk/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
r186279 r199554 46 46 } 47 47 48 static Vector<String> filePathsFromFileURLs(const API::Array& fileURLs)49 {50 Vector<String> filePaths;51 52 size_t size = fileURLs.size();53 filePaths.reserveInitialCapacity(size);54 55 for (size_t i = 0; i < size; ++i) {56 API::URL* apiURL = fileURLs.at<API::URL>(i);57 if (apiURL)58 filePaths.uncheckedAppend(URL(URL(), apiURL->string()).fileSystemPath());59 }60 61 return filePaths;62 }63 64 48 #if PLATFORM(IOS) 65 void WebOpenPanelResultListenerProxy::chooseFiles( API::Array* fileURLsArray, API::String*displayString, const API::Data* iconImageData)49 void WebOpenPanelResultListenerProxy::chooseFiles(const Vector<WTF::String>& filenames, const String& displayString, const API::Data* iconImageData) 66 50 { 67 51 if (!m_page) 68 52 return; 69 53 70 m_page->didChooseFilesForOpenPanelWithDisplayStringAndIcon(file PathsFromFileURLs(*fileURLsArray), displayString ? displayString->string() : String(), iconImageData);54 m_page->didChooseFilesForOpenPanelWithDisplayStringAndIcon(filenames, displayString, iconImageData); 71 55 } 72 56 #endif 73 57 74 void WebOpenPanelResultListenerProxy::chooseFiles( API::Array* fileURLsArray)58 void WebOpenPanelResultListenerProxy::chooseFiles(const Vector<String>& filenames) 75 59 { 76 60 if (!m_page) 77 61 return; 78 62 79 m_page->didChooseFilesForOpenPanel(file PathsFromFileURLs(*fileURLsArray));63 m_page->didChooseFilesForOpenPanel(filenames); 80 64 } 81 65 -
trunk/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h
r168180 r199554 28 28 29 29 #include "APIObject.h" 30 #include <wtf/Forward.h> 30 31 #include <wtf/PassRefPtr.h> 31 32 #include <wtf/RefPtr.h> 33 #include <wtf/Vector.h> 32 34 33 35 namespace API { … … 51 53 52 54 #if PLATFORM(IOS) 53 void chooseFiles( API::Array*, API::String*displayString, const API::Data* iconImageData);55 void chooseFiles(const Vector<String>& filenames, const String& displayString, const API::Data* iconImageData); 54 56 #endif 55 void chooseFiles( API::Array*);57 void chooseFiles(const Vector<String>& filenames); 56 58 void cancel(); 57 59 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r199286 r199554 43 43 #include "APINavigationClient.h" 44 44 #include "APINavigationResponse.h" 45 #include "APIOpenPanelParameters.h" 45 46 #include "APIPageConfiguration.h" 46 47 #include "APIPolicyClient.h" … … 91 92 #include "WebNavigationState.h" 92 93 #include "WebNotificationManagerProxy.h" 93 #include "WebOpenPanelParameters.h"94 94 #include "WebOpenPanelResultListenerProxy.h" 95 95 #include "WebPageCreationParameters.h" … … 3854 3854 } 3855 3855 3856 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)3856 void WebPageProxy::runOpenPanel(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const FileChooserSettings& settings) 3857 3857 { 3858 3858 if (m_openPanelResultListener) { … … 3864 3864 MESSAGE_CHECK(frame); 3865 3865 3866 Ref Ptr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);3866 Ref<API::OpenPanelParameters> parameters = API::OpenPanelParameters::create(settings); 3867 3867 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this); 3868 3868 … … 3870 3870 m_process->responsivenessTimer().stop(); 3871 3871 3872 if (!m_uiClient->runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) { 3873 if (!m_pageClient.handleRunOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) 3872 3873 if (!m_uiClient->runOpenPanel(this, frame, frameSecurityOrigin, parameters.ptr(), m_openPanelResultListener.get())) { 3874 if (!m_pageClient.handleRunOpenPanel(this, frame, parameters.ptr(), m_openPanelResultListener.get())) 3874 3875 didCancelForOpenPanel(); 3875 3876 } -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r199399 r199554 1211 1211 void didChangeViewportProperties(const WebCore::ViewportAttributes&); 1212 1212 void pageDidScroll(); 1213 void runOpenPanel(uint64_t frameID, const WebCore:: FileChooserSettings&);1213 void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&); 1214 1214 void printFrame(uint64_t frameID); 1215 1215 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, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply>); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r199399 r199554 72 72 RunBeforeUnloadConfirmPanel(String message, uint64_t frameID) -> (bool shouldClose) Delayed 73 73 PageDidScroll() 74 RunOpenPanel(uint64_t frameID, struct WebCore:: FileChooserSettings parameters)74 RunOpenPanel(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebCore::FileChooserSettings parameters) 75 75 PrintFrame(uint64_t frameID) -> () 76 76 RunModal() -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r199233 r199554 133 133 void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect) override; 134 134 135 bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;135 bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) override; 136 136 void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) override; 137 137 double minimumZoomScale() const override; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r199233 r199554 561 561 } 562 562 563 bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener)563 bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) 564 564 { 565 565 [m_contentView _showRunOpenPanel:parameters resultListener:listener]; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r198147 r199554 45 45 #import <wtf/text/WTFString.h> 46 46 47 namespace API { 48 class OpenPanelParameters; 49 } 50 47 51 namespace WebCore { 48 52 class Color; … … 54 58 class NativeWebTouchEvent; 55 59 class SmartMagnificationController; 56 class WebOpenPanelParameters;57 60 class WebOpenPanelResultListenerProxy; 58 61 class WebPageProxy; … … 210 213 - (void)_didUpdateBlockSelectionWithTouch:(WebKit::SelectionTouch)touch withFlags:(WebKit::SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold; 211 214 - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect; 212 - (void)_showRunOpenPanel:( WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;215 - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; 213 216 - (void)accessoryDone; 214 217 - (void)_didHandleKeyEvent:(WebIOSEvent *)event eventWasHandled:(BOOL)eventWasHandled; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r199399 r199554 3662 3662 } 3663 3663 3664 - (void)_showRunOpenPanel:( WebOpenPanelParameters*)parameters resultListener:(WebOpenPanelResultListenerProxy*)listener3664 - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebOpenPanelResultListenerProxy*)listener 3665 3665 { 3666 3666 ASSERT(!_fileUploadPanel); -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.h
r168180 r199554 31 31 @protocol WKFileUploadPanelDelegate; 32 32 33 namespace API { 34 class OpenPanelParameters; 35 } 36 33 37 namespace WebKit { 34 class WebOpenPanelParameters;35 38 class WebOpenPanelResultListenerProxy; 36 39 } … … 39 42 @property (nonatomic, assign) id <WKFileUploadPanelDelegate> delegate; 40 43 - (instancetype)initWithView:(WKContentView *)view; 41 - (void)presentWithParameters:( WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;44 - (void)presentWithParameters:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; 42 45 - (void)dismiss; 43 46 @end -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm
r195971 r199554 31 31 #import "APIArray.h" 32 32 #import "APIData.h" 33 #import "APIOpenPanelParameters.h" 33 34 #import "APIString.h" 34 35 #import "UIKitSPI.h" … … 37 38 #import "WKStringCF.h" 38 39 #import "WKURLCF.h" 39 #import "WebOpenPanelParameters.h"40 40 #import "WebOpenPanelResultListenerProxy.h" 41 41 #import "WebPageProxy.h" … … 334 334 } 335 335 336 Vector< RefPtr<API::Object>> urls;337 urls.reserveInitialCapacity(count);336 Vector<String> filenames; 337 filenames.reserveInitialCapacity(count); 338 338 for (NSURL *fileURL in fileURLs) 339 urls.uncheckedAppend(adoptRef(toImpl(WKURLCreateWithCFURL((CFURLRef)fileURL)))); 340 Ref<API::Array> fileURLsRef = API::Array::create(WTFMove(urls)); 339 filenames.uncheckedAppend(fileURL.fileSystemRepresentation); 341 340 342 341 NSData *jpeg = UIImageJPEGRepresentation(iconImage, 1.0); 343 342 RefPtr<API::Data> iconImageDataRef = adoptRef(toImpl(WKDataCreate(reinterpret_cast<const unsigned char*>([jpeg bytes]), [jpeg length]))); 344 343 345 RefPtr<API::String> displayStringRef = adoptRef(toImpl(WKStringCreateWithCFString((CFStringRef)displayString))); 346 347 _listener->chooseFiles(fileURLsRef.ptr(), displayStringRef.get(), iconImageDataRef.get()); 344 _listener->chooseFiles(filenames, displayString, iconImageDataRef.get()); 348 345 [self _dispatchDidDismiss]; 349 346 } … … 351 348 #pragma mark - Present / Dismiss API 352 349 353 - (void)presentWithParameters:( WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener350 - (void)presentWithParameters:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener 354 351 { 355 352 ASSERT(!_listener); -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r199401 r199554 286 286 1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */; }; 287 287 1A66BF8F18A052ED002071B4 /* WKWebViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */; }; 288 1A67CD2E1CBC513F00BFE3EA /* WKOpenPanelParametersInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A67CD2D1CBC513F00BFE3EA /* WKOpenPanelParametersInternal.h */; }; 288 289 1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; }; 289 290 1A6F9FB711E1408500DB1371 /* CommandLinePOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6F9FB611E1408500DB1371 /* CommandLinePOSIX.cpp */; }; … … 437 438 1AC75A1B1B3368270056745B /* HangDetectionDisabler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC75A1A1B3368270056745B /* HangDetectionDisabler.h */; }; 438 439 1AC75A1E1B33695E0056745B /* HangDetectionDisablerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC75A1C1B33695E0056745B /* HangDetectionDisablerMac.mm */; }; 440 1ACC50F11CBC381D003C7D03 /* WKOpenPanelParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1ACC50EF1CBC381D003C7D03 /* WKOpenPanelParameters.mm */; }; 441 1ACC50F21CBC381D003C7D03 /* WKOpenPanelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACC50F01CBC381D003C7D03 /* WKOpenPanelParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; 439 442 1ACC87BA1981C341003D1AF4 /* WKNavigationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACC87B91981C341003D1AF4 /* WKNavigationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 440 443 1ACECD2417162DB1001FC9EF /* StorageAreaMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACECD2217162DB1001FC9EF /* StorageAreaMap.cpp */; }; … … 1505 1508 BC857F8512B82D0B00EDEB2E /* WebOpenPanelResultListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857F8312B82D0B00EDEB2E /* WebOpenPanelResultListener.h */; }; 1506 1509 BC857F8612B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */; }; 1507 BC857FB512B830E600EDEB2E /* WebOpenPanelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */; };1508 BC857FB612B830E600EDEB2E /* WebOpenPanelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */; };1510 BC857FB512B830E600EDEB2E /* APIOpenPanelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857FB312B830E600EDEB2E /* APIOpenPanelParameters.h */; }; 1511 BC857FB612B830E600EDEB2E /* APIOpenPanelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857FB412B830E600EDEB2E /* APIOpenPanelParameters.cpp */; }; 1509 1512 BC857FE612B843D800EDEB2E /* WKOpenPanelParametersRef.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857FE412B843D800EDEB2E /* WKOpenPanelParametersRef.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1510 1513 BC85806212B8505700EDEB2E /* WKOpenPanelResultListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1DFE8E12B31CA8005DF730 /* WKOpenPanelResultListener.cpp */; }; … … 2231 2234 1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIWindowFeatures.h; sourceTree = "<group>"; }; 2232 2235 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewInternal.h; sourceTree = "<group>"; }; 2236 1A67CD2D1CBC513F00BFE3EA /* WKOpenPanelParametersInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParametersInternal.h; sourceTree = "<group>"; }; 2233 2237 1A6D141F1B0167D500785FF0 /* Info-OSX-10.9-10.10.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-OSX-10.9-10.10.plist"; sourceTree = "<group>"; }; 2234 2238 1A6D14211B01681600785FF0 /* PluginService.32-64-10.9-10.10.Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "PluginService.32-64-10.9-10.10.Info.plist"; path = "PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist"; sourceTree = SOURCE_ROOT; }; … … 2405 2409 1AC75A1A1B3368270056745B /* HangDetectionDisabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HangDetectionDisabler.h; sourceTree = "<group>"; }; 2406 2410 1AC75A1C1B33695E0056745B /* HangDetectionDisablerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HangDetectionDisablerMac.mm; sourceTree = "<group>"; }; 2411 1ACC50EF1CBC381D003C7D03 /* WKOpenPanelParameters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKOpenPanelParameters.mm; sourceTree = "<group>"; }; 2412 1ACC50F01CBC381D003C7D03 /* WKOpenPanelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParameters.h; sourceTree = "<group>"; }; 2407 2413 1ACC87B91981C341003D1AF4 /* WKNavigationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationPrivate.h; sourceTree = "<group>"; }; 2408 2414 1ACECD2217162DB1001FC9EF /* StorageAreaMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaMap.cpp; sourceTree = "<group>"; }; … … 3564 3570 BC857F8312B82D0B00EDEB2E /* WebOpenPanelResultListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelResultListener.h; sourceTree = "<group>"; }; 3565 3571 BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOpenPanelResultListener.cpp; sourceTree = "<group>"; }; 3566 BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelParameters.h; sourceTree = "<group>"; };3567 BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOpenPanelParameters.cpp; sourceTree = "<group>"; };3572 BC857FB312B830E600EDEB2E /* APIOpenPanelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIOpenPanelParameters.h; sourceTree = "<group>"; }; 3573 BC857FB412B830E600EDEB2E /* APIOpenPanelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIOpenPanelParameters.cpp; sourceTree = "<group>"; }; 3568 3574 BC857FE412B843D800EDEB2E /* WKOpenPanelParametersRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParametersRef.h; sourceTree = "<group>"; }; 3569 3575 BC857FE512B843D800EDEB2E /* WKOpenPanelParametersRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKOpenPanelParametersRef.cpp; sourceTree = "<group>"; }; … … 4513 4519 C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */, 4514 4520 BCF69F981176CED600471A52 /* WebNavigationDataStore.h */, 4515 BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */,4516 BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */,4517 4521 C06C6093124C14430001682F /* WebPageCreationParameters.cpp */, 4518 4522 C06C6094124C14430001682F /* WebPageCreationParameters.h */, … … 5137 5141 1AD60F5B18E20F4C0020C034 /* WKWindowFeatures.mm */, 5138 5142 1AD60F5F18E20F740020C034 /* WKWindowFeaturesInternal.h */, 5143 1ACC50EF1CBC381D003C7D03 /* WKOpenPanelParameters.mm */, 5144 1ACC50F01CBC381D003C7D03 /* WKOpenPanelParameters.h */, 5145 1A67CD2D1CBC513F00BFE3EA /* WKOpenPanelParametersInternal.h */, 5139 5146 ); 5140 5147 path = Cocoa; … … 5983 5990 99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */, 5984 5991 990D28B31C6526D400986977 /* APIAutomationSessionClient.h */, 5992 BC857FB412B830E600EDEB2E /* APIOpenPanelParameters.cpp */, 5993 BC857FB312B830E600EDEB2E /* APIOpenPanelParameters.h */, 5985 5994 076E884D1A13CADF005E90FC /* APIContextMenuClient.h */, 5986 5995 83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */, … … 7348 7357 A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */, 7349 7358 1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */, 7359 1ACC50F21CBC381D003C7D03 /* WKOpenPanelParameters.h in Headers */, 7350 7360 1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */, 7351 7361 1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */, … … 7708 7718 31A2EC4B148997C200810D71 /* WebNotificationManagerProxy.h in Headers */, 7709 7719 31A2EC4E148997C200810D71 /* WebNotificationProvider.h in Headers */, 7710 BC857FB512B830E600EDEB2E /* WebOpenPanelParameters.h in Headers */,7720 BC857FB512B830E600EDEB2E /* APIOpenPanelParameters.h in Headers */, 7711 7721 BC857F8512B82D0B00EDEB2E /* WebOpenPanelResultListener.h in Headers */, 7712 7722 BC1DFEA412B31F87005DF730 /* WebOpenPanelResultListenerProxy.h in Headers */, … … 7825 7835 51A728DE1B1BAD3800102EEE /* WKBundleNavigationActionPrivate.h in Headers */, 7826 7836 BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */, 7837 1A67CD2E1CBC513F00BFE3EA /* WKOpenPanelParametersInternal.h in Headers */, 7827 7838 BC57450C1263B155006F0F12 /* WKBundleNodeHandlePrivate.h in Headers */, 7828 7839 BC20528111C94284008F3375 /* WKBundlePage.h in Headers */, … … 9036 9047 1A6420E412DCE2FF00CAAE2C /* ShareableBitmap.cpp in Sources */, 9037 9048 C01A260112662F2100C9ED55 /* ShareableBitmapCG.cpp in Sources */, 9049 1ACC50F11CBC381D003C7D03 /* WKOpenPanelParameters.mm in Sources */, 9038 9050 51217460164C20E30037A5C1 /* ShareableResource.cpp in Sources */, 9039 9051 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */, … … 9191 9203 31A2EC4A148997C200810D71 /* WebNotificationManagerProxy.cpp in Sources */, 9192 9204 31A2EC4D148997C200810D71 /* WebNotificationProvider.cpp in Sources */, 9193 BC857FB612B830E600EDEB2E /* WebOpenPanelParameters.cpp in Sources */,9205 BC857FB612B830E600EDEB2E /* APIOpenPanelParameters.cpp in Sources */, 9194 9206 BC857F8612B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp in Sources */, 9195 9207 BC857F7E12B82CEE00EDEB2E /* WebOpenPanelResultListenerProxy.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r199286 r199554 44 44 #include "WebHitTestResultData.h" 45 45 #include "WebImage.h" 46 #include "WebOpenPanelParameters.h"47 46 #include "WebOpenPanelResultListener.h" 48 47 #include "WebPage.h" … … 719 718 ASSERT(webFrame); 720 719 721 m_page->send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), fileChooser->settings()));720 m_page->send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), SecurityOriginData::fromFrame(frame), fileChooser->settings())); 722 721 } 723 722 -
trunk/Tools/ChangeLog
r199550 r199554 1 2016-04-14 Anders Carlsson <andersca@apple.com> 2 3 [Mac] Add API for open panel handling to WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=137759 5 rdar://problem/23278623 6 7 Reviewed by Tim Horton. 8 9 Have MiniBrowser implement the new delegate method. 10 11 * MiniBrowser/mac/WK2BrowserWindowController.m: 12 (-[WK2BrowserWindowController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]): 13 1 14 2016-04-14 Jon Lee <jonlee@apple.com> 2 15 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r198289 r199554 449 449 } 450 450 451 - (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * _Nullable result))completionHandler 452 { 453 NSOpenPanel *openPanel = [NSOpenPanel openPanel]; 454 455 openPanel.allowsMultipleSelection = parameters.allowsMultipleSelection; 456 457 [openPanel beginSheetModalForWindow:webView.window completionHandler:^(NSInteger result) { 458 if (result == NSFileHandlingPanelOKButton) 459 completionHandler(openPanel.URLs); 460 else 461 completionHandler(@[]); 462 }]; 463 } 464 451 465 - (void)updateTextFieldFromURL:(NSURL *)URL 452 466 {
Note: See TracChangeset
for help on using the changeset viewer.