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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 if (!title.empty()) | 194 if (!title.empty()) |
195 [dialog setTitle:base::SysUTF16ToNSString(title)]; | 195 [dialog setTitle:base::SysUTF16ToNSString(title)]; |
196 | 196 |
197 NSString* default_dir = nil; | 197 NSString* default_dir = nil; |
198 NSString* default_filename = nil; | 198 NSString* default_filename = nil; |
199 if (!default_path.empty()) { | 199 if (!default_path.empty()) { |
200 // The file dialog is going to do a ton of stats anyway. Not much | 200 // The file dialog is going to do a ton of stats anyway. Not much |
201 // point in eliminating this one. | 201 // point in eliminating this one. |
202 base::ThreadRestrictions::ScopedAllowIO allow_io; | 202 base::ThreadRestrictions::ScopedAllowIO allow_io; |
203 if (file_util::DirectoryExists(default_path)) { | 203 if (base::DirectoryExists(default_path)) { |
204 default_dir = base::SysUTF8ToNSString(default_path.value()); | 204 default_dir = base::SysUTF8ToNSString(default_path.value()); |
205 } else { | 205 } else { |
206 default_dir = base::SysUTF8ToNSString(default_path.DirName().value()); | 206 default_dir = base::SysUTF8ToNSString(default_path.DirName().value()); |
207 default_filename = | 207 default_filename = |
208 base::SysUTF8ToNSString(default_path.BaseName().value()); | 208 base::SysUTF8ToNSString(default_path.BaseName().value()); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 NSArray* allowed_file_types = nil; | 212 NSArray* allowed_file_types = nil; |
213 if (file_types) { | 213 if (file_types) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 namespace ui { | 418 namespace ui { |
419 | 419 |
420 SelectFileDialog* CreateMacSelectFileDialog( | 420 SelectFileDialog* CreateMacSelectFileDialog( |
421 SelectFileDialog::Listener* listener, | 421 SelectFileDialog::Listener* listener, |
422 SelectFilePolicy* policy) { | 422 SelectFilePolicy* policy) { |
423 return new SelectFileDialogImpl(listener, policy); | 423 return new SelectFileDialogImpl(listener, policy); |
424 } | 424 } |
425 | 425 |
426 } // namespace ui | 426 } // namespace ui |
OLD | NEW |