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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 // NSSavePanel delegate method | 47 // NSSavePanel delegate method |
48 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; | 48 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; |
49 | 49 |
50 @end | 50 @end |
51 | 51 |
52 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a | 52 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a |
53 // file or folder. | 53 // file or folder. |
54 class SelectFileDialogImpl : public SelectFileDialog { | 54 class SelectFileDialogImpl : public SelectFileDialog { |
55 public: | 55 public: |
56 explicit SelectFileDialogImpl(Listener* listener); | 56 explicit SelectFileDialogImpl(Listener* listener); |
57 virtual ~SelectFileDialogImpl(); | |
58 | 57 |
59 // BaseShellDialog implementation. | 58 // BaseShellDialog implementation. |
60 virtual bool IsRunning(gfx::NativeWindow parent_window) const; | 59 virtual bool IsRunning(gfx::NativeWindow parent_window) const; |
61 virtual void ListenerDestroyed(); | 60 virtual void ListenerDestroyed(); |
62 | 61 |
63 // Callback from ObjC bridge. | 62 // Callback from ObjC bridge. |
64 void FileWasSelected(NSSavePanel* dialog, | 63 void FileWasSelected(NSSavePanel* dialog, |
65 NSWindow* parent_window, | 64 NSWindow* parent_window, |
66 bool was_cancelled, | 65 bool was_cancelled, |
67 bool is_multi, | 66 bool is_multi, |
(...skipping 10 matching lines...) Expand all Loading... | |
78 protected: | 77 protected: |
79 // SelectFileDialog implementation. | 78 // SelectFileDialog implementation. |
80 // |params| is user data we pass back via the Listener interface. | 79 // |params| is user data we pass back via the Listener interface. |
81 virtual void SelectFileImpl(Type type, | 80 virtual void SelectFileImpl(Type type, |
82 const string16& title, | 81 const string16& title, |
83 const FilePath& default_path, | 82 const FilePath& default_path, |
84 const FileTypeInfo* file_types, | 83 const FileTypeInfo* file_types, |
85 int file_type_index, | 84 int file_type_index, |
86 const FilePath::StringType& default_extension, | 85 const FilePath::StringType& default_extension, |
87 gfx::NativeWindow owning_window, | 86 gfx::NativeWindow owning_window, |
88 void* params); | 87 void* params) OVERRIDE; |
Nico
2012/04/13 17:09:11
Huh, I thought avi had made the plugin check for m
Ryan Sleevi
2012/04/13 17:23:04
No. That's why I split the plugin change into two
| |
89 | 88 |
90 private: | 89 private: |
90 virtual ~SelectFileDialogImpl(); | |
91 | |
91 // Gets the accessory view for the save dialog. | 92 // Gets the accessory view for the save dialog. |
92 NSView* GetAccessoryView(const FileTypeInfo* file_types, | 93 NSView* GetAccessoryView(const FileTypeInfo* file_types, |
93 int file_type_index); | 94 int file_type_index); |
94 | 95 |
95 virtual bool HasMultipleFileTypeChoicesImpl(); | 96 virtual bool HasMultipleFileTypeChoicesImpl(); |
96 | 97 |
97 // The bridge for results from Cocoa to return to us. | 98 // The bridge for results from Cocoa to return to us. |
98 scoped_nsobject<SelectFileDialogBridge> bridge_; | 99 scoped_nsobject<SelectFileDialogBridge> bridge_; |
99 | 100 |
100 // A map from file dialogs to the |params| user data associated with them. | 101 // A map from file dialogs to the |params| user data associated with them. |
(...skipping 305 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 |