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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "content/child/weburlresponse_extradata_impl.h" |
16 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
19 #include "net/ftp/ftp_directory_listing_parser.h" | 20 #include "net/ftp/ftp_directory_listing_parser.h" |
20 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
21 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 22 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
22 #include "webkit/child/weburlresponse_extradata_impl.h" | |
23 | 23 |
24 using blink::WebURLLoader; | 24 using blink::WebURLLoader; |
25 using blink::WebURLLoaderClient; | 25 using blink::WebURLLoaderClient; |
26 using blink::WebURLResponse; | 26 using blink::WebURLResponse; |
27 using net::FtpDirectoryListingEntry; | 27 using net::FtpDirectoryListingEntry; |
28 using webkit_glue::WebURLResponseExtraDataImpl; | |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
32 base::string16 ConvertPathToUTF16(const std::string& path) { | 31 base::string16 ConvertPathToUTF16(const std::string& path) { |
33 // Per RFC 2640, FTP servers should use UTF-8 or its proper subset ASCII, | 32 // Per RFC 2640, FTP servers should use UTF-8 or its proper subset ASCII, |
34 // but many old FTP servers use legacy encodings. Try UTF-8 first. | 33 // but many old FTP servers use legacy encodings. Try UTF-8 first. |
35 if (base::IsStringUTF8(path)) | 34 if (base::IsStringUTF8(path)) |
36 return base::UTF8ToUTF16(path); | 35 return base::UTF8ToUTF16(path); |
37 | 36 |
38 // Try detecting the encoding. The sample is rather small though, so it may | 37 // Try detecting the encoding. The sample is rather small though, so it may |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 122 } |
124 } | 123 } |
125 | 124 |
126 void FtpDirectoryListingResponseDelegate::SendDataToClient( | 125 void FtpDirectoryListingResponseDelegate::SendDataToClient( |
127 const std::string& data) { | 126 const std::string& data) { |
128 if (client_) | 127 if (client_) |
129 client_->didReceiveData(loader_, data.data(), data.length(), -1); | 128 client_->didReceiveData(loader_, data.data(), data.length(), -1); |
130 } | 129 } |
131 | 130 |
132 } // namespace content | 131 } // namespace content |
OLD | NEW |