| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // Note: we need to retain the dialog as owning_window can be null. | 187 // Note: we need to retain the dialog as owning_window can be null. |
| 188 // (See http://crbug.com/29213 .) | 188 // (See http://crbug.com/29213 .) |
| 189 NSSavePanel* dialog; | 189 NSSavePanel* dialog; |
| 190 if (type == SELECT_SAVEAS_FILE) | 190 if (type == SELECT_SAVEAS_FILE) |
| 191 dialog = [[NSSavePanel savePanel] retain]; | 191 dialog = [[NSSavePanel savePanel] retain]; |
| 192 else | 192 else |
| 193 dialog = [[NSOpenPanel openPanel] retain]; | 193 dialog = [[NSOpenPanel openPanel] retain]; |
| 194 | 194 |
| 195 if (!title.empty()) | 195 if (!title.empty()) |
| 196 [dialog setTitle:base::SysUTF16ToNSString(title)]; | 196 [dialog setMessage:base::SysUTF16ToNSString(title)]; |
| 197 | 197 |
| 198 NSString* default_dir = nil; | 198 NSString* default_dir = nil; |
| 199 NSString* default_filename = nil; | 199 NSString* default_filename = nil; |
| 200 if (!default_path.empty()) { | 200 if (!default_path.empty()) { |
| 201 // The file dialog is going to do a ton of stats anyway. Not much | 201 // The file dialog is going to do a ton of stats anyway. Not much |
| 202 // point in eliminating this one. | 202 // point in eliminating this one. |
| 203 base::ThreadRestrictions::ScopedAllowIO allow_io; | 203 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 204 if (base::DirectoryExists(default_path)) { | 204 if (base::DirectoryExists(default_path)) { |
| 205 default_dir = base::SysUTF8ToNSString(default_path.value()); | 205 default_dir = base::SysUTF8ToNSString(default_path.value()); |
| 206 } else { | 206 } else { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 namespace ui { | 421 namespace ui { |
| 422 | 422 |
| 423 SelectFileDialog* CreateMacSelectFileDialog( | 423 SelectFileDialog* CreateMacSelectFileDialog( |
| 424 SelectFileDialog::Listener* listener, | 424 SelectFileDialog::Listener* listener, |
| 425 SelectFilePolicy* policy) { | 425 SelectFilePolicy* policy) { |
| 426 return new SelectFileDialogImpl(listener, policy); | 426 return new SelectFileDialogImpl(listener, policy); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace ui | 429 } // namespace ui |
| OLD | NEW |