OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/ftp_directory_listing_response_delegate.h" | 5 #include "content/child/ftp_directory_listing_response_delegate.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/i18n/icu_encoding_detection.h" | 9 #include "base/i18n/icu_encoding_detection.h" |
10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #endif | 87 #endif |
88 if (rv != net::OK) { | 88 if (rv != net::OK) { |
89 SendDataToClient("<script>onListingParsingError();</script>\n"); | 89 SendDataToClient("<script>onListingParsingError();</script>\n"); |
90 return; | 90 return; |
91 } | 91 } |
92 for (size_t i = 0; i < entries.size(); i++) { | 92 for (size_t i = 0; i < entries.size(); i++) { |
93 const FtpDirectoryListingEntry& entry = entries[i]; | 93 const FtpDirectoryListingEntry& entry = entries[i]; |
94 | 94 |
95 // Skip the current and parent directory entries in the listing. Our header | 95 // Skip the current and parent directory entries in the listing. Our header |
96 // always includes them. | 96 // always includes them. |
97 if (EqualsASCII(entry.name, ".") || EqualsASCII(entry.name, "..")) | 97 if (base::EqualsASCII(entry.name, ".") || |
| 98 base::EqualsASCII(entry.name, "..")) |
98 continue; | 99 continue; |
99 | 100 |
100 bool is_directory = (entry.type == FtpDirectoryListingEntry::DIRECTORY); | 101 bool is_directory = (entry.type == FtpDirectoryListingEntry::DIRECTORY); |
101 int64 size = entry.size; | 102 int64 size = entry.size; |
102 if (entry.type != FtpDirectoryListingEntry::FILE) | 103 if (entry.type != FtpDirectoryListingEntry::FILE) |
103 size = 0; | 104 size = 0; |
104 SendDataToClient(net::GetDirectoryListingEntry( | 105 SendDataToClient(net::GetDirectoryListingEntry( |
105 entry.name, entry.raw_name, is_directory, size, entry.last_modified)); | 106 entry.name, entry.raw_name, is_directory, size, entry.last_modified)); |
106 } | 107 } |
107 } | 108 } |
(...skipping 14 matching lines...) Expand all Loading... |
122 } | 123 } |
123 } | 124 } |
124 | 125 |
125 void FtpDirectoryListingResponseDelegate::SendDataToClient( | 126 void FtpDirectoryListingResponseDelegate::SendDataToClient( |
126 const std::string& data) { | 127 const std::string& data) { |
127 if (client_) | 128 if (client_) |
128 client_->didReceiveData(loader_, data.data(), data.length(), -1); | 129 client_->didReceiveData(loader_, data.data(), data.length(), -1); |
129 } | 130 } |
130 | 131 |
131 } // namespace content | 132 } // namespace content |
OLD | NEW |