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 "webkit/tools/test_shell/simple_file_system.h" | 5 #include "webkit/tools/test_shell/simple_file_system.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 ~SimpleFileSystemCallbackDispatcher() { | 59 ~SimpleFileSystemCallbackDispatcher() { |
60 } | 60 } |
61 | 61 |
62 virtual void DidSucceed() { | 62 virtual void DidSucceed() { |
63 DCHECK(file_system_); | 63 DCHECK(file_system_); |
64 callbacks_->didSucceed(); | 64 callbacks_->didSucceed(); |
65 } | 65 } |
66 | 66 |
67 virtual void DidReadMetadata(const base::PlatformFileInfo& info) { | 67 virtual void DidReadMetadata(const base::PlatformFileInfo& info, |
| 68 const FilePath& platform_path) { |
68 DCHECK(file_system_); | 69 DCHECK(file_system_); |
69 WebFileInfo web_file_info; | 70 WebFileInfo web_file_info; |
70 web_file_info.length = info.size; | 71 web_file_info.length = info.size; |
71 web_file_info.modificationTime = info.last_modified.ToDoubleT(); | 72 web_file_info.modificationTime = info.last_modified.ToDoubleT(); |
72 web_file_info.type = info.is_directory ? | 73 web_file_info.type = info.is_directory ? |
73 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; | 74 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; |
74 web_file_info.platformPath = | 75 web_file_info.platformPath = |
75 webkit_glue::FilePathToWebString(info.path); | 76 webkit_glue::FilePathToWebString(platform_path); |
76 callbacks_->didReadMetadata(web_file_info); | 77 callbacks_->didReadMetadata(web_file_info); |
77 } | 78 } |
78 | 79 |
79 virtual void DidReadDirectory( | 80 virtual void DidReadDirectory( |
80 const std::vector<base::FileUtilProxy::Entry>& entries, | 81 const std::vector<base::FileUtilProxy::Entry>& entries, |
81 bool has_more) { | 82 bool has_more) { |
82 DCHECK(file_system_); | 83 DCHECK(file_system_); |
83 std::vector<WebFileSystemEntry> web_entries_vector; | 84 std::vector<WebFileSystemEntry> web_entries_vector; |
84 for (std::vector<base::FileUtilProxy::Entry>::const_iterator it = | 85 for (std::vector<base::FileUtilProxy::Entry>::const_iterator it = |
85 entries.begin(); it != entries.end(); ++it) { | 86 entries.begin(); it != entries.end(); ++it) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 246 |
246 FileSystemOperation* SimpleFileSystem::GetNewOperation( | 247 FileSystemOperation* SimpleFileSystem::GetNewOperation( |
247 WebFileSystemCallbacks* callbacks) { | 248 WebFileSystemCallbacks* callbacks) { |
248 SimpleFileSystemCallbackDispatcher* dispatcher = | 249 SimpleFileSystemCallbackDispatcher* dispatcher = |
249 new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); | 250 new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); |
250 FileSystemOperation* operation = new FileSystemOperation( | 251 FileSystemOperation* operation = new FileSystemOperation( |
251 dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), | 252 dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), |
252 file_system_context_.get(), NULL); | 253 file_system_context_.get(), NULL); |
253 return operation; | 254 return operation; |
254 } | 255 } |
OLD | NEW |