2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #import "WebChromeClient.h"
32 #import <Foundation/Foundation.h>
33 #import "WebDefaultUIDelegate.h"
34 #import "WebElementDictionary.h"
35 #import "WebFrameInternal.h"
36 #import "WebFrameView.h"
37 #import "WebHTMLViewInternal.h"
38 #import "WebHistoryInternal.h"
39 #import "WebKitSystemInterface.h"
40 #import "WebKitPrefix.h"
41 #import "WebNSURLRequestExtras.h"
43 #import "WebSecurityOriginInternal.h"
44 #import "WebUIDelegatePrivate.h"
46 #import "WebViewInternal.h"
47 #import <WebCore/BlockExceptions.h>
48 #import <WebCore/FileChooser.h>
49 #import <WebCore/FloatRect.h>
50 #import <WebCore/Frame.h>
51 #import <WebCore/FrameLoadRequest.h>
52 #import <WebCore/HitTestResult.h>
53 #import <WebCore/IntRect.h>
54 #import <WebCore/Page.h>
55 #import <WebCore/PlatformScreen.h>
56 #import <WebCore/PlatformString.h>
57 #import <WebCore/ResourceRequest.h>
58 #import <WebCore/Widget.h>
59 #import <WebCore/WindowFeatures.h>
60 #import <wtf/PassRefPtr.h>
61 #import <wtf/Vector.h>
63 @interface NSView (WebNSViewDetails)
64 - (NSView *)_findLastViewInKeyViewLoop;
67 // For compatibility with old SPI.
68 @interface NSView (WebOldWebKitPlugInDetails)
69 - (void)setIsSelected:(BOOL)isSelected;
72 @interface NSWindow (AppKitSecretsIKnowAbout)
73 - (NSRect)_growBoxRect;
76 using namespace WebCore;
78 @interface WebOpenPanelResultListener : NSObject <WebOpenPanelResultListener> {
79 FileChooser* _chooser;
81 - (id)initWithChooser:(PassRefPtr<FileChooser>)chooser;
84 WebChromeClient::WebChromeClient(WebView *webView)
89 void WebChromeClient::chromeDestroyed()
94 // These functions scale between window and WebView coordinates because JavaScript/DOM operations
95 // assume that the WebView and the window share the same coordinate system.
97 void WebChromeClient::setWindowRect(const FloatRect& rect)
99 NSRect windowRect = toDeviceSpace(rect, [m_webView window]);
100 [[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect];
103 FloatRect WebChromeClient::windowRect()
105 NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView];
106 return toUserSpace(windowRect, [m_webView window]);
109 // FIXME: We need to add API for setting and getting this.
110 FloatRect WebChromeClient::pageRect()
112 return [m_webView frame];
115 float WebChromeClient::scaleFactor()
117 if (NSWindow *window = [m_webView window])
118 return [window userSpaceScaleFactor];
119 return [[NSScreen mainScreen] userSpaceScaleFactor];
122 void WebChromeClient::focus()
124 [[m_webView _UIDelegateForwarder] webViewFocus:m_webView];
127 void WebChromeClient::unfocus()
129 [[m_webView _UIDelegateForwarder] webViewUnfocus:m_webView];
132 bool WebChromeClient::canTakeFocus(FocusDirection)
134 // There's unfortunately no way to determine if we will become first responder again
135 // once we give it up, so we just have to guess that we won't.
139 void WebChromeClient::takeFocus(FocusDirection direction)
141 if (direction == FocusDirectionForward) {
142 // Since we're trying to move focus out of m_webView, and because
143 // m_webView may contain subviews within it, we ask it for the next key
144 // view of the last view in its key view loop. This makes m_webView
145 // behave as if it had no subviews, which is the behavior we want.
146 NSView *lastView = [m_webView _findLastViewInKeyViewLoop];
147 // avoid triggering assertions if the WebView is the only thing in the key loop
148 if ([m_webView _becomingFirstResponderFromOutside] && m_webView == [lastView nextValidKeyView])
150 [[m_webView window] selectKeyViewFollowingView:lastView];
152 // avoid triggering assertions if the WebView is the only thing in the key loop
153 if ([m_webView _becomingFirstResponderFromOutside] && m_webView == [m_webView previousValidKeyView])
155 [[m_webView window] selectKeyViewPrecedingView:m_webView];
159 Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features)
161 NSURLRequest *URLRequest = nil;
162 if (!request.isEmpty())
163 URLRequest = request.resourceRequest().nsURLRequest();
165 id delegate = [m_webView UIDelegate];
168 if ([delegate respondsToSelector:@selector(webView:createWebViewWithRequest:windowFeatures:)]) {
169 NSNumber *x = features.xSet ? [[NSNumber alloc] initWithFloat:features.x] : nil;
170 NSNumber *y = features.ySet ? [[NSNumber alloc] initWithFloat:features.y] : nil;
171 NSNumber *width = features.widthSet ? [[NSNumber alloc] initWithFloat:features.width] : nil;
172 NSNumber *height = features.heightSet ? [[NSNumber alloc] initWithFloat:features.height] : nil;
173 NSNumber *menuBarVisible = [[NSNumber alloc] initWithBool:features.menuBarVisible];
174 NSNumber *statusBarVisible = [[NSNumber alloc] initWithBool:features.statusBarVisible];
175 NSNumber *toolBarVisible = [[NSNumber alloc] initWithBool:features.toolBarVisible];
176 NSNumber *scrollbarsVisible = [[NSNumber alloc] initWithBool:features.scrollbarsVisible];
177 NSNumber *resizable = [[NSNumber alloc] initWithBool:features.resizable];
178 NSNumber *fullscreen = [[NSNumber alloc] initWithBool:features.fullscreen];
179 NSNumber *dialog = [[NSNumber alloc] initWithBool:features.dialog];
181 NSMutableDictionary *dictFeatures = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
182 menuBarVisible, @"menuBarVisible",
183 statusBarVisible, @"statusBarVisible",
184 toolBarVisible, @"toolBarVisible",
185 scrollbarsVisible, @"scrollbarsVisible",
186 resizable, @"resizable",
187 fullscreen, @"fullscreen",
192 [dictFeatures setObject:x forKey:@"x"];
194 [dictFeatures setObject:y forKey:@"y"];
196 [dictFeatures setObject:width forKey:@"width"];
198 [dictFeatures setObject:height forKey:@"height"];
200 newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:windowFeatures:), URLRequest, dictFeatures);
202 [dictFeatures release];
207 [menuBarVisible release];
208 [statusBarVisible release];
209 [toolBarVisible release];
210 [scrollbarsVisible release];
212 [fullscreen release];
214 } else if (features.dialog && [delegate respondsToSelector:@selector(webView:createWebViewModalDialogWithRequest:)]) {
215 newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewModalDialogWithRequest:), URLRequest);
217 newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:), URLRequest);
220 return core(newWebView);
223 void WebChromeClient::show()
225 [[m_webView _UIDelegateForwarder] webViewShow:m_webView];
228 bool WebChromeClient::canRunModal()
230 return [[m_webView UIDelegate] respondsToSelector:@selector(webViewRunModal:)];
233 void WebChromeClient::runModal()
235 CallUIDelegate(m_webView, @selector(webViewRunModal:));
238 void WebChromeClient::setToolbarsVisible(bool b)
240 [[m_webView _UIDelegateForwarder] webView:m_webView setToolbarsVisible:b];
243 bool WebChromeClient::toolbarsVisible()
245 return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webViewAreToolbarsVisible:));
248 void WebChromeClient::setStatusbarVisible(bool b)
250 [[m_webView _UIDelegateForwarder] webView:m_webView setStatusBarVisible:b];
253 bool WebChromeClient::statusbarVisible()
255 return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webViewIsStatusBarVisible:));
258 void WebChromeClient::setScrollbarsVisible(bool b)
260 [[[m_webView mainFrame] frameView] setAllowsScrolling:b];
263 bool WebChromeClient::scrollbarsVisible()
265 return [[[m_webView mainFrame] frameView] allowsScrolling];
268 void WebChromeClient::setMenubarVisible(bool)
270 // The menubar is always visible in Mac OS X.
274 bool WebChromeClient::menubarVisible()
276 // The menubar is always visible in Mac OS X.
280 void WebChromeClient::setResizable(bool b)
282 [[m_webView _UIDelegateForwarder] webView:m_webView setResizable:b];
285 void WebChromeClient::addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceURL)
287 id delegate = [m_webView UIDelegate];
288 SEL selector = @selector(webView:addMessageToConsole:);
289 if (![delegate respondsToSelector:selector])
292 NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
293 (NSString *)message, @"message", [NSNumber numberWithUnsignedInt:lineNumber], @"lineNumber",
294 (NSString *)sourceURL, @"sourceURL", NULL];
296 CallUIDelegate(m_webView, selector, dictionary);
298 [dictionary release];
301 bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
303 return [[m_webView UIDelegate] respondsToSelector:@selector(webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:)];
306 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
308 return CallUIDelegateReturningBoolean(true, m_webView, @selector(webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:), message, kit(frame));
311 void WebChromeClient::closeWindowSoon()
313 // We need to remove the parent WebView from WebViewSets here, before it actually
314 // closes, to make sure that JavaScript code that executes before it closes
315 // can't find it. Otherwise, window.open will select a closed WebView instead of
316 // opening a new one <rdar://problem/3572585>.
318 // We also need to stop the load to prevent further parsing or JavaScript execution
319 // after the window has torn down <rdar://problem/4161660>.
321 // FIXME: This code assumes that the UI delegate will respond to a webViewClose
322 // message by actually closing the WebView. Safari guarantees this behavior, but other apps might not.
323 // This approach is an inherent limitation of not making a close execute immediately
324 // after a call to window.close.
326 [m_webView setGroupName:nil];
327 [m_webView stopLoading:nil];
328 [m_webView performSelector:@selector(_closeWindow) withObject:nil afterDelay:0.0];
331 void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& message)
333 id delegate = [m_webView UIDelegate];
334 SEL selector = @selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:);
335 if ([delegate respondsToSelector:selector]) {
336 CallUIDelegate(m_webView, selector, message, kit(frame));
340 // Call the old version of the delegate method if it is implemented.
341 selector = @selector(webView:runJavaScriptAlertPanelWithMessage:);
342 if ([delegate respondsToSelector:selector]) {
343 CallUIDelegate(m_webView, selector, message);
348 bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
350 id delegate = [m_webView UIDelegate];
351 SEL selector = @selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:);
352 if ([delegate respondsToSelector:selector])
353 return CallUIDelegateReturningBoolean(NO, m_webView, selector, message, kit(frame));
355 // Call the old version of the delegate method if it is implemented.
356 selector = @selector(webView:runJavaScriptConfirmPanelWithMessage:);
357 if ([delegate respondsToSelector:selector])
358 return CallUIDelegateReturningBoolean(NO, m_webView, selector, message);
363 bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& prompt, const String& defaultText, String& result)
365 id delegate = [m_webView UIDelegate];
366 SEL selector = @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:);
367 if ([delegate respondsToSelector:selector]) {
368 result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultText, kit(frame));
369 return !result.isNull();
372 // Call the old version of the delegate method if it is implemented.
373 selector = @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:);
374 if ([delegate respondsToSelector:selector]) {
375 result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultText);
376 return !result.isNull();
379 result = [[WebDefaultUIDelegate sharedUIDelegate] webView:m_webView runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText initiatedByFrame:kit(frame)];
380 return !result.isNull();
383 bool WebChromeClient::shouldInterruptJavaScript()
385 return CallUIDelegate(m_webView, @selector(webViewShouldInterruptJavaScript:));
388 void WebChromeClient::setStatusbarText(const String& status)
390 // We want the temporaries allocated here to be released even before returning to the
391 // event loop; see <http://bugs.webkit.org/show_bug.cgi?id=9880>.
392 NSAutoreleasePool* localPool = [[NSAutoreleasePool alloc] init];
393 CallUIDelegate(m_webView, @selector(webView:setStatusText:), (NSString *)status);
397 bool WebChromeClient::tabsToLinks() const
399 return [[m_webView preferences] tabsToLinks];
402 IntRect WebChromeClient::windowResizerRect() const
404 NSRect rect = [[m_webView window] _growBoxRect];
405 if ([m_webView _usesDocumentViews])
406 return enclosingIntRect(rect);
407 return enclosingIntRect([m_webView convertRect:rect fromView:nil]);
410 void WebChromeClient::repaint(const IntRect& rect, bool contentChanged, bool immediate, bool repaintContentOnly)
412 if ([m_webView _usesDocumentViews])
416 [m_webView setNeedsDisplayInRect:rect];
419 [[m_webView window] displayIfNeeded];
420 [[m_webView window] flushWindowIfNeeded];
424 void WebChromeClient::scroll(const IntSize&, const IntRect&, const IntRect&)
428 IntPoint WebChromeClient::screenToWindow(const IntPoint& p) const
430 if ([m_webView _usesDocumentViews])
432 NSPoint windowCoord = [[m_webView window] convertScreenToBase:p];
433 return IntPoint([m_webView convertPoint:windowCoord fromView:nil]);
436 IntRect WebChromeClient::windowToScreen(const IntRect& r) const
438 if ([m_webView _usesDocumentViews])
441 tempRect = [m_webView convertRect:tempRect toView:nil];
442 tempRect.origin = [[m_webView window] convertBaseToScreen:tempRect.origin];
443 return enclosingIntRect(tempRect);
446 PlatformWidget WebChromeClient::platformWindow() const
448 if ([m_webView _usesDocumentViews])
452 // End host window methods.
454 void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
456 WebElementDictionary *element = [[WebElementDictionary alloc] initWithHitTestResult:result];
457 [m_webView _mouseDidMoveOverElement:element modifierFlags:modifierFlags];
461 void WebChromeClient::setToolTip(const String& toolTip)
463 [(WebHTMLView *)[[[m_webView mainFrame] frameView] documentView] _setToolTip:toolTip];
466 void WebChromeClient::print(Frame* frame)
468 WebFrameView* frameView = [kit(frame) frameView];
469 CallUIDelegate(m_webView, @selector(webView:printFrameView:), frameView);
472 void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
474 BEGIN_BLOCK_OBJC_EXCEPTIONS;
476 WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
477 // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
478 if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
479 const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
480 [webOrigin setQuota:defaultQuota];
482 CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
485 END_BLOCK_OBJC_EXCEPTIONS;
488 void WebChromeClient::populateVisitedLinks()
490 BEGIN_BLOCK_OBJC_EXCEPTIONS;
491 [[WebHistory optionalSharedHistory] _addVisitedLinksToPageGroup:[m_webView page]->group()];
492 END_BLOCK_OBJC_EXCEPTIONS;
495 #if ENABLE(DASHBOARD_SUPPORT)
496 void WebChromeClient::dashboardRegionsChanged()
498 BEGIN_BLOCK_OBJC_EXCEPTIONS;
500 NSMutableDictionary *regions = core([m_webView mainFrame])->dashboardRegionsDictionary();
501 [m_webView _addScrollerDashboardRegions:regions];
503 CallUIDelegate(m_webView, @selector(webView:dashboardRegionsChanged:), regions);
505 END_BLOCK_OBJC_EXCEPTIONS;
509 FloatRect WebChromeClient::customHighlightRect(Node* node, const AtomicString& type, const FloatRect& lineRect)
511 BEGIN_BLOCK_OBJC_EXCEPTIONS;
513 NSView *documentView = [[kit(node->document()->frame()) frameView] documentView];
514 if (![documentView isKindOfClass:[WebHTMLView class]])
517 WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
518 id<WebHTMLHighlighter> highlighter = [webHTMLView _highlighterForType:type];
519 if ([(NSObject *)highlighter respondsToSelector:@selector(highlightRectForLine:representedNode:)])
520 return [highlighter highlightRectForLine:lineRect representedNode:kit(node)];
521 return [highlighter highlightRectForLine:lineRect];
523 END_BLOCK_OBJC_EXCEPTIONS;
528 void WebChromeClient::paintCustomHighlight(Node* node, const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect,
529 bool behindText, bool entireLine)
531 BEGIN_BLOCK_OBJC_EXCEPTIONS;
533 NSView *documentView = [[kit(node->document()->frame()) frameView] documentView];
534 if (![documentView isKindOfClass:[WebHTMLView class]])
537 WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
538 id<WebHTMLHighlighter> highlighter = [webHTMLView _highlighterForType:type];
539 if ([(NSObject *)highlighter respondsToSelector:@selector(paintHighlightForBox:onLine:behindText:entireLine:representedNode:)])
540 [highlighter paintHighlightForBox:boxRect onLine:lineRect behindText:behindText entireLine:entireLine representedNode:kit(node)];
542 [highlighter paintHighlightForBox:boxRect onLine:lineRect behindText:behindText entireLine:entireLine];
544 END_BLOCK_OBJC_EXCEPTIONS;
547 void WebChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
549 BEGIN_BLOCK_OBJC_EXCEPTIONS;
550 BOOL allowMultipleFiles = chooser->allowsMultipleFiles();
551 WebOpenPanelResultListener *listener = [[WebOpenPanelResultListener alloc] initWithChooser:chooser];
552 id delegate = [m_webView UIDelegate];
553 if ([delegate respondsToSelector:@selector(webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:)])
554 CallUIDelegate(m_webView, @selector(webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:), listener, allowMultipleFiles);
556 CallUIDelegate(m_webView, @selector(webView:runOpenPanelForFileButtonWithResultListener:), listener);
558 END_BLOCK_OBJC_EXCEPTIONS;
561 KeyboardUIMode WebChromeClient::keyboardUIMode()
563 BEGIN_BLOCK_OBJC_EXCEPTIONS;
564 return [m_webView _keyboardUIMode];
565 END_BLOCK_OBJC_EXCEPTIONS;
566 return KeyboardAccessDefault;
569 NSResponder *WebChromeClient::firstResponder()
571 BEGIN_BLOCK_OBJC_EXCEPTIONS;
572 return [[m_webView _UIDelegateForwarder] webViewFirstResponder:m_webView];
573 END_BLOCK_OBJC_EXCEPTIONS;
577 void WebChromeClient::makeFirstResponder(NSResponder *responder)
579 BEGIN_BLOCK_OBJC_EXCEPTIONS;
580 [m_webView _pushPerformingProgrammaticFocus];
581 [[m_webView _UIDelegateForwarder] webView:m_webView makeFirstResponder:responder];
582 [m_webView _popPerformingProgrammaticFocus];
583 END_BLOCK_OBJC_EXCEPTIONS;
586 void WebChromeClient::willPopUpMenu(NSMenu *menu)
588 BEGIN_BLOCK_OBJC_EXCEPTIONS;
589 CallUIDelegate(m_webView, @selector(webView:willPopupMenu:), menu);
590 END_BLOCK_OBJC_EXCEPTIONS;
593 bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename)
596 if (![[m_webView _UIDelegateForwarder] webView:m_webView shouldReplaceUploadFile:path usingGeneratedFilename:&filename])
598 generatedFilename = filename;
602 String WebChromeClient::generateReplacementFile(const String& path)
604 return [[m_webView _UIDelegateForwarder] webView:m_webView generateReplacementFile:path];
607 void WebChromeClient::disableSuddenTermination()
609 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
610 [[NSProcessInfo processInfo] disableSuddenTermination];
614 void WebChromeClient::enableSuddenTermination()
616 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
617 [[NSProcessInfo processInfo] enableSuddenTermination];
621 @implementation WebOpenPanelResultListener
623 - (id)initWithChooser:(PassRefPtr<FileChooser>)chooser
628 _chooser = chooser.releaseRef();
657 - (void)chooseFilename:(NSString *)filename
662 _chooser->chooseFile(filename);
667 - (void)chooseFilenames:(NSArray *)filenames
672 int count = [filenames count];
673 Vector<String> names(count);
674 for (int i = 0; i < count; i++)
675 names[i] = [filenames objectAtIndex:i];
676 _chooser->chooseFiles(names);