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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
80 | 80 |
81 protected: | 81 protected: |
82 // SelectFileDialog implementation. | 82 // SelectFileDialog implementation. |
83 // |params| is user data we pass back via the Listener interface. | 83 // |params| is user data we pass back via the Listener interface. |
84 virtual void SelectFileImpl( | 84 virtual void SelectFileImpl( |
85 Type type, | 85 Type type, |
86 const string16& title, | 86 const base::string16& title, |
87 const base::FilePath& default_path, | 87 const base::FilePath& default_path, |
88 const FileTypeInfo* file_types, | 88 const FileTypeInfo* file_types, |
89 int file_type_index, | 89 int file_type_index, |
90 const base::FilePath::StringType& default_extension, | 90 const base::FilePath::StringType& default_extension, |
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 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 NSString* filename) { | 164 NSString* filename) { |
165 // If this is a single open file dialog, disable selecting packages. | 165 // If this is a single open file dialog, disable selecting packages. |
166 if (type_map_[dialog] != SELECT_OPEN_FILE) | 166 if (type_map_[dialog] != SELECT_OPEN_FILE) |
167 return true; | 167 return true; |
168 | 168 |
169 return ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; | 169 return ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; |
170 } | 170 } |
171 | 171 |
172 void SelectFileDialogImpl::SelectFileImpl( | 172 void SelectFileDialogImpl::SelectFileImpl( |
173 Type type, | 173 Type type, |
174 const string16& title, | 174 const base::string16& title, |
175 const base::FilePath& default_path, | 175 const base::FilePath& default_path, |
176 const FileTypeInfo* file_types, | 176 const FileTypeInfo* file_types, |
177 int file_type_index, | 177 int file_type_index, |
178 const base::FilePath::StringType& default_extension, | 178 const base::FilePath::StringType& default_extension, |
179 gfx::NativeWindow owning_window, | 179 gfx::NativeWindow owning_window, |
180 void* params) { | 180 void* params) { |
181 DCHECK(type == SELECT_FOLDER || | 181 DCHECK(type == SELECT_FOLDER || |
182 type == SELECT_OPEN_FILE || | 182 type == SELECT_OPEN_FILE || |
183 type == SELECT_OPEN_MULTI_FILE || | 183 type == SELECT_OPEN_MULTI_FILE || |
184 type == SELECT_SAVEAS_FILE); | 184 type == SELECT_SAVEAS_FILE); |
(...skipping 234 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 |