OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child/ftp_directory_listing_response_delegate.h" | 5 #include "webkit/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 30 matching lines...) Expand all Loading... |
41 if (base::DetectEncoding(path, &encoding) && !encoding.empty()) { | 41 if (base::DetectEncoding(path, &encoding) && !encoding.empty()) { |
42 base::string16 path_utf16; | 42 base::string16 path_utf16; |
43 if (base::CodepageToUTF16(path, encoding.c_str(), | 43 if (base::CodepageToUTF16(path, encoding.c_str(), |
44 base::OnStringConversionError::SUBSTITUTE, | 44 base::OnStringConversionError::SUBSTITUTE, |
45 &path_utf16)) { | 45 &path_utf16)) { |
46 return path_utf16; | 46 return path_utf16; |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 // Use system native encoding as the last resort. | 50 // Use system native encoding as the last resort. |
51 return WideToUTF16Hack(base::SysNativeMBToWide(path)); | 51 return base::WideToUTF16Hack(base::SysNativeMBToWide(path)); |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 namespace webkit_glue { | 56 namespace webkit_glue { |
57 | 57 |
58 FtpDirectoryListingResponseDelegate::FtpDirectoryListingResponseDelegate( | 58 FtpDirectoryListingResponseDelegate::FtpDirectoryListingResponseDelegate( |
59 WebURLLoaderClient* client, | 59 WebURLLoaderClient* client, |
60 WebURLLoader* loader, | 60 WebURLLoader* loader, |
61 const WebURLResponse& response) | 61 const WebURLResponse& response) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 base::ASCIIToUTF16(".."), std::string(), false, 0, base::Time())); | 114 base::ASCIIToUTF16(".."), std::string(), false, 0, base::Time())); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 void FtpDirectoryListingResponseDelegate::SendDataToClient( | 118 void FtpDirectoryListingResponseDelegate::SendDataToClient( |
119 const std::string& data) { | 119 const std::string& data) { |
120 client_->didReceiveData(loader_, data.data(), data.length(), -1); | 120 client_->didReceiveData(loader_, data.data(), data.length(), -1); |
121 } | 121 } |
122 | 122 |
123 } // namespace webkit_glue | 123 } // namespace webkit_glue |
OLD | NEW |