OLD | NEW |
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 "storage/browser/fileapi/async_file_util_adapter.h" | 5 #include "storage/browser/fileapi/async_file_util_adapter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const size_t kResultChunkSize = 100; | 109 const size_t kResultChunkSize = 100; |
110 | 110 |
111 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( | 111 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( |
112 file_util->CreateFileEnumerator(context, url)); | 112 file_util->CreateFileEnumerator(context, url)); |
113 | 113 |
114 base::FilePath current; | 114 base::FilePath current; |
115 while (!(current = file_enum->Next()).empty()) { | 115 while (!(current = file_enum->Next()).empty()) { |
116 DirectoryEntry entry; | 116 DirectoryEntry entry; |
117 entry.is_directory = file_enum->IsDirectory(); | 117 entry.is_directory = file_enum->IsDirectory(); |
118 entry.name = VirtualPath::BaseName(current).value(); | 118 entry.name = VirtualPath::BaseName(current).value(); |
119 entry.size = file_enum->Size(); | |
120 entry.last_modified_time = file_enum->LastModifiedTime(); | |
121 entries.push_back(entry); | 119 entries.push_back(entry); |
122 | 120 |
123 if (entries.size() == kResultChunkSize) { | 121 if (entries.size() == kResultChunkSize) { |
124 origin_runner->PostTask( | 122 origin_runner->PostTask( |
125 FROM_HERE, base::Bind(callback, base::File::FILE_OK, entries, | 123 FROM_HERE, base::Bind(callback, base::File::FILE_OK, entries, |
126 true /* has_more */)); | 124 true /* has_more */)); |
127 entries.clear(); | 125 entries.clear(); |
128 } | 126 } |
129 } | 127 } |
130 origin_runner->PostTask( | 128 origin_runner->PostTask( |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 GetFileInfoHelper* helper = new GetFileInfoHelper; | 341 GetFileInfoHelper* helper = new GetFileInfoHelper; |
344 const bool success = context_ptr->task_runner()->PostTaskAndReply( | 342 const bool success = context_ptr->task_runner()->PostTaskAndReply( |
345 FROM_HERE, | 343 FROM_HERE, |
346 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), | 344 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), |
347 sync_file_util_.get(), base::Owned(context_ptr), url), | 345 sync_file_util_.get(), base::Owned(context_ptr), url), |
348 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); | 346 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); |
349 DCHECK(success); | 347 DCHECK(success); |
350 } | 348 } |
351 | 349 |
352 } // namespace storage | 350 } // namespace storage |
OLD | NEW |