OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_system/webfilesystem_callback_dispatcher.h" | 5 #include "content/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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 void WebFileSystemCallbackDispatcher::DidReadMetadata( | 35 void WebFileSystemCallbackDispatcher::DidReadMetadata( |
36 const base::PlatformFileInfo& file_info) { | 36 const base::PlatformFileInfo& file_info) { |
37 WebFileInfo web_file_info; | 37 WebFileInfo web_file_info; |
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 web_file_info.platformPath = |
| 45 webkit_glue::FilePathToWebString(file_info.path); |
44 callbacks_->didReadMetadata(web_file_info); | 46 callbacks_->didReadMetadata(web_file_info); |
45 } | 47 } |
46 | 48 |
47 void WebFileSystemCallbackDispatcher::DidReadDirectory( | 49 void WebFileSystemCallbackDispatcher::DidReadDirectory( |
48 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { | 50 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { |
49 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); | 51 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); |
50 for (size_t i = 0; i < entries.size(); i++) { | 52 for (size_t i = 0; i < entries.size(); i++) { |
51 file_system_entries[i].name = | 53 file_system_entries[i].name = |
52 webkit_glue::FilePathStringToWebString(entries[i].name); | 54 webkit_glue::FilePathStringToWebString(entries[i].name); |
53 file_system_entries[i].isDirectory = entries[i].is_directory; | 55 file_system_entries[i].isDirectory = entries[i].is_directory; |
54 } | 56 } |
55 callbacks_->didReadDirectory(file_system_entries, has_more); | 57 callbacks_->didReadDirectory(file_system_entries, has_more); |
56 } | 58 } |
57 | 59 |
58 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( | 60 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( |
59 const std::string& name, const FilePath& root_path) { | 61 const std::string& name, const FilePath& root_path) { |
60 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), | 62 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), |
61 webkit_glue::FilePathToWebString(root_path)); | 63 webkit_glue::FilePathToWebString(root_path)); |
62 } | 64 } |
63 | 65 |
64 void WebFileSystemCallbackDispatcher::DidFail( | 66 void WebFileSystemCallbackDispatcher::DidFail( |
65 base::PlatformFileError error_code) { | 67 base::PlatformFileError error_code) { |
66 callbacks_->didFail( | 68 callbacks_->didFail( |
67 webkit_glue::PlatformFileErrorToWebFileError(error_code)); | 69 webkit_glue::PlatformFileErrorToWebFileError(error_code)); |
68 } | 70 } |
69 | 71 |
70 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { | 72 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { |
71 NOTREACHED(); | 73 NOTREACHED(); |
72 } | 74 } |
OLD | NEW |