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

Side by Side Diff: ui/shell_dialogs/select_file_dialog_mac.mm

Issue 2177113002: Mac File Dialogs: Add Apple radar id in comment about crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@select_file_dialog_crash
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shell_dialogs/select_file_dialog_mac.h" 5 #include "ui/shell_dialogs/select_file_dialog_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 [popup addItemWithTitle:type_description]; 304 [popup addItemWithTitle:type_description];
305 305
306 // Populate file_type_lists. 306 // Populate file_type_lists.
307 // Set to store different extensions in the current extension group. 307 // Set to store different extensions in the current extension group.
308 NSMutableSet* file_type_set = [NSMutableSet set]; 308 NSMutableSet* file_type_set = [NSMutableSet set];
309 for (const base::FilePath::StringType& ext : ext_list) { 309 for (const base::FilePath::StringType& ext : ext_list) {
310 if (ext == default_extension) 310 if (ext == default_extension)
311 default_extension_index = i; 311 default_extension_index = i;
312 312
313 // Crash reports suggest that CreateUTIFromExtension may return nil. Hence 313 // Crash reports suggest that CreateUTIFromExtension may return nil. Hence
314 // we nil check before adding to |file_type_set|. See crbug.com/630101. 314 // we nil check before adding to |file_type_set|. See crbug.com/630101 and
315 // rdar://27490414.
315 base::ScopedCFTypeRef<CFStringRef> uti(CreateUTIFromExtension(ext)); 316 base::ScopedCFTypeRef<CFStringRef> uti(CreateUTIFromExtension(ext));
316 if (uti) 317 if (uti)
317 [file_type_set addObject:base::mac::CFToNSCast(uti.get())]; 318 [file_type_set addObject:base::mac::CFToNSCast(uti.get())];
318 319
319 // Always allow the extension itself, in case the UTI doesn't map 320 // Always allow the extension itself, in case the UTI doesn't map
320 // back to the original extension correctly. This occurs with dynamic 321 // back to the original extension correctly. This occurs with dynamic
321 // UTIs on 10.7 and 10.8. 322 // UTIs on 10.7 and 10.8.
322 // See http://crbug.com/148840, http://openradar.me/12316273 323 // See http://crbug.com/148840, http://openradar.me/12316273
323 base::ScopedCFTypeRef<CFStringRef> ext_cf( 324 base::ScopedCFTypeRef<CFStringRef> ext_cf(
324 base::SysUTF8ToCFStringRef(ext)); 325 base::SysUTF8ToCFStringRef(ext));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // For save dialogs, this causes the first item in the allowedFileTypes 446 // For save dialogs, this causes the first item in the allowedFileTypes
446 // array to be used as the extension for the save panel. 447 // array to be used as the extension for the save panel.
447 [dialog_ setAllowedFileTypes:[fileTypeLists_ objectAtIndex:index]]; 448 [dialog_ setAllowedFileTypes:[fileTypeLists_ objectAtIndex:index]];
448 } else { 449 } else {
449 // The user selected "All files" option. 450 // The user selected "All files" option.
450 [dialog_ setAllowedFileTypes:nil]; 451 [dialog_ setAllowedFileTypes:nil];
451 } 452 }
452 } 453 }
453 454
454 @end 455 @end
OLDNEW
« 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