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

Side by Side Diff: webkit/fileapi/async_file_util_adapter.cc

Issue 14671020: FileAPI: Copy base::FileUtilProxy::Entry to fileapi::DirectoryEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build and remove base/ change Created 7 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
« no previous file with comments | « webkit/fileapi/async_file_util.h ('k') | webkit/fileapi/directory_entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/fileapi/async_file_util_adapter.h" 5 #include "webkit/fileapi/async_file_util_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "webkit/blob/shareable_file_reference.h" 10 #include "webkit/blob/shareable_file_reference.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!file_info.is_directory) { 102 if (!file_info.is_directory) {
103 error_ = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; 103 error_ = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
104 return; 104 return;
105 } 105 }
106 106
107 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( 107 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum(
108 file_util->CreateFileEnumerator(context, url)); 108 file_util->CreateFileEnumerator(context, url));
109 109
110 base::FilePath current; 110 base::FilePath current;
111 while (!(current = file_enum->Next()).empty()) { 111 while (!(current = file_enum->Next()).empty()) {
112 AsyncFileUtil::Entry entry; 112 DirectoryEntry entry;
113 entry.is_directory = file_enum->IsDirectory(); 113 entry.is_directory = file_enum->IsDirectory();
114 entry.name = VirtualPath::BaseName(current).value(); 114 entry.name = VirtualPath::BaseName(current).value();
115 entry.size = file_enum->Size(); 115 entry.size = file_enum->Size();
116 entry.last_modified_time = file_enum->LastModifiedTime(); 116 entry.last_modified_time = file_enum->LastModifiedTime();
117 entries_.push_back(entry); 117 entries_.push_back(entry);
118 } 118 }
119 error_ = base::PLATFORM_FILE_OK; 119 error_ = base::PLATFORM_FILE_OK;
120 } 120 }
121 121
122 void Reply(const AsyncFileUtil::ReadDirectoryCallback& callback) { 122 void Reply(const AsyncFileUtil::ReadDirectoryCallback& callback) {
123 if (!callback.is_null()) 123 if (!callback.is_null())
124 callback.Run(error_, entries_, false /* has_more */); 124 callback.Run(error_, entries_, false /* has_more */);
125 } 125 }
126 126
127 private: 127 private:
128 base::PlatformFileError error_; 128 base::PlatformFileError error_;
129 std::vector<AsyncFileUtil::Entry> entries_; 129 std::vector<DirectoryEntry> entries_;
130 DISALLOW_COPY_AND_ASSIGN(ReadDirectoryHelper); 130 DISALLOW_COPY_AND_ASSIGN(ReadDirectoryHelper);
131 }; 131 };
132 132
133 } // namespace 133 } // namespace
134 134
135 AsyncFileUtilAdapter::AsyncFileUtilAdapter( 135 AsyncFileUtilAdapter::AsyncFileUtilAdapter(
136 FileSystemFileUtil* sync_file_util) 136 FileSystemFileUtil* sync_file_util)
137 : sync_file_util_(sync_file_util) { 137 : sync_file_util_(sync_file_util) {
138 DCHECK(sync_file_util_.get()); 138 DCHECK(sync_file_util_.get());
139 } 139 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 const CreateSnapshotFileCallback& callback) { 298 const CreateSnapshotFileCallback& callback) {
299 GetFileInfoHelper* helper = new GetFileInfoHelper; 299 GetFileInfoHelper* helper = new GetFileInfoHelper;
300 return context->task_runner()->PostTaskAndReply( 300 return context->task_runner()->PostTaskAndReply(
301 FROM_HERE, 301 FROM_HERE,
302 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), 302 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper),
303 sync_file_util_.get(), context, url), 303 sync_file_util_.get(), context, url),
304 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); 304 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback));
305 } 305 }
306 306
307 } // namespace fileapi 307 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/async_file_util.h ('k') | webkit/fileapi/directory_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698