Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: content/common/fileapi/webfilesystem_callback_dispatcher.cc

Issue 10441016: Add FileUtilities::GetFileInfo() to capture file metadata with single IPC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 DCHECK(callbacks_); 29 DCHECK(callbacks_);
30 } 30 }
31 31
32 void WebFileSystemCallbackDispatcher::DidSucceed() { 32 void WebFileSystemCallbackDispatcher::DidSucceed() {
33 callbacks_->didSucceed(); 33 callbacks_->didSucceed();
34 } 34 }
35 35
36 void WebFileSystemCallbackDispatcher::DidReadMetadata( 36 void WebFileSystemCallbackDispatcher::DidReadMetadata(
37 const base::PlatformFileInfo& file_info, const FilePath& platform_path) { 37 const base::PlatformFileInfo& file_info, const FilePath& platform_path) {
38 WebFileInfo web_file_info; 38 WebFileInfo web_file_info;
39 web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); 39 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
40 web_file_info.length = file_info.size; 40 web_file_info.platformPath = webkit_glue::FilePathToWebString(platform_path);
41 if (file_info.is_directory)
42 web_file_info.type = WebFileInfo::TypeDirectory;
43 else
44 web_file_info.type = WebFileInfo::TypeFile;
45 web_file_info.platformPath =
46 webkit_glue::FilePathToWebString(platform_path);
47 callbacks_->didReadMetadata(web_file_info); 41 callbacks_->didReadMetadata(web_file_info);
48 } 42 }
49 43
50 void WebFileSystemCallbackDispatcher::DidReadDirectory( 44 void WebFileSystemCallbackDispatcher::DidReadDirectory(
51 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { 45 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
52 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); 46 WebVector<WebFileSystemEntry> file_system_entries(entries.size());
53 for (size_t i = 0; i < entries.size(); i++) { 47 for (size_t i = 0; i < entries.size(); i++) {
54 file_system_entries[i].name = 48 file_system_entries[i].name =
55 webkit_glue::FilePathStringToWebString(entries[i].name); 49 webkit_glue::FilePathStringToWebString(entries[i].name);
56 file_system_entries[i].isDirectory = entries[i].is_directory; 50 file_system_entries[i].isDirectory = entries[i].is_directory;
57 } 51 }
58 callbacks_->didReadDirectory(file_system_entries, has_more); 52 callbacks_->didReadDirectory(file_system_entries, has_more);
59 } 53 }
60 54
61 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( 55 void WebFileSystemCallbackDispatcher::DidOpenFileSystem(
62 const std::string& name, const GURL& root) { 56 const std::string& name, const GURL& root) {
63 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root); 57 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root);
64 } 58 }
65 59
66 void WebFileSystemCallbackDispatcher::DidFail( 60 void WebFileSystemCallbackDispatcher::DidFail(
67 base::PlatformFileError error_code) { 61 base::PlatformFileError error_code) {
68 callbacks_->didFail( 62 callbacks_->didFail(
69 webkit_glue::PlatformFileErrorToWebFileError(error_code)); 63 webkit_glue::PlatformFileErrorToWebFileError(error_code));
70 } 64 }
71 65
72 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { 66 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) {
73 NOTREACHED(); 67 NOTREACHED();
74 } 68 }
OLDNEW
« no previous file with comments | « content/common/file_utilities_messages.h ('k') | content/renderer/renderer_webkitplatformsupport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698