Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: ui/shell_dialogs/select_file_dialog_mac.mm

Issue 616993003: Disable package selection for multiple-selection file dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/select_file_dialog_mac.mm
diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm
index 168ef1da1505ca6445778e585dee5e7311dd6590..3844b06da6aca038eabd03bef4d9fac08baef553 100644
--- a/ui/shell_dialogs/select_file_dialog_mac.mm
+++ b/ui/shell_dialogs/select_file_dialog_mac.mm
@@ -52,7 +52,7 @@ class SelectFileDialogImpl;
parentWindow:(NSWindow*)parentWindow;
// NSSavePanel delegate method
-- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
+- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url;
@end
@@ -161,8 +161,9 @@ void SelectFileDialogImpl::FileWasSelected(
bool SelectFileDialogImpl::ShouldEnableFilename(NSSavePanel* dialog,
NSString* filename) {
- // If this is a single open file dialog, disable selecting packages.
- if (type_map_[dialog] != SELECT_OPEN_FILE)
+ // If this is a single/multiple open file dialog, disable selecting packages.
+ if (type_map_[dialog] != SELECT_OPEN_FILE &&
+ type_map_[dialog] != SELECT_OPEN_MULTI_FILE)
return true;
return ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename];
@@ -425,8 +426,10 @@ bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() {
[panel release];
}
-- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename {
- return selectFileDialogImpl_->ShouldEnableFilename(sender, filename);
+- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url {
+ if (![url isFileURL])
+ return NO;
+ return selectFileDialogImpl_->ShouldEnableFilename(sender, [url path]);
}
@end
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698