Source/WebKit2/ChangeLog

 12014-10-15 Brian Michel <brian.michel@gmail.com>
 2
 3 [Mac] Handle Open Panel Functions Are Unimplemented
 4 https://bugs.webkit.org/show_bug.cgi?id=137759
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The "handleRunOpenPanel" was unimplemented for the Mac implementation
 9 of PageClientImpl which resulted in nothing happening if an end user
 10 clicked an input field located in a WKWebView.
 11
 12 I could not find any existing tests for PageClientImpl so I did not
 13 add any new tests for this class.
 14
 15 * UIProcess/mac/PageClientImpl.h:
 16 * UIProcess/mac/PageClientImpl.mm:
 17 (WebKit::PageClientImpl::handleRunOpenPanel):
 18
1192014-10-15 Dan Bernstein <mitz@apple.com>
220
321 [Cocoa] "Plug-in will handle load" error isn't declared in the modern API

Source/WebKit2/UIProcess/mac/PageClientImpl.h

@@private:
8888 virtual void setCursorHiddenUntilMouseMoves(bool);
8989 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
9090
 91 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;
9192 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
9293 virtual void clearAllEditCommands();
9394 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);

Source/WebKit2/UIProcess/mac/PageClientImpl.mm

4242#import "WKAPICast.h"
4343#import "WKFullScreenWindowController.h"
4444#import "WKStringCF.h"
 45#import "WKURLCF.h"
4546#import "WKViewInternal.h"
4647#import "WKWebViewInternal.h"
4748#import "WebColorPickerMac.h"
4849#import "WebContextMenuProxyMac.h"
4950#import "WebEditCommandProxy.h"
 51#import "WebOpenPanelParameters.h"
 52#import "WebOpenPanelResultListenerProxy.h"
5053#import "WebPopupMenuProxyMac.h"
5154#import "WindowServerConnection.h"
5255#import "_WKDownloadInternal.h"

@@void PageClientImpl::didCommitLoadForMainFrame(const String& mimeType, bool useC
307310void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference& dataReference)
308311{
309312}
 313
 314bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener)
 315{
 316 if (!m_wkView) {
 317 listener->invalidate();
 318 return false;
 319 }
 320
 321 NSWindow *window = [m_wkView window];
 322
 323 if (!window) {
 324 listener->invalidate();
 325 return false;
 326 }
 327
 328 NSOpenPanel *panel = [NSOpenPanel openPanel];
 329 [panel setAllowsMultipleSelection:parameters->allowMultipleFiles()];
 330
 331 [panel beginSheetModalForWindow:window completionHandler:^(NSInteger result)
 332 {
 333 if (NSFileHandlingPanelCancelButton == result)
 334 listener->cancel();
 335 else {
 336 NSArray *fileURLs = [panel URLs];
 337 NSUInteger count = [fileURLs count];
 338 if (!count)
 339 listener->cancel();
 340 else {
 341 Vector<RefPtr<API::Object>> urls;
 342 urls.reserveInitialCapacity(count);
 343 for (NSURL *fileURL in fileURLs)
 344 urls.uncheckedAppend(adoptRef(toImpl(WKURLCreateWithCFURL((CFURLRef)fileURL))));
 345 RefPtr<API::Array> fileURLsRef = API::Array::create(WTF::move(urls));
 346
 347 listener->chooseFiles(fileURLsRef.get());
 348 }
 349 }
 350
 351 }];
 352
 353 return true;
 354}
310355
311356void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
312357{