OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/shell_dialogs.h" | 5 #include "chrome/browser/shell_dialogs.h" |
6 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (type == SelectFileDialog::SELECT_SAVEAS_FILE) { | 319 if (type == SelectFileDialog::SELECT_SAVEAS_FILE) { |
320 paths.push_back(FilePath(base::SysNSStringToUTF8([panel filename]))); | 320 paths.push_back(FilePath(base::SysNSStringToUTF8([panel filename]))); |
321 | 321 |
322 NSView* accessoryView = [panel accessoryView]; | 322 NSView* accessoryView = [panel accessoryView]; |
323 if (accessoryView) { | 323 if (accessoryView) { |
324 NSPopUpButton* popup = [accessoryView viewWithTag:kFileTypePopupTag]; | 324 NSPopUpButton* popup = [accessoryView viewWithTag:kFileTypePopupTag]; |
325 if (popup) { | 325 if (popup) { |
326 // File type indexes are 1-based. | 326 // File type indexes are 1-based. |
327 index = [popup indexOfSelectedItem] + 1; | 327 index = [popup indexOfSelectedItem] + 1; |
328 } | 328 } |
| 329 } else { |
| 330 index = 1; |
329 } | 331 } |
330 } else { | 332 } else { |
331 NSArray* filenames = [panel filenames]; | 333 NSArray* filenames = [panel filenames]; |
332 for (NSString* filename in filenames) | 334 for (NSString* filename in filenames) |
333 paths.push_back(FilePath(base::SysNSStringToUTF8(filename))); | 335 paths.push_back(FilePath(base::SysNSStringToUTF8(filename))); |
334 } | 336 } |
335 } | 337 } |
336 | 338 |
337 selectFileDialogImpl_->FileWasSelected(panel, | 339 selectFileDialogImpl_->FileWasSelected(panel, |
338 parentWindow, | 340 parentWindow, |
339 did_cancel, | 341 did_cancel, |
340 isMulti, | 342 isMulti, |
341 paths, | 343 paths, |
342 index); | 344 index); |
343 } | 345 } |
344 | 346 |
345 @end | 347 @end |
OLD | NEW |