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

Side by Side Diff: content/child/ftp_directory_listing_response_delegate.cc

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | content/child/simple_webmimeregistry_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 using blink::WebURLLoaderClient; 27 using blink::WebURLLoaderClient;
28 using blink::WebURLResponse; 28 using blink::WebURLResponse;
29 29
30 using webkit_glue::WebURLResponseExtraDataImpl; 30 using webkit_glue::WebURLResponseExtraDataImpl;
31 31
32 namespace { 32 namespace {
33 33
34 base::string16 ConvertPathToUTF16(const std::string& path) { 34 base::string16 ConvertPathToUTF16(const std::string& path) {
35 // Per RFC 2640, FTP servers should use UTF-8 or its proper subset ASCII, 35 // Per RFC 2640, FTP servers should use UTF-8 or its proper subset ASCII,
36 // but many old FTP servers use legacy encodings. Try UTF-8 first. 36 // but many old FTP servers use legacy encodings. Try UTF-8 first.
37 if (IsStringUTF8(path)) 37 if (base::IsStringUTF8(path))
38 return base::UTF8ToUTF16(path); 38 return base::UTF8ToUTF16(path);
39 39
40 // Try detecting the encoding. The sample is rather small though, so it may 40 // Try detecting the encoding. The sample is rather small though, so it may
41 // fail. 41 // fail.
42 std::string encoding; 42 std::string encoding;
43 if (base::DetectEncoding(path, &encoding) && !encoding.empty()) { 43 if (base::DetectEncoding(path, &encoding) && !encoding.empty()) {
44 base::string16 path_utf16; 44 base::string16 path_utf16;
45 if (base::CodepageToUTF16(path, encoding.c_str(), 45 if (base::CodepageToUTF16(path, encoding.c_str(),
46 base::OnStringConversionError::SUBSTITUTE, 46 base::OnStringConversionError::SUBSTITUTE,
47 &path_utf16)) { 47 &path_utf16)) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 base::ASCIIToUTF16(".."), std::string(), false, 0, base::Time())); 116 base::ASCIIToUTF16(".."), std::string(), false, 0, base::Time()));
117 } 117 }
118 } 118 }
119 119
120 void FtpDirectoryListingResponseDelegate::SendDataToClient( 120 void FtpDirectoryListingResponseDelegate::SendDataToClient(
121 const std::string& data) { 121 const std::string& data) {
122 client_->didReceiveData(loader_, data.data(), data.length(), -1); 122 client_->didReceiveData(loader_, data.data(), data.length(), -1);
123 } 123 }
124 124
125 } // namespace content 125 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | content/child/simple_webmimeregistry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698