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 "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); | 34 web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); |
35 web_file_info.length = file_info.size; | 35 web_file_info.length = file_info.size; |
36 if (file_info.is_directory) | 36 if (file_info.is_directory) |
37 web_file_info.type = WebFileInfo::TypeDirectory; | 37 web_file_info.type = WebFileInfo::TypeDirectory; |
38 else | 38 else |
39 web_file_info.type = WebFileInfo::TypeFile; | 39 web_file_info.type = WebFileInfo::TypeFile; |
40 callbacks_->didReadMetadata(web_file_info); | 40 callbacks_->didReadMetadata(web_file_info); |
41 } | 41 } |
42 | 42 |
43 void WebFileSystemCallbackDispatcher::DidReadDirectory( | 43 void WebFileSystemCallbackDispatcher::DidReadDirectory( |
44 const std::vector<base::file_util_proxy::Entry>& entries, bool has_more) { | 44 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { |
45 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); | 45 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); |
46 for (size_t i = 0; i < entries.size(); i++) { | 46 for (size_t i = 0; i < entries.size(); i++) { |
47 file_system_entries[i].name = | 47 file_system_entries[i].name = |
48 webkit_glue::FilePathStringToWebString(entries[i].name); | 48 webkit_glue::FilePathStringToWebString(entries[i].name); |
49 file_system_entries[i].isDirectory = entries[i].is_directory; | 49 file_system_entries[i].isDirectory = entries[i].is_directory; |
50 } | 50 } |
51 callbacks_->didReadDirectory(file_system_entries, has_more); | 51 callbacks_->didReadDirectory(file_system_entries, has_more); |
52 } | 52 } |
53 | 53 |
54 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( | 54 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( |
55 const std::string& name, const FilePath& root_path) { | 55 const std::string& name, const FilePath& root_path) { |
56 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), | 56 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), |
57 webkit_glue::FilePathToWebString(root_path)); | 57 webkit_glue::FilePathToWebString(root_path)); |
58 } | 58 } |
59 | 59 |
60 void WebFileSystemCallbackDispatcher::DidFail( | 60 void WebFileSystemCallbackDispatcher::DidFail( |
61 base::PlatformFileError error_code) { | 61 base::PlatformFileError error_code) { |
62 callbacks_->didFail( | 62 callbacks_->didFail( |
63 webkit_glue::PlatformFileErrorToWebFileError(error_code)); | 63 webkit_glue::PlatformFileErrorToWebFileError(error_code)); |
64 } | 64 } |
65 | 65 |
66 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { | 66 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { |
67 NOTREACHED(); | 67 NOTREACHED(); |
68 } | 68 } |
69 | 69 |
OLD | NEW |