| 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 "content/common/fileapi/webfilesystem_callback_dispatcher.h" | 5 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_util_proxy.h" | 10 #include "base/files/file_util_proxy.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void WebFileSystemCallbackDispatcher::DidReadMetadata( | 40 void WebFileSystemCallbackDispatcher::DidReadMetadata( |
| 41 const base::PlatformFileInfo& file_info, | 41 const base::PlatformFileInfo& file_info, |
| 42 const base::FilePath& platform_path) { | 42 const base::FilePath& platform_path) { |
| 43 WebFileInfo web_file_info; | 43 WebFileInfo web_file_info; |
| 44 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info); | 44 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info); |
| 45 web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path); | 45 web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path); |
| 46 callbacks_->didReadMetadata(web_file_info); | 46 callbacks_->didReadMetadata(web_file_info); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebFileSystemCallbackDispatcher::DidCreateSnapshotFile( |
| 50 const base::PlatformFileInfo& file_info, |
| 51 const base::FilePath& platform_path) { |
| 52 WebFileInfo web_file_info; |
| 53 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info); |
| 54 web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path); |
| 55 callbacks_->didCreateSnapshotFile(web_file_info); |
| 56 } |
| 57 |
| 49 void WebFileSystemCallbackDispatcher::DidReadDirectory( | 58 void WebFileSystemCallbackDispatcher::DidReadDirectory( |
| 50 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { | 59 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { |
| 51 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); | 60 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); |
| 52 for (size_t i = 0; i < entries.size(); i++) { | 61 for (size_t i = 0; i < entries.size(); i++) { |
| 53 file_system_entries[i].name = | 62 file_system_entries[i].name = |
| 54 webkit_base::FilePathStringToWebString(entries[i].name); | 63 webkit_base::FilePathStringToWebString(entries[i].name); |
| 55 file_system_entries[i].isDirectory = entries[i].is_directory; | 64 file_system_entries[i].isDirectory = entries[i].is_directory; |
| 56 } | 65 } |
| 57 callbacks_->didReadDirectory(file_system_entries, has_more); | 66 callbacks_->didReadDirectory(file_system_entries, has_more); |
| 58 } | 67 } |
| 59 | 68 |
| 60 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( | 69 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( |
| 61 const std::string& name, const GURL& root) { | 70 const std::string& name, const GURL& root) { |
| 62 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root); | 71 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root); |
| 63 } | 72 } |
| 64 | 73 |
| 65 void WebFileSystemCallbackDispatcher::DidFail( | 74 void WebFileSystemCallbackDispatcher::DidFail( |
| 66 base::PlatformFileError error_code) { | 75 base::PlatformFileError error_code) { |
| 67 callbacks_->didFail( | 76 callbacks_->didFail( |
| 68 fileapi::PlatformFileErrorToWebFileError(error_code)); | 77 fileapi::PlatformFileErrorToWebFileError(error_code)); |
| 69 } | 78 } |
| 70 | 79 |
| 71 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { | 80 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { |
| 72 NOTREACHED(); | 81 NOTREACHED(); |
| 73 } | 82 } |
| 74 | 83 |
| 75 } // namespace content | 84 } // namespace content |
| OLD | NEW |