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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return; | 332 return; |
333 } | 333 } |
334 | 334 |
335 full_path_ = full_path; | 335 full_path_ = full_path; |
336 | 336 |
337 // We have to open file system in order to create a FileEntry object for the | 337 // We have to open file system in order to create a FileEntry object for the |
338 // selected file path. | 338 // selected file path. |
339 content::SiteInstance* site_instance = render_view_host()->GetSiteInstance(); | 339 content::SiteInstance* site_instance = render_view_host()->GetSiteInstance(); |
340 BrowserContext::GetStoragePartition(profile_, site_instance)-> | 340 BrowserContext::GetStoragePartition(profile_, site_instance)-> |
341 GetFileSystemContext()->OpenFileSystem( | 341 GetFileSystemContext()->OpenFileSystem( |
342 source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, | 342 source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, |
| 343 fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, |
343 base::Bind( | 344 base::Bind( |
344 &RunOpenFileSystemCallback, | 345 &RunOpenFileSystemCallback, |
345 base::Bind(&FileBrowserHandlerInternalSelectFileFunction:: | 346 base::Bind(&FileBrowserHandlerInternalSelectFileFunction:: |
346 OnFileSystemOpened, | 347 OnFileSystemOpened, |
347 this))); | 348 this))); |
348 }; | 349 }; |
349 | 350 |
350 void FileBrowserHandlerInternalSelectFileFunction::OnFileSystemOpened( | 351 void FileBrowserHandlerInternalSelectFileFunction::OnFileSystemOpened( |
351 bool success, | 352 bool success, |
352 const std::string& file_system_name, | 353 const std::string& file_system_name, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 result->entry.reset(new FileEntryInfo()); | 401 result->entry.reset(new FileEntryInfo()); |
401 result->entry->file_system_name = file_system_name_; | 402 result->entry->file_system_name = file_system_name_; |
402 result->entry->file_system_root = file_system_root_.spec(); | 403 result->entry->file_system_root = file_system_root_.spec(); |
403 result->entry->file_full_path = "/" + virtual_path_.value(); | 404 result->entry->file_full_path = "/" + virtual_path_.value(); |
404 result->entry->file_is_directory = false; | 405 result->entry->file_is_directory = false; |
405 } | 406 } |
406 | 407 |
407 results_ = SelectFile::Results::Create(*result); | 408 results_ = SelectFile::Results::Create(*result); |
408 SendResponse(true); | 409 SendResponse(true); |
409 } | 410 } |
OLD | NEW |