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:
Marshall Greenblatt 2012-11-26 20:01:27 +00:00
parent 357dfc75af
commit 6110b7ebfa
1 changed files with 12 additions and 2 deletions

View File

@ -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;