| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/file_system/webfilesystem_callback_dispatcher.h" | 5 #include "chrome/common/file_system/webfilesystem_callback_dispatcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); | 38 web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); |
| 39 web_file_info.length = file_info.size; | 39 web_file_info.length = file_info.size; |
| 40 if (file_info.is_directory) | 40 if (file_info.is_directory) |
| 41 web_file_info.type = WebFileInfo::TypeDirectory; | 41 web_file_info.type = WebFileInfo::TypeDirectory; |
| 42 else | 42 else |
| 43 web_file_info.type = WebFileInfo::TypeFile; | 43 web_file_info.type = WebFileInfo::TypeFile; |
| 44 callbacks_->didReadMetadata(web_file_info); | 44 callbacks_->didReadMetadata(web_file_info); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void WebFileSystemCallbackDispatcher::DidReadDirectory( | 47 void WebFileSystemCallbackDispatcher::DidReadDirectory( |
| 48 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { | 48 const std::vector<base::FileUtilProxyBase::Entry>& entries, bool has_more) { |
| 49 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); | 49 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); |
| 50 for (size_t i = 0; i < entries.size(); i++) { | 50 for (size_t i = 0; i < entries.size(); i++) { |
| 51 file_system_entries[i].name = | 51 file_system_entries[i].name = |
| 52 webkit_glue::FilePathStringToWebString(entries[i].name); | 52 webkit_glue::FilePathStringToWebString(entries[i].name); |
| 53 file_system_entries[i].isDirectory = entries[i].is_directory; | 53 file_system_entries[i].isDirectory = entries[i].is_directory; |
| 54 } | 54 } |
| 55 callbacks_->didReadDirectory(file_system_entries, has_more); | 55 callbacks_->didReadDirectory(file_system_entries, has_more); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( | 58 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( |
| 59 const std::string& name, const FilePath& root_path) { | 59 const std::string& name, const FilePath& root_path) { |
| 60 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), | 60 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), |
| 61 webkit_glue::FilePathToWebString(root_path)); | 61 webkit_glue::FilePathToWebString(root_path)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void WebFileSystemCallbackDispatcher::DidFail( | 64 void WebFileSystemCallbackDispatcher::DidFail( |
| 65 base::PlatformFileError error_code) { | 65 base::PlatformFileError error_code) { |
| 66 callbacks_->didFail( | 66 callbacks_->didFail( |
| 67 webkit_glue::PlatformFileErrorToWebFileError(error_code)); | 67 webkit_glue::PlatformFileErrorToWebFileError(error_code)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { | 70 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| 72 } | 72 } |
| OLD | NEW |