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 "chrome/browser/ui/select_file_dialog.h" | 5 #include "chrome/browser/ui/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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 SheetContext* context = new SheetContext; | 226 SheetContext* context = new SheetContext; |
227 | 227 |
228 // |context| should never be NULL, but we are seeing indications otherwise. | 228 // |context| should never be NULL, but we are seeing indications otherwise. |
229 // This CHECK is here to confirm if we are actually getting NULL | 229 // This CHECK is here to confirm if we are actually getting NULL |
230 // |context|s. http://crbug.com/58959 | 230 // |context|s. http://crbug.com/58959 |
231 CHECK(context); | 231 CHECK(context); |
232 context->type = type; | 232 context->type = type; |
233 context->owning_window = owning_window; | 233 context->owning_window = owning_window; |
234 | 234 |
235 if (type == SELECT_SAVEAS_FILE) { | 235 if (type == SELECT_SAVEAS_FILE) { |
| 236 [dialog setCanSelectHiddenExtension:YES]; |
236 [dialog beginSheetForDirectory:default_dir | 237 [dialog beginSheetForDirectory:default_dir |
237 file:default_filename | 238 file:default_filename |
238 modalForWindow:owning_window | 239 modalForWindow:owning_window |
239 modalDelegate:bridge_.get() | 240 modalDelegate:bridge_.get() |
240 didEndSelector:@selector(endedPanel:withReturn:context:) | 241 didEndSelector:@selector(endedPanel:withReturn:context:) |
241 contextInfo:context]; | 242 contextInfo:context]; |
242 } else { | 243 } else { |
243 NSOpenPanel* open_dialog = (NSOpenPanel*)dialog; | 244 NSOpenPanel* open_dialog = (NSOpenPanel*)dialog; |
244 | 245 |
245 if (type == SELECT_OPEN_MULTI_FILE) | 246 if (type == SELECT_OPEN_MULTI_FILE) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 paths, | 407 paths, |
407 index); | 408 index); |
408 [panel release]; | 409 [panel release]; |
409 } | 410 } |
410 | 411 |
411 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { | 412 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { |
412 return selectFileDialogImpl_->ShouldEnableFilename(sender, filename); | 413 return selectFileDialogImpl_->ShouldEnableFilename(sender, filename); |
413 } | 414 } |
414 | 415 |
415 @end | 416 @end |
OLD | NEW |