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

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

Issue 6731033: Remove the path from PlatformFileInfo; it's cleaner just to pass it along as a (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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) 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 15 matching lines...) Expand all
26 WebFileSystemCallbacks* callbacks) 26 WebFileSystemCallbacks* callbacks)
27 : callbacks_(callbacks) { 27 : callbacks_(callbacks) {
28 DCHECK(callbacks_); 28 DCHECK(callbacks_);
29 } 29 }
30 30
31 void WebFileSystemCallbackDispatcher::DidSucceed() { 31 void WebFileSystemCallbackDispatcher::DidSucceed() {
32 callbacks_->didSucceed(); 32 callbacks_->didSucceed();
33 } 33 }
34 34
35 void WebFileSystemCallbackDispatcher::DidReadMetadata( 35 void WebFileSystemCallbackDispatcher::DidReadMetadata(
36 const base::PlatformFileInfo& file_info) { 36 const base::PlatformFileInfo& file_info, const FilePath& platform_path) {
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 = 44 web_file_info.platformPath =
45 webkit_glue::FilePathToWebString(file_info.path); 45 webkit_glue::FilePathToWebString(platform_path);
46 callbacks_->didReadMetadata(web_file_info); 46 callbacks_->didReadMetadata(web_file_info);
47 } 47 }
48 48
49 void WebFileSystemCallbackDispatcher::DidReadDirectory( 49 void WebFileSystemCallbackDispatcher::DidReadDirectory(
50 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) { 50 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
51 WebVector<WebFileSystemEntry> file_system_entries(entries.size()); 51 WebVector<WebFileSystemEntry> file_system_entries(entries.size());
52 for (size_t i = 0; i < entries.size(); i++) { 52 for (size_t i = 0; i < entries.size(); i++) {
53 file_system_entries[i].name = 53 file_system_entries[i].name =
54 webkit_glue::FilePathStringToWebString(entries[i].name); 54 webkit_glue::FilePathStringToWebString(entries[i].name);
55 file_system_entries[i].isDirectory = entries[i].is_directory; 55 file_system_entries[i].isDirectory = entries[i].is_directory;
56 } 56 }
57 callbacks_->didReadDirectory(file_system_entries, has_more); 57 callbacks_->didReadDirectory(file_system_entries, has_more);
58 } 58 }
59 59
60 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( 60 void WebFileSystemCallbackDispatcher::DidOpenFileSystem(
61 const std::string& name, const FilePath& root_path) { 61 const std::string& name, const FilePath& root_path) {
62 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), 62 callbacks_->didOpenFileSystem(UTF8ToUTF16(name),
63 webkit_glue::FilePathToWebString(root_path)); 63 webkit_glue::FilePathToWebString(root_path));
64 } 64 }
65 65
66 void WebFileSystemCallbackDispatcher::DidFail( 66 void WebFileSystemCallbackDispatcher::DidFail(
67 base::PlatformFileError error_code) { 67 base::PlatformFileError error_code) {
68 callbacks_->didFail( 68 callbacks_->didFail(
69 webkit_glue::PlatformFileErrorToWebFileError(error_code)); 69 webkit_glue::PlatformFileErrorToWebFileError(error_code));
70 } 70 }
71 71
72 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { 72 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) {
73 NOTREACHED(); 73 NOTREACHED();
74 } 74 }
OLDNEW
« no previous file with comments | « content/common/file_system/webfilesystem_callback_dispatcher.h ('k') | content/common/file_system/webfilewriter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698