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 "ui/shell_dialogs/select_file_dialog.h" | 5 #include "ui/shell_dialogs/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 @end | 58 @end |
59 | 59 |
60 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a | 60 // Implementation of SelectFileDialog that shows Cocoa dialogs for choosing a |
61 // file or folder. | 61 // file or folder. |
62 class SelectFileDialogImpl : public ui::SelectFileDialog { | 62 class SelectFileDialogImpl : public ui::SelectFileDialog { |
63 public: | 63 public: |
64 explicit SelectFileDialogImpl(Listener* listener, | 64 explicit SelectFileDialogImpl(Listener* listener, |
65 ui::SelectFilePolicy* policy); | 65 ui::SelectFilePolicy* policy); |
66 | 66 |
67 // BaseShellDialog implementation. | 67 // BaseShellDialog implementation. |
68 virtual bool IsRunning(gfx::NativeWindow parent_window) const; | 68 virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; |
69 virtual void ListenerDestroyed(); | 69 virtual void ListenerDestroyed() OVERRIDE; |
70 | 70 |
71 // Callback from ObjC bridge. | 71 // Callback from ObjC bridge. |
72 void FileWasSelected(NSSavePanel* dialog, | 72 void FileWasSelected(NSSavePanel* dialog, |
73 NSWindow* parent_window, | 73 NSWindow* parent_window, |
74 bool was_cancelled, | 74 bool was_cancelled, |
75 bool is_multi, | 75 bool is_multi, |
76 const std::vector<base::FilePath>& files, | 76 const std::vector<base::FilePath>& files, |
77 int index); | 77 int index); |
78 | 78 |
79 bool ShouldEnableFilename(NSSavePanel* dialog, NSString* filename); | 79 bool ShouldEnableFilename(NSSavePanel* dialog, NSString* filename); |
(...skipping 11 matching lines...) Expand all Loading... |
91 gfx::NativeWindow owning_window, | 91 gfx::NativeWindow owning_window, |
92 void* params) OVERRIDE; | 92 void* params) OVERRIDE; |
93 | 93 |
94 private: | 94 private: |
95 virtual ~SelectFileDialogImpl(); | 95 virtual ~SelectFileDialogImpl(); |
96 | 96 |
97 // Gets the accessory view for the save dialog. | 97 // Gets the accessory view for the save dialog. |
98 NSView* GetAccessoryView(const FileTypeInfo* file_types, | 98 NSView* GetAccessoryView(const FileTypeInfo* file_types, |
99 int file_type_index); | 99 int file_type_index); |
100 | 100 |
101 virtual bool HasMultipleFileTypeChoicesImpl(); | 101 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; |
102 | 102 |
103 // The bridge for results from Cocoa to return to us. | 103 // The bridge for results from Cocoa to return to us. |
104 scoped_nsobject<SelectFileDialogBridge> bridge_; | 104 scoped_nsobject<SelectFileDialogBridge> bridge_; |
105 | 105 |
106 // A map from file dialogs to the |params| user data associated with them. | 106 // A map from file dialogs to the |params| user data associated with them. |
107 std::map<NSSavePanel*, void*> params_map_; | 107 std::map<NSSavePanel*, void*> params_map_; |
108 | 108 |
109 // The set of all parent windows for which we are currently running dialogs. | 109 // The set of all parent windows for which we are currently running dialogs. |
110 std::set<NSWindow*> parents_; | 110 std::set<NSWindow*> parents_; |
111 | 111 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 namespace ui { | 420 namespace ui { |
421 | 421 |
422 SelectFileDialog* CreateMacSelectFileDialog( | 422 SelectFileDialog* CreateMacSelectFileDialog( |
423 SelectFileDialog::Listener* listener, | 423 SelectFileDialog::Listener* listener, |
424 SelectFilePolicy* policy) { | 424 SelectFilePolicy* policy) { |
425 return new SelectFileDialogImpl(listener, policy); | 425 return new SelectFileDialogImpl(listener, policy); |
426 } | 426 } |
427 | 427 |
428 } // namespace ui | 428 } // namespace ui |
OLD | NEW |