| 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 // The file contains the implementation of | 5 // The file contains the implementation of |
| 6 // fileBrowserHandlerInternal.selectFile extension function. | 6 // fileBrowserHandlerInternal.selectFile extension function. |
| 7 // When invoked, the function does the following: | 7 // When invoked, the function does the following: |
| 8 // - Verifies that the extension function was invoked as a result of user | 8 // - Verifies that the extension function was invoked as a result of user |
| 9 // gesture. | 9 // gesture. |
| 10 // - Display 'save as' dialog using FileSelectorImpl which waits for the user | 10 // - Display 'save as' dialog using FileSelectorImpl which waits for the user |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 dialog_ = ui::SelectFileDialog::Create( | 205 dialog_ = ui::SelectFileDialog::Create( |
| 206 this, new ChromeSelectFilePolicy(web_contents)); | 206 this, new ChromeSelectFilePolicy(web_contents)); |
| 207 | 207 |
| 208 // Convert |allowed_extensions| to ui::SelectFileDialog::FileTypeInfo. | 208 // Convert |allowed_extensions| to ui::SelectFileDialog::FileTypeInfo. |
| 209 ui::SelectFileDialog::FileTypeInfo allowed_file_info = | 209 ui::SelectFileDialog::FileTypeInfo allowed_file_info = |
| 210 ConvertExtensionsToFileTypeInfo(allowed_extensions); | 210 ConvertExtensionsToFileTypeInfo(allowed_extensions); |
| 211 allowed_file_info.support_drive = true; | 211 allowed_file_info.support_drive = true; |
| 212 | 212 |
| 213 dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, | 213 dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, |
| 214 string16() /* dialog title*/, | 214 base::string16() /* dialog title*/, |
| 215 suggested_name, | 215 suggested_name, |
| 216 &allowed_file_info, | 216 &allowed_file_info, |
| 217 0 /* file type index */, | 217 0 /* file type index */, |
| 218 std::string() /* default file extension */, | 218 std::string() /* default file extension */, |
| 219 browser->window()->GetNativeWindow(), NULL /* params */); | 219 browser->window()->GetNativeWindow(), NULL /* params */); |
| 220 | 220 |
| 221 return dialog_->IsRunning(browser->window()->GetNativeWindow()); | 221 return dialog_->IsRunning(browser->window()->GetNativeWindow()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void FileSelectorImpl::FileSelected( | 224 void FileSelectorImpl::FileSelected( |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 result->entry.reset(new FileEntryInfo()); | 359 result->entry.reset(new FileEntryInfo()); |
| 360 result->entry->file_system_name = file_system_name_; | 360 result->entry->file_system_name = file_system_name_; |
| 361 result->entry->file_system_root = file_system_root_.spec(); | 361 result->entry->file_system_root = file_system_root_.spec(); |
| 362 result->entry->file_full_path = "/" + virtual_path_.AsUTF8Unsafe(); | 362 result->entry->file_full_path = "/" + virtual_path_.AsUTF8Unsafe(); |
| 363 result->entry->file_is_directory = false; | 363 result->entry->file_is_directory = false; |
| 364 } | 364 } |
| 365 | 365 |
| 366 results_ = SelectFile::Results::Create(*result); | 366 results_ = SelectFile::Results::Create(*result); |
| 367 SendResponse(true); | 367 SendResponse(true); |
| 368 } | 368 } |
| OLD | NEW |