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

Unified Diff: content/child/ftp_directory_listing_response_delegate.cc

Issue 2792533003: Separate the parent directory link in FTP listings. (Closed)
Patch Set: Fix comment not converted by Blink mass reformatting Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/dir_header.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/ftp_directory_listing_response_delegate.cc
diff --git a/content/child/ftp_directory_listing_response_delegate.cc b/content/child/ftp_directory_listing_response_delegate.cc
index b2837abb58b368408b1029efca0267d07818bd07..5b7763eed636054b53738afbc2e7068478fbe72f 100644
--- a/content/child/ftp_directory_listing_response_delegate.cc
+++ b/content/child/ftp_directory_listing_response_delegate.cc
@@ -65,7 +65,7 @@ FtpDirectoryListingResponseDelegate::FtpDirectoryListingResponseDelegate(
: client_(client),
loader_(loader) {
if (response.GetExtraData()) {
- // extraData can be NULL during tests.
+ // |extra_data| can be NULL during tests.
WebURLResponseExtraDataImpl* extra_data =
static_cast<WebURLResponseExtraDataImpl*>(response.GetExtraData());
extra_data->set_is_ftp_directory_listing(true);
@@ -74,8 +74,8 @@ FtpDirectoryListingResponseDelegate::FtpDirectoryListingResponseDelegate(
}
void FtpDirectoryListingResponseDelegate::Cancel() {
- client_ = NULL;
- loader_ = NULL;
+ client_ = nullptr;
+ loader_ = nullptr;
}
void FtpDirectoryListingResponseDelegate::OnReceivedData(const char* data,
@@ -85,7 +85,7 @@ void FtpDirectoryListingResponseDelegate::OnReceivedData(const char* data,
void FtpDirectoryListingResponseDelegate::OnCompletedRequest() {
std::vector<FtpDirectoryListingEntry> entries;
- int rv = -1;
+ int rv = net::ERR_NOT_IMPLEMENTED;
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
rv = net::ParseFtpDirectoryListing(buffer_, base::Time::Now(), &entries);
#endif
@@ -93,9 +93,7 @@ void FtpDirectoryListingResponseDelegate::OnCompletedRequest() {
SendDataToClient("<script>onListingParsingError();</script>\n");
return;
}
- for (size_t i = 0; i < entries.size(); i++) {
- const FtpDirectoryListingEntry& entry = entries[i];
-
+ for (const FtpDirectoryListingEntry& entry : entries) {
// Skip the current and parent directory entries in the listing. Our header
// always includes them.
if (base::EqualsASCII(entry.name, ".") ||
@@ -103,9 +101,8 @@ void FtpDirectoryListingResponseDelegate::OnCompletedRequest() {
continue;
bool is_directory = (entry.type == FtpDirectoryListingEntry::DIRECTORY);
- int64_t size = entry.size;
- if (entry.type != FtpDirectoryListingEntry::FILE)
- size = 0;
+ int64_t size =
+ entry.type == FtpDirectoryListingEntry::FILE ? entry.size : 0;
SendDataToClient(net::GetDirectoryListingEntry(
entry.name, entry.raw_name, is_directory, size, entry.last_modified));
}
@@ -123,8 +120,7 @@ void FtpDirectoryListingResponseDelegate::Init(const GURL& response_url) {
// If this isn't top level directory (i.e. the path isn't "/",)
// add a link to the parent directory.
if (response_url.path().length() > 1) {
- SendDataToClient(net::GetDirectoryListingEntry(
- base::ASCIIToUTF16(".."), std::string(), false, 0, base::Time()));
+ SendDataToClient("<script>onHasParentDirectory();</script>\n");
}
}
« no previous file with comments | « no previous file | net/base/dir_header.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698