| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 DISALLOW_COPY_AND_ASSIGN(FileSelectorImpl); | 159 DISALLOW_COPY_AND_ASSIGN(FileSelectorImpl); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 FileSelectorImpl::FileSelectorImpl() {} | 162 FileSelectorImpl::FileSelectorImpl() {} |
| 163 | 163 |
| 164 FileSelectorImpl::~FileSelectorImpl() { | 164 FileSelectorImpl::~FileSelectorImpl() { |
| 165 if (dialog_.get()) | 165 if (dialog_.get()) |
| 166 dialog_->ListenerDestroyed(); | 166 dialog_->ListenerDestroyed(); |
| 167 // Send response if needed. | 167 // Send response if needed. |
| 168 if (function_) | 168 if (function_.get()) |
| 169 SendResponse(false, base::FilePath()); | 169 SendResponse(false, base::FilePath()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void FileSelectorImpl::SelectFile( | 172 void FileSelectorImpl::SelectFile( |
| 173 const base::FilePath& suggested_name, | 173 const base::FilePath& suggested_name, |
| 174 const std::vector<std::string>& allowed_extensions, | 174 const std::vector<std::string>& allowed_extensions, |
| 175 Browser* browser, | 175 Browser* browser, |
| 176 FileBrowserHandlerInternalSelectFileFunction* function) { | 176 FileBrowserHandlerInternalSelectFileFunction* function) { |
| 177 // We will hold reference to the function until it is notified of selection | 177 // We will hold reference to the function until it is notified of selection |
| 178 // result. | 178 // result. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 result->entry.reset(new FileEntryInfo()); | 401 result->entry.reset(new FileEntryInfo()); |
| 402 result->entry->file_system_name = file_system_name_; | 402 result->entry->file_system_name = file_system_name_; |
| 403 result->entry->file_system_root = file_system_root_.spec(); | 403 result->entry->file_system_root = file_system_root_.spec(); |
| 404 result->entry->file_full_path = "/" + virtual_path_.value(); | 404 result->entry->file_full_path = "/" + virtual_path_.value(); |
| 405 result->entry->file_is_directory = false; | 405 result->entry->file_is_directory = false; |
| 406 } | 406 } |
| 407 | 407 |
| 408 results_ = SelectFile::Results::Create(*result); | 408 results_ = SelectFile::Results::Create(*result); |
| 409 SendResponse(true); | 409 SendResponse(true); |
| 410 } | 410 } |
| OLD | NEW |