summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2014-09-30 18:22:54 -0700
committererikchen <erikchen@chromium.org>2014-10-01 01:25:03 +0000
commit1531757622500d102f457979efec0ac9ac5deb72 (patch)
treec3fe7f349d5187d3040feefcd028794f5728acda
parent263c6b52339c321ef422ac66a40a7d42c4fad636 (diff)
downloadchromium_src-1531757622500d102f457979efec0ac9ac5deb72.zip
chromium_src-1531757622500d102f457979efec0ac9ac5deb72.tar.gz
chromium_src-1531757622500d102f457979efec0ac9ac5deb72.tar.bz2
Disable package selection for multiple-selection file dialogs.
Merge to M39, branch 2171 ----------------Original CL Description----------------------- (This is a stopgap until the zipping mentioned in the bug can happen.) Original Review URL: https://codereview.chromium.org/612143002 Original Cr-Commit-Position: refs/heads/master@{#297266} BUG=33920 TEST=<input type=file multiple />, ensure packages can't be selected TBR=avi@chromium.org Review URL: https://codereview.chromium.org/616993003 Cr-Commit-Position: refs/branch-heads/2171@{#9} Cr-Branched-From: 267aeeb8d85c8503a7fd12bd14654b8ea78d3974-refs/heads/master@{#297060}
-rw-r--r--ui/shell_dialogs/select_file_dialog_mac.mm13
1 files changed, 8 insertions, 5 deletions
diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm
index 168ef1d..3844b06 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