| 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 #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 11 matching lines...) Expand all Loading... |
| 22 class SelectFileDialogImpl; | 22 class SelectFileDialogImpl; |
| 23 | 23 |
| 24 // A bridge class to act as the modal delegate to the save/open sheet and send | 24 // A bridge class to act as the modal delegate to the save/open sheet and send |
| 25 // the results to the C++ class. | 25 // the results to the C++ class. |
| 26 @interface SelectFileDialogBridge : NSObject<NSOpenSavePanelDelegate> { | 26 @interface SelectFileDialogBridge : NSObject<NSOpenSavePanelDelegate> { |
| 27 @private | 27 @private |
| 28 SelectFileDialogImpl* selectFileDialogImpl_; // WEAK; owns us | 28 SelectFileDialogImpl* selectFileDialogImpl_; // WEAK; owns us |
| 29 } | 29 } |
| 30 | 30 |
| 31 - (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s; | 31 - (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s; |
| 32 - (void)endedPanel:(NSSavePanel *)panel | 32 - (void)endedPanel:(NSSavePanel*)panel |
| 33 withReturn:(int)returnCode | 33 withReturn:(int)returnCode |
| 34 context:(void *)context; | 34 context:(void *)context; |
| 35 | 35 |
| 36 // NSSavePanel delegate method | 36 // NSSavePanel delegate method |
| 37 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; | 37 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; |
| 38 | 38 |
| 39 @end | 39 @end |
| 40 | 40 |
| 41 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a | 41 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a |
| 42 // file or folder. | 42 // file or folder. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 @implementation SelectFileDialogBridge | 318 @implementation SelectFileDialogBridge |
| 319 | 319 |
| 320 - (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s { | 320 - (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s { |
| 321 self = [super init]; | 321 self = [super init]; |
| 322 if (self != nil) { | 322 if (self != nil) { |
| 323 selectFileDialogImpl_ = s; | 323 selectFileDialogImpl_ = s; |
| 324 } | 324 } |
| 325 return self; | 325 return self; |
| 326 } | 326 } |
| 327 | 327 |
| 328 - (void)endedPanel:(id)panel | 328 - (void)endedPanel:(NSSavePanel*)panel |
| 329 withReturn:(int)returnCode | 329 withReturn:(int)returnCode |
| 330 context:(void *)context { | 330 context:(void *)context { |
| 331 int index = 0; | 331 int index = 0; |
| 332 SelectFileDialogImpl::SheetContext* context_struct = | 332 SelectFileDialogImpl::SheetContext* context_struct = |
| 333 (SelectFileDialogImpl::SheetContext*)context; | 333 (SelectFileDialogImpl::SheetContext*)context; |
| 334 | 334 |
| 335 SelectFileDialog::Type type = context_struct->type; | 335 SelectFileDialog::Type type = context_struct->type; |
| 336 NSWindow* parentWindow = context_struct->owning_window; | 336 NSWindow* parentWindow = context_struct->owning_window; |
| 337 delete context_struct; | 337 delete context_struct; |
| 338 | 338 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 368 paths, | 368 paths, |
| 369 index); | 369 index); |
| 370 [panel release]; | 370 [panel release]; |
| 371 } | 371 } |
| 372 | 372 |
| 373 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { | 373 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { |
| 374 return selectFileDialogImpl_->ShouldEnableFilename(sender, filename); | 374 return selectFileDialogImpl_->ShouldEnableFilename(sender, filename); |
| 375 } | 375 } |
| 376 | 376 |
| 377 @end | 377 @end |
| OLD | NEW |