| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/dialogs/select_file_dialog.h" | 5 #include "ui/base/dialogs/select_file_dialog.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 CreateUTIFromExtension(ext_list[j])); | 228 CreateUTIFromExtension(ext_list[j])); |
| 229 [file_type_set addObject:base::mac::CFToNSCast(uti.get())]; | 229 [file_type_set addObject:base::mac::CFToNSCast(uti.get())]; |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 allowed_file_types = [file_type_set allObjects]; | 232 allowed_file_types = [file_type_set allObjects]; |
| 233 } | 233 } |
| 234 if (type == SELECT_SAVEAS_FILE) | 234 if (type == SELECT_SAVEAS_FILE) |
| 235 [dialog setAllowedFileTypes:allowed_file_types]; | 235 [dialog setAllowedFileTypes:allowed_file_types]; |
| 236 // else we'll pass it in when we run the open panel | 236 // else we'll pass it in when we run the open panel |
| 237 | 237 |
| 238 if (file_types->include_all_files) | 238 if (file_types->include_all_files || file_types->extensions.empty()) |
| 239 [dialog setAllowsOtherFileTypes:YES]; | 239 [dialog setAllowsOtherFileTypes:YES]; |
| 240 | 240 |
| 241 if (file_types->extension_description_overrides.size() > 1) { | 241 if (file_types->extension_description_overrides.size() > 1) { |
| 242 NSView* accessory_view = GetAccessoryView(file_types, file_type_index); | 242 NSView* accessory_view = GetAccessoryView(file_types, file_type_index); |
| 243 [dialog setAccessoryView:accessory_view]; | 243 [dialog setAccessoryView:accessory_view]; |
| 244 } | 244 } |
| 245 } else { | 245 } else { |
| 246 // If no type info is specified, anything goes. | 246 // If no type info is specified, anything goes. |
| 247 [dialog setAllowsOtherFileTypes:YES]; | 247 [dialog setAllowsOtherFileTypes:YES]; |
| 248 } | 248 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 namespace ui { | 408 namespace ui { |
| 409 | 409 |
| 410 SelectFileDialog* CreateMacSelectFileDialog( | 410 SelectFileDialog* CreateMacSelectFileDialog( |
| 411 SelectFileDialog::Listener* listener, | 411 SelectFileDialog::Listener* listener, |
| 412 SelectFilePolicy* policy) { | 412 SelectFilePolicy* policy) { |
| 413 return new SelectFileDialogImpl(listener, policy); | 413 return new SelectFileDialogImpl(listener, policy); |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace ui | 416 } // namespace ui |
| OLD | NEW |