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

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

Issue 7353012: Fill size and modified time entry on FileSystem API directory view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 5 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 | « no previous file | webkit/fileapi/file_system_dir_url_request_job_unittest.cc » ('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) 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/fileapi/file_system_dir_url_request_job.h" 5 #include "webkit/fileapi/file_system_dir_url_request_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const std::vector<base::FileUtilProxy::Entry>& entries, 141 const std::vector<base::FileUtilProxy::Entry>& entries,
142 bool has_more) { 142 bool has_more) {
143 if (!request_) 143 if (!request_)
144 return; 144 return;
145 145
146 if (data_.empty()) { 146 if (data_.empty()) {
147 FilePath relative_path = GetRelativePath(request_->url()); 147 FilePath relative_path = GetRelativePath(request_->url());
148 #if defined(OS_WIN) 148 #if defined(OS_WIN)
149 const string16& title = relative_path.value(); 149 const string16& title = relative_path.value();
150 #elif defined(OS_POSIX) 150 #elif defined(OS_POSIX)
151 const string16& title = WideToUTF16( 151 const string16& title = ASCIIToUTF16("/") +
152 base::SysNativeMBToWide(relative_path.value())); 152 WideToUTF16(base::SysNativeMBToWide(relative_path.value()));
153 #endif 153 #endif
154 data_.append(net::GetDirectoryListingHeader(ASCIIToUTF16("/") + title)); 154 data_.append(net::GetDirectoryListingHeader(title));
155 } 155 }
156 156
157 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; 157 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator;
158 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { 158 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) {
159 #if defined(OS_WIN) 159 #if defined(OS_WIN)
160 const string16& name = it->name; 160 const string16& name = it->name;
161 #elif defined(OS_POSIX) 161 #elif defined(OS_POSIX)
162 const string16& name = 162 const string16& name =
163 WideToUTF16(base::SysNativeMBToWide(it->name)); 163 WideToUTF16(base::SysNativeMBToWide(it->name));
164 #endif 164 #endif
165 // TODO(adamk): Add file size?
166 data_.append(net::GetDirectoryListingEntry( 165 data_.append(net::GetDirectoryListingEntry(
167 name, std::string(), it->is_directory, 0, base::Time())); 166 name, std::string(), it->is_directory, it->size,
167 it->last_modified_time));
168 } 168 }
169 169
170 if (has_more) 170 if (has_more) {
171 GetNewOperation()->ReadDirectory(request_->url()); 171 GetNewOperation()->ReadDirectory(request_->url());
172 else { 172 } else {
173 set_expected_content_size(data_.size()); 173 set_expected_content_size(data_.size());
174 NotifyHeadersComplete(); 174 NotifyHeadersComplete();
175 } 175 }
176 } 176 }
177 177
178 FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation() { 178 FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation() {
179 return new FileSystemOperation(new CallbackDispatcher(this), 179 return new FileSystemOperation(new CallbackDispatcher(this),
180 file_thread_proxy_, 180 file_thread_proxy_,
181 file_system_context_, 181 file_system_context_,
182 NULL); 182 NULL);
183 } 183 }
184 184
185 } // namespace fileapi 185 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_dir_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698