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

Side by Side Diff: net/ftp/ftp_network_transaction.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
OLDNEW
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 "net/ftp/ftp_network_transaction.h" 5 #include "net/ftp/ftp_network_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 // All important info should be on the first line. 828 // All important info should be on the first line.
829 std::string line = response.lines[0]; 829 std::string line = response.lines[0];
830 // The response should be ASCII, which allows us to do case-insensitive 830 // The response should be ASCII, which allows us to do case-insensitive
831 // comparisons easily. If it is not ASCII, we leave the system type 831 // comparisons easily. If it is not ASCII, we leave the system type
832 // as unknown. 832 // as unknown.
833 if (IsStringASCII(line)) { 833 if (IsStringASCII(line)) {
834 line = StringToLowerASCII(line); 834 line = StringToLowerASCII(line);
835 835
836 // Remove all whitespace, to correctly handle cases like fancy "V M S" 836 // Remove all whitespace, to correctly handle cases like fancy "V M S"
837 // response instead of "VMS". 837 // response instead of "VMS".
838 RemoveChars(line, base::kWhitespaceASCII, &line); 838 base::RemoveChars(line, base::kWhitespaceASCII, &line);
839 839
840 // The "magic" strings we test for below have been gathered by an 840 // The "magic" strings we test for below have been gathered by an
841 // empirical study. VMS needs to come first because some VMS systems 841 // empirical study. VMS needs to come first because some VMS systems
842 // also respond with "UNIX emulation", which is not perfect. It is much 842 // also respond with "UNIX emulation", which is not perfect. It is much
843 // more reliable to talk to these servers in their native language. 843 // more reliable to talk to these servers in their native language.
844 if (line.find("vms") != std::string::npos) { 844 if (line.find("vms") != std::string::npos) {
845 system_type_ = SYSTEM_TYPE_VMS; 845 system_type_ = SYSTEM_TYPE_VMS;
846 } else if (line.find("l8") != std::string::npos || 846 } else if (line.find("l8") != std::string::npos ||
847 line.find("unix") != std::string::npos || 847 line.find("unix") != std::string::npos ||
848 line.find("bsd") != std::string::npos) { 848 line.find("bsd") != std::string::npos) {
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 if (!had_error_type[type]) { 1393 if (!had_error_type[type]) {
1394 had_error_type[type] = true; 1394 had_error_type[type] = true;
1395 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1395 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1396 type, NUM_OF_NET_ERROR_TYPES); 1396 type, NUM_OF_NET_ERROR_TYPES);
1397 } 1397 }
1398 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1398 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1399 type, NUM_OF_NET_ERROR_TYPES); 1399 type, NUM_OF_NET_ERROR_TYPES);
1400 } 1400 }
1401 1401
1402 } // namespace net 1402 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698