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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <vector> | 10 #include <vector> |
8 | 11 |
9 #include "base/i18n/icu_encoding_detection.h" | 12 #include "base/i18n/icu_encoding_detection.h" |
10 #include "base/i18n/icu_string_conversions.h" | 13 #include "base/i18n/icu_string_conversions.h" |
11 #include "base/logging.h" | 14 #include "base/logging.h" |
12 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
13 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 18 #include "base/time/time.h" |
16 #include "content/child/weburlresponse_extradata_impl.h" | 19 #include "content/child/weburlresponse_extradata_impl.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 for (size_t i = 0; i < entries.size(); i++) { | 95 for (size_t i = 0; i < entries.size(); i++) { |
93 const FtpDirectoryListingEntry& entry = entries[i]; | 96 const FtpDirectoryListingEntry& entry = entries[i]; |
94 | 97 |
95 // Skip the current and parent directory entries in the listing. Our header | 98 // Skip the current and parent directory entries in the listing. Our header |
96 // always includes them. | 99 // always includes them. |
97 if (base::EqualsASCII(entry.name, ".") || | 100 if (base::EqualsASCII(entry.name, ".") || |
98 base::EqualsASCII(entry.name, "..")) | 101 base::EqualsASCII(entry.name, "..")) |
99 continue; | 102 continue; |
100 | 103 |
101 bool is_directory = (entry.type == FtpDirectoryListingEntry::DIRECTORY); | 104 bool is_directory = (entry.type == FtpDirectoryListingEntry::DIRECTORY); |
102 int64 size = entry.size; | 105 int64_t size = entry.size; |
103 if (entry.type != FtpDirectoryListingEntry::FILE) | 106 if (entry.type != FtpDirectoryListingEntry::FILE) |
104 size = 0; | 107 size = 0; |
105 SendDataToClient(net::GetDirectoryListingEntry( | 108 SendDataToClient(net::GetDirectoryListingEntry( |
106 entry.name, entry.raw_name, is_directory, size, entry.last_modified)); | 109 entry.name, entry.raw_name, is_directory, size, entry.last_modified)); |
107 } | 110 } |
108 } | 111 } |
109 | 112 |
110 void FtpDirectoryListingResponseDelegate::Init(const GURL& response_url) { | 113 void FtpDirectoryListingResponseDelegate::Init(const GURL& response_url) { |
111 net::UnescapeRule::Type unescape_rules = net::UnescapeRule::SPACES | | 114 net::UnescapeRule::Type unescape_rules = net::UnescapeRule::SPACES | |
112 net::UnescapeRule::URL_SPECIAL_CHARS; | 115 net::UnescapeRule::URL_SPECIAL_CHARS; |
(...skipping 10 matching lines...) Expand all Loading... |
123 } | 126 } |
124 } | 127 } |
125 | 128 |
126 void FtpDirectoryListingResponseDelegate::SendDataToClient( | 129 void FtpDirectoryListingResponseDelegate::SendDataToClient( |
127 const std::string& data) { | 130 const std::string& data) { |
128 if (client_) | 131 if (client_) |
129 client_->didReceiveData(loader_, data.data(), data.length(), -1); | 132 client_->didReceiveData(loader_, data.data(), data.length(), -1); |
130 } | 133 } |
131 | 134 |
132 } // namespace content | 135 } // namespace content |
OLD | NEW |