Mac: Fix use of deprecated runModalForDirectory:file: signal (issue #792).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@927 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
357dfc75af
commit
6110b7ebfa
|
@ -517,8 +517,18 @@ bool BrowserWebViewDelegate::ShowFileChooser(std::vector<FilePath>& file_names,
|
|||
[dialog setCanChooseFiles:YES];
|
||||
[dialog setCanChooseDirectories:NO];
|
||||
|
||||
NSInteger result = [dialog runModalForDirectory:default_dir
|
||||
file:default_filename];
|
||||
// [NSOpenPanel runModalForDirectory:file:] was deprecated on OS-X 10.7.
|
||||
NSInteger result;
|
||||
if ([NSOpenPanel respondsToSelector:@selector(runModalForDirectory:file:)]) {
|
||||
result = (NSInteger) [dialog performSelector:@selector(runModalForDirectory:file:)
|
||||
withObject:default_dir
|
||||
withObject:default_filename];
|
||||
} else {
|
||||
[dialog setDirectoryURL:[NSURL URLWithString:default_dir]];
|
||||
[dialog setNameFieldStringValue:default_filename];
|
||||
result = [dialog runModal];
|
||||
}
|
||||
|
||||
if (result == NSFileHandlingPanelCancelButton)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue