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