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

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

Issue 6537011: Display only the sandboxed portion of the URL when listing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 | no next file » | 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 void FileSystemDirURLRequestJob::DidReadDirectory( 110 void FileSystemDirURLRequestJob::DidReadDirectory(
111 base::PlatformFileError error_code, 111 base::PlatformFileError error_code,
112 const std::vector<base::FileUtilProxy::Entry>& entries) { 112 const std::vector<base::FileUtilProxy::Entry>& entries) {
113 if (error_code != base::PLATFORM_FILE_OK) { 113 if (error_code != base::PLATFORM_FILE_OK) {
114 NotifyFailed(error_code); 114 NotifyFailed(error_code);
115 return; 115 return;
116 } 116 }
117 117
118 #if defined(OS_WIN) 118 #if defined(OS_WIN)
119 const string16& title = absolute_dir_path_.value(); 119 const string16& title = relative_dir_path_.value();
120 #elif defined(OS_POSIX) 120 #elif defined(OS_POSIX)
121 const string16& title = WideToUTF16( 121 const string16& title = WideToUTF16(
122 base::SysNativeMBToWide(absolute_dir_path_.value())); 122 base::SysNativeMBToWide(relative_dir_path_.value()));
123 #endif 123 #endif
124 data_.append(net::GetDirectoryListingHeader(title)); 124 data_.append(net::GetDirectoryListingHeader(ASCIIToUTF16("/") + title));
125 125
126 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; 126 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator;
127 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { 127 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) {
128 #if defined(OS_WIN) 128 #if defined(OS_WIN)
129 const string16& name = it->name; 129 const string16& name = it->name;
130 #elif defined(OS_POSIX) 130 #elif defined(OS_POSIX)
131 const string16& name = 131 const string16& name =
132 WideToUTF16(base::SysNativeMBToWide(it->name)); 132 WideToUTF16(base::SysNativeMBToWide(it->name));
133 #endif 133 #endif
134 // TODO(adamk): Add file size? 134 // TODO(adamk): Add file size?
135 data_.append(net::GetDirectoryListingEntry( 135 data_.append(net::GetDirectoryListingEntry(
136 name, std::string(), it->is_directory, 0, base::Time())); 136 name, std::string(), it->is_directory, 0, base::Time()));
137 } 137 }
138 138
139 set_expected_content_size(data_.size()); 139 set_expected_content_size(data_.size());
140 NotifyHeadersComplete(); 140 NotifyHeadersComplete();
141 } 141 }
142 142
143 void FileSystemDirURLRequestJob::NotifyFailed(int rv) { 143 void FileSystemDirURLRequestJob::NotifyFailed(int rv) {
144 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 144 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
145 } 145 }
146 146
147 } // namespace fileapi 147 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698