summaryrefslogtreecommitdiffstats
path: root/net/ftp
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 19:58:57 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-29 19:58:57 +0000
commit42cba2fb14b47a0c9463763b7c8c83f36d2fcef5 (patch)
treeef873bab10a838d28cc81c0e927f156ee6b55b5e /net/ftp
parentb82d265634ced5b6457dac631868e7270963fa7e (diff)
downloadchromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.zip
chromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.tar.gz
chromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.tar.bz2
Convert net to use base::string16 instead of string16.
This is just a search-and-replace. BUG= Review URL: https://codereview.chromium.org/13329004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r--net/ftp/ftp_auth_cache_unittest.cc22
-rw-r--r--net/ftp/ftp_directory_listing_parser.cc8
-rw-r--r--net/ftp/ftp_directory_listing_parser.h2
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls.cc24
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls.h2
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware.cc6
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware.h2
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware_unittest.cc5
-rw-r--r--net/ftp/ftp_directory_listing_parser_os2.cc4
-rw-r--r--net/ftp/ftp_directory_listing_parser_os2.h2
-rw-r--r--net/ftp/ftp_directory_listing_parser_unittest.h4
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms.cc38
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms.h2
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms_unittest.cc7
-rw-r--r--net/ftp/ftp_directory_listing_parser_windows.cc4
-rw-r--r--net/ftp/ftp_directory_listing_parser_windows.h2
-rw-r--r--net/ftp/ftp_network_transaction.cc4
-rw-r--r--net/ftp/ftp_util.cc31
-rw-r--r--net/ftp/ftp_util.h15
19 files changed, 96 insertions, 88 deletions
diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc
index 33ce553..e036635 100644
--- a/net/ftp/ftp_auth_cache_unittest.cc
+++ b/net/ftp/ftp_auth_cache_unittest.cc
@@ -15,17 +15,17 @@ using net::FtpAuthCache;
namespace {
-const string16 kBogus(ASCIIToUTF16("bogus"));
-const string16 kOthername(ASCIIToUTF16("othername"));
-const string16 kOtherword(ASCIIToUTF16("otherword"));
-const string16 kPassword(ASCIIToUTF16("password"));
-const string16 kPassword1(ASCIIToUTF16("password1"));
-const string16 kPassword2(ASCIIToUTF16("password2"));
-const string16 kPassword3(ASCIIToUTF16("password3"));
-const string16 kUsername(ASCIIToUTF16("username"));
-const string16 kUsername1(ASCIIToUTF16("username1"));
-const string16 kUsername2(ASCIIToUTF16("username2"));
-const string16 kUsername3(ASCIIToUTF16("username3"));
+const base::string16 kBogus(ASCIIToUTF16("bogus"));
+const base::string16 kOthername(ASCIIToUTF16("othername"));
+const base::string16 kOtherword(ASCIIToUTF16("otherword"));
+const base::string16 kPassword(ASCIIToUTF16("password"));
+const base::string16 kPassword1(ASCIIToUTF16("password1"));
+const base::string16 kPassword2(ASCIIToUTF16("password2"));
+const base::string16 kPassword3(ASCIIToUTF16("password3"));
+const base::string16 kUsername(ASCIIToUTF16("username"));
+const base::string16 kUsername1(ASCIIToUTF16("username1"));
+const base::string16 kUsername2(ASCIIToUTF16("username2"));
+const base::string16 kUsername3(ASCIIToUTF16("username3"));
} // namespace
diff --git a/net/ftp/ftp_directory_listing_parser.cc b/net/ftp/ftp_directory_listing_parser.cc
index b57aff9..eb322e6 100644
--- a/net/ftp/ftp_directory_listing_parser.cc
+++ b/net/ftp/ftp_directory_listing_parser.cc
@@ -41,13 +41,13 @@ int FillInRawName(const std::string& encoding,
// Parses |text| as an FTP directory listing. Fills in |entries|
// and |server_type| and returns network error code.
-int ParseListing(const string16& text,
- const string16& newline_separator,
+int ParseListing(const base::string16& text,
+ const base::string16& newline_separator,
const std::string& encoding,
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries,
FtpServerType* server_type) {
- std::vector<string16> lines;
+ std::vector<base::string16> lines;
base::SplitStringUsingSubstr(text, newline_separator, &lines);
struct {
@@ -103,7 +103,7 @@ int DecodeAndParse(const std::string& text,
// Use first encoding that can be used to decode the text.
for (size_t i = 0; i < encodings.size(); i++) {
- string16 converted_text;
+ base::string16 converted_text;
if (base::CodepageToUTF16(text,
encodings[i].c_str(),
base::OnStringConversionError::FAIL,
diff --git a/net/ftp/ftp_directory_listing_parser.h b/net/ftp/ftp_directory_listing_parser.h
index cc431ee..21d7932 100644
--- a/net/ftp/ftp_directory_listing_parser.h
+++ b/net/ftp/ftp_directory_listing_parser.h
@@ -26,7 +26,7 @@ struct FtpDirectoryListingEntry {
FtpDirectoryListingEntry();
Type type;
- string16 name; // Name (UTF-16-encoded).
+ base::string16 name; // Name (UTF-16-encoded).
std::string raw_name; // Name in original character encoding.
int64 size; // File size, in bytes. -1 if not applicable.
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 6c5dc75..cab3101 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -16,13 +16,13 @@
namespace {
-bool TwoColumnDateListingToTime(const string16& date,
- const string16& time,
+bool TwoColumnDateListingToTime(const base::string16& date,
+ const base::string16& time,
base::Time* result) {
base::Time::Exploded time_exploded = { 0 };
// Date should be in format YYYY-MM-DD.
- std::vector<string16> date_parts;
+ std::vector<base::string16> date_parts;
base::SplitString(date, '-', &date_parts);
if (date_parts.size() != 3)
return false;
@@ -37,7 +37,7 @@ bool TwoColumnDateListingToTime(const string16& date,
if (time.length() != 5)
return false;
- std::vector<string16> time_parts;
+ std::vector<base::string16> time_parts;
base::SplitString(time, ':', &time_parts);
if (time_parts.size() != 2)
return false;
@@ -56,10 +56,10 @@ bool TwoColumnDateListingToTime(const string16& date,
// Returns the column index of the end of the date listing and detected
// last modification time.
bool DetectColumnOffsetSizeAndModificationTime(
- const std::vector<string16>& columns,
+ const std::vector<base::string16>& columns,
const base::Time& current_time,
size_t* offset,
- string16* size,
+ base::string16* size,
base::Time* modification_time) {
// The column offset can be arbitrarily large if some fields
// like owner or group name contain spaces. Try offsets from left to right
@@ -123,7 +123,7 @@ bool DetectColumnOffsetSizeAndModificationTime(
namespace net {
bool ParseFtpDirectoryListingLs(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries) {
// True after we have received a "total n" listing header, where n is an
@@ -134,7 +134,7 @@ bool ParseFtpDirectoryListingLs(
if (lines[i].empty())
continue;
- std::vector<string16> columns;
+ std::vector<base::string16> columns;
base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
// Some FTP servers put a "total n" line at the beginning of the listing
@@ -157,7 +157,7 @@ bool ParseFtpDirectoryListingLs(
FtpDirectoryListingEntry entry;
size_t column_offset;
- string16 size;
+ base::string16 size;
if (!DetectColumnOffsetSizeAndModificationTime(columns,
current_time,
&column_offset,
@@ -167,7 +167,7 @@ bool ParseFtpDirectoryListingLs(
// All those messages have in common is the string ".:",
// where "." means the current directory, and ":" separates it
// from the rest of the message, which may be empty.
- if (lines[i].find(ASCIIToUTF16(".:")) != string16::npos)
+ if (lines[i].find(ASCIIToUTF16(".:")) != base::string16::npos)
continue;
return false;
@@ -216,11 +216,11 @@ bool ParseFtpDirectoryListingLs(
column_offset + 1);
if (entry.type == FtpDirectoryListingEntry::SYMLINK) {
- string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> "));
+ base::string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> "));
// We don't require the " -> " to be present. Some FTP servers don't send
// the symlink target, possibly for security reasons.
- if (pos != string16::npos)
+ if (pos != base::string16::npos)
entry.name = entry.name.substr(0, pos);
}
diff --git a/net/ftp/ftp_directory_listing_parser_ls.h b/net/ftp/ftp_directory_listing_parser_ls.h
index f3c16eb..bf481cc 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.h
+++ b/net/ftp/ftp_directory_listing_parser_ls.h
@@ -20,7 +20,7 @@ struct FtpDirectoryListingEntry;
// Parses "ls -l" FTP directory listing. Returns true on success.
NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingLs(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries);
diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc
index bace441..3229c3e 100644
--- a/net/ftp/ftp_directory_listing_parser_netware.cc
+++ b/net/ftp/ftp_directory_listing_parser_netware.cc
@@ -15,7 +15,7 @@
namespace {
-bool LooksLikeNetwarePermissionsListing(const string16& text) {
+bool LooksLikeNetwarePermissionsListing(const base::string16& text) {
if (text.length() != 10)
return false;
@@ -36,7 +36,7 @@ bool LooksLikeNetwarePermissionsListing(const string16& text) {
namespace net {
bool ParseFtpDirectoryListingNetware(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries) {
if (!lines.empty() && !StartsWith(lines[0], ASCIIToUTF16("total "), true))
@@ -46,7 +46,7 @@ bool ParseFtpDirectoryListingNetware(
if (lines[i].empty())
continue;
- std::vector<string16> columns;
+ std::vector<base::string16> columns;
base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
if (columns.size() < 8)
diff --git a/net/ftp/ftp_directory_listing_parser_netware.h b/net/ftp/ftp_directory_listing_parser_netware.h
index a7bde93..4b087dd 100644
--- a/net/ftp/ftp_directory_listing_parser_netware.h
+++ b/net/ftp/ftp_directory_listing_parser_netware.h
@@ -20,7 +20,7 @@ struct FtpDirectoryListingEntry;
// Parses Netware FTP directory listing. Returns true on success.
NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingNetware(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
const base::Time& current_time,
std::vector<FtpDirectoryListingEntry>* entries);
diff --git a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
index f6715ff..e5e4211 100644
--- a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
@@ -32,7 +32,8 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
good_cases[i].input));
- std::vector<string16> lines(GetSingleLineTestCase(good_cases[i].input));
+ std::vector<base::string16> lines(
+ GetSingleLineTestCase(good_cases[i].input));
// The parser requires a "total n" line before accepting regular input.
lines.insert(lines.begin(), ASCIIToUTF16("total 1"));
@@ -59,7 +60,7 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Bad) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
bad_cases[i]));
- std::vector<string16> lines(GetSingleLineTestCase(bad_cases[i]));
+ std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i]));
// The parser requires a "total n" line before accepting regular input.
lines.insert(lines.begin(), ASCIIToUTF16("total 1"));
diff --git a/net/ftp/ftp_directory_listing_parser_os2.cc b/net/ftp/ftp_directory_listing_parser_os2.cc
index 78a0d478..fd85f0d 100644
--- a/net/ftp/ftp_directory_listing_parser_os2.cc
+++ b/net/ftp/ftp_directory_listing_parser_os2.cc
@@ -16,13 +16,13 @@
namespace net {
bool ParseFtpDirectoryListingOS2(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries) {
for (size_t i = 0; i < lines.size(); i++) {
if (lines[i].empty())
continue;
- std::vector<string16> columns;
+ std::vector<base::string16> columns;
base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
// Every line of the listing consists of the following:
diff --git a/net/ftp/ftp_directory_listing_parser_os2.h b/net/ftp/ftp_directory_listing_parser_os2.h
index 89c59f0..81e6d0a 100644
--- a/net/ftp/ftp_directory_listing_parser_os2.h
+++ b/net/ftp/ftp_directory_listing_parser_os2.h
@@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry;
// Parses OS/2 FTP directory listing. Returns true on success.
NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingOS2(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries);
} // namespace net
diff --git a/net/ftp/ftp_directory_listing_parser_unittest.h b/net/ftp/ftp_directory_listing_parser_unittest.h
index dbb1678..a7c520a 100644
--- a/net/ftp/ftp_directory_listing_parser_unittest.h
+++ b/net/ftp/ftp_directory_listing_parser_unittest.h
@@ -30,8 +30,8 @@ class FtpDirectoryListingParserTest : public testing::Test {
protected:
FtpDirectoryListingParserTest() {}
- std::vector<string16> GetSingleLineTestCase(const std::string& text) {
- std::vector<string16> lines;
+ std::vector<base::string16> GetSingleLineTestCase(const std::string& text) {
+ std::vector<base::string16> lines;
lines.push_back(UTF8ToUTF16(text));
return lines;
}
diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc
index f45e3a2..e20a063 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms.cc
@@ -20,11 +20,12 @@ namespace {
// Converts the filename component in listing to the filename we can display.
// Returns true on success.
-bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename,
+bool ParseVmsFilename(const base::string16& raw_filename,
+ base::string16* parsed_filename,
FtpDirectoryListingEntry::Type* type) {
// On VMS, the files and directories are versioned. The version number is
// separated from the file name by a semicolon. Example: ANNOUNCE.TXT;2.
- std::vector<string16> listing_parts;
+ std::vector<base::string16> listing_parts;
base::SplitString(raw_filename, ';', &listing_parts);
if (listing_parts.size() != 2)
return false;
@@ -38,7 +39,7 @@ bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename,
// for directories; it's awkward for non-VMS users. Also, VMS is
// case-insensitive, but generally uses uppercase characters. This may look
// awkward, so we convert them to lower case.
- std::vector<string16> filename_parts;
+ std::vector<base::string16> filename_parts;
base::SplitString(listing_parts[0], '.', &filename_parts);
if (filename_parts.size() != 2)
return false;
@@ -52,7 +53,7 @@ bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename,
return true;
}
-bool ParseVmsFilesize(const string16& input, int64* size) {
+bool ParseVmsFilesize(const base::string16& input, int64* size) {
if (ContainsOnlyChars(input, ASCIIToUTF16("*"))) {
// Response consisting of asterisks means unknown size.
*size = -1;
@@ -71,7 +72,7 @@ bool ParseVmsFilesize(const string16& input, int64* size) {
return true;
}
- std::vector<string16> parts;
+ std::vector<base::string16> parts;
base::SplitString(input, '/', &parts);
if (parts.size() != 2)
return false;
@@ -90,14 +91,14 @@ bool ParseVmsFilesize(const string16& input, int64* size) {
return true;
}
-bool LooksLikeVmsFileProtectionListingPart(const string16& input) {
+bool LooksLikeVmsFileProtectionListingPart(const base::string16& input) {
if (input.length() > 4)
return false;
// On VMS there are four different permission bits: Read, Write, Execute,
// and Delete. They appear in that order in the permission listing.
std::string pattern("RWED");
- string16 match(input);
+ base::string16 match(input);
while (!match.empty() && !pattern.empty()) {
if (match[0] == pattern[0])
match = match.substr(1);
@@ -106,7 +107,7 @@ bool LooksLikeVmsFileProtectionListingPart(const string16& input) {
return match.empty();
}
-bool LooksLikeVmsFileProtectionListing(const string16& input) {
+bool LooksLikeVmsFileProtectionListing(const base::string16& input) {
if (input.length() < 2)
return false;
if (input[0] != '(' || input[input.length() - 1] != ')')
@@ -114,7 +115,7 @@ bool LooksLikeVmsFileProtectionListing(const string16& input) {
// We expect four parts of the file protection listing: for System, Owner,
// Group, and World.
- std::vector<string16> parts;
+ std::vector<base::string16> parts;
base::SplitString(input.substr(1, input.length() - 2), ',', &parts);
if (parts.size() != 4)
return false;
@@ -125,13 +126,13 @@ bool LooksLikeVmsFileProtectionListing(const string16& input) {
LooksLikeVmsFileProtectionListingPart(parts[3]);
}
-bool LooksLikeVmsUserIdentificationCode(const string16& input) {
+bool LooksLikeVmsUserIdentificationCode(const base::string16& input) {
if (input.length() < 2)
return false;
return input[0] == '[' && input[input.length() - 1] == ']';
}
-bool LooksLikeVMSError(const string16& text) {
+bool LooksLikeVMSError(const base::string16& text) {
static const char* kPermissionDeniedMessages[] = {
"%RMS-E-FNF", // File not found.
"%RMS-E-PRV", // Access denied.
@@ -140,21 +141,22 @@ bool LooksLikeVMSError(const string16& text) {
};
for (size_t i = 0; i < arraysize(kPermissionDeniedMessages); i++) {
- if (text.find(ASCIIToUTF16(kPermissionDeniedMessages[i])) != string16::npos)
+ if (text.find(ASCIIToUTF16(kPermissionDeniedMessages[i])) !=
+ base::string16::npos)
return true;
}
return false;
}
-bool VmsDateListingToTime(const std::vector<string16>& columns,
+bool VmsDateListingToTime(const std::vector<base::string16>& columns,
base::Time* time) {
DCHECK_EQ(4U, columns.size());
base::Time::Exploded time_exploded = { 0 };
// Date should be in format DD-MMM-YYYY.
- std::vector<string16> date_parts;
+ std::vector<base::string16> date_parts;
base::SplitString(columns[2], '-', &date_parts);
if (date_parts.size() != 3)
return false;
@@ -168,14 +170,14 @@ bool VmsDateListingToTime(const std::vector<string16>& columns,
// Time can be in format HH:MM, HH:MM:SS, or HH:MM:SS.mm. Try to recognize the
// last type first. Do not parse the seconds, they will be ignored anyway.
- string16 time_column(columns[3]);
+ base::string16 time_column(columns[3]);
if (time_column.length() == 11 && time_column[8] == '.')
time_column = time_column.substr(0, 8);
if (time_column.length() == 8 && time_column[5] == ':')
time_column = time_column.substr(0, 5);
if (time_column.length() != 5)
return false;
- std::vector<string16> time_parts;
+ std::vector<base::string16> time_parts;
base::SplitString(time_column, ':', &time_parts);
if (time_parts.size() != 2)
return false;
@@ -192,7 +194,7 @@ bool VmsDateListingToTime(const std::vector<string16>& columns,
} // namespace
bool ParseFtpDirectoryListingVms(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries) {
// The first non-empty line is the listing header. It often
// starts with "Directory ", but not always. We set a flag after
@@ -227,7 +229,7 @@ bool ParseFtpDirectoryListingVms(
continue;
}
- std::vector<string16> columns;
+ std::vector<base::string16> columns;
base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
if (columns.size() == 1) {
diff --git a/net/ftp/ftp_directory_listing_parser_vms.h b/net/ftp/ftp_directory_listing_parser_vms.h
index 6777387..3d993b5 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.h
+++ b/net/ftp/ftp_directory_listing_parser_vms.h
@@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry;
// Parses VMS FTP directory listing. Returns true on success.
NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingVms(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries);
} // namespace net
diff --git a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
index 8cdd8c7..ceea951 100644
--- a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
@@ -54,7 +54,8 @@ TEST_F(FtpDirectoryListingParserVmsTest, Good) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
good_cases[i].input));
- std::vector<string16> lines(GetSingleLineTestCase(good_cases[i].input));
+ std::vector<base::string16> lines(
+ GetSingleLineTestCase(good_cases[i].input));
// The parser requires a directory header before accepting regular input.
lines.insert(lines.begin(),
@@ -108,7 +109,7 @@ TEST_F(FtpDirectoryListingParserVmsTest, Bad) {
for (size_t i = 0; i < arraysize(bad_cases); i++) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i]));
- std::vector<string16> lines(GetSingleLineTestCase(bad_cases[i]));
+ std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i]));
// The parser requires a directory header before accepting regular input.
lines.insert(lines.begin(),
@@ -133,7 +134,7 @@ TEST_F(FtpDirectoryListingParserVmsTest, BadDataAfterFooter) {
for (size_t i = 0; i < arraysize(bad_cases); i++) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i]));
- std::vector<string16> lines(
+ std::vector<base::string16> lines(
GetSingleLineTestCase("README.TXT;4 2 18-APR-2000 10:40:39.90"));
// The parser requires a directory header before accepting regular input.
diff --git a/net/ftp/ftp_directory_listing_parser_windows.cc b/net/ftp/ftp_directory_listing_parser_windows.cc
index 333ccb1..9de6f09 100644
--- a/net/ftp/ftp_directory_listing_parser_windows.cc
+++ b/net/ftp/ftp_directory_listing_parser_windows.cc
@@ -16,13 +16,13 @@
namespace net {
bool ParseFtpDirectoryListingWindows(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries) {
for (size_t i = 0; i < lines.size(); i++) {
if (lines[i].empty())
continue;
- std::vector<string16> columns;
+ std::vector<base::string16> columns;
base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
// Every line of the listing consists of the following:
diff --git a/net/ftp/ftp_directory_listing_parser_windows.h b/net/ftp/ftp_directory_listing_parser_windows.h
index f45f433..135703d 100644
--- a/net/ftp/ftp_directory_listing_parser_windows.h
+++ b/net/ftp/ftp_directory_listing_parser_windows.h
@@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry;
// Parses Windows FTP directory listing. Returns true on success.
NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingWindows(
- const std::vector<string16>& lines,
+ const std::vector<base::string16>& lines,
std::vector<FtpDirectoryListingEntry>* entries);
} // namespace net
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 23d9f32..16adff4 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -254,8 +254,8 @@ int FtpNetworkTransaction::Start(const FtpRequestInfo* request_info,
ctrl_response_buffer_.reset(new FtpCtrlResponseBuffer(net_log_));
if (request_->url.has_username()) {
- string16 username;
- string16 password;
+ base::string16 username;
+ base::string16 password;
GetIdentityFromURL(request_->url, &username, &password);
credentials_.Set(username, password);
} else {
diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc
index 15b218a..0213584 100644
--- a/net/ftp/ftp_util.cc
+++ b/net/ftp/ftp_util.cc
@@ -135,10 +135,10 @@ class AbbreviatedMonthsMap {
// Converts abbreviated month name |text| to its number (in range 1-12).
// On success returns true and puts the number in |number|.
- bool GetMonthNumber(const string16& text, int* number) {
+ bool GetMonthNumber(const base::string16& text, int* number) {
// Ignore the case of the month names. The simplest way to handle that
// is to make everything lowercase.
- string16 text_lower(base::i18n::ToLower(text));
+ base::string16 text_lower(base::i18n::ToLower(text));
if (map_.find(text_lower) == map_.end())
return false;
@@ -172,7 +172,7 @@ class AbbreviatedMonthsMap {
format_symbols.getShortMonths(months_count);
for (int32_t month = 0; month < months_count; month++) {
- string16 month_name(months[month].getBuffer(),
+ base::string16 month_name(months[month].getBuffer(),
static_cast<size_t>(months[month].length()));
// Ignore the case of the month names. The simplest way to handle that
@@ -190,7 +190,7 @@ class AbbreviatedMonthsMap {
}
// Maps lowercase month names to numbers in range 1-12.
- std::map<string16, int> map_;
+ std::map<base::string16, int> map_;
DISALLOW_COPY_AND_ASSIGN(AbbreviatedMonthsMap);
};
@@ -198,13 +198,15 @@ class AbbreviatedMonthsMap {
} // namespace
// static
-bool FtpUtil::AbbreviatedMonthToNumber(const string16& text, int* number) {
+bool FtpUtil::AbbreviatedMonthToNumber(const base::string16& text,
+ int* number) {
return AbbreviatedMonthsMap::GetInstance()->GetMonthNumber(text, number);
}
// static
-bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day,
- const string16& rest,
+bool FtpUtil::LsDateListingToTime(const base::string16& month,
+ const base::string16& day,
+ const base::string16& rest,
const base::Time& current_time,
base::Time* result) {
base::Time::Exploded time_exploded = { 0 };
@@ -272,13 +274,13 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day,
}
// static
-bool FtpUtil::WindowsDateListingToTime(const string16& date,
- const string16& time,
+bool FtpUtil::WindowsDateListingToTime(const base::string16& date,
+ const base::string16& time,
base::Time* result) {
base::Time::Exploded time_exploded = { 0 };
// Date should be in format MM-DD-YY[YY].
- std::vector<string16> date_parts;
+ std::vector<base::string16> date_parts;
base::SplitString(date, '-', &date_parts);
if (date_parts.size() != 3)
return false;
@@ -301,7 +303,7 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date,
if (time.length() < 5)
return false;
- std::vector<string16> time_parts;
+ std::vector<base::string16> time_parts;
base::SplitString(time.substr(0, 5), ':', &time_parts);
if (time_parts.size() != 2)
return false;
@@ -315,7 +317,7 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date,
if (time.length() > 5) {
if (time.length() != 7)
return false;
- string16 am_or_pm(time.substr(5, 2));
+ base::string16 am_or_pm(time.substr(5, 2));
if (EqualsASCII(am_or_pm, "PM")) {
if (time_exploded.hour < 12)
time_exploded.hour += 12;
@@ -333,7 +335,8 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date,
}
// static
-string16 FtpUtil::GetStringPartAfterColumns(const string16& text, int columns) {
+base::string16 FtpUtil::GetStringPartAfterColumns(const base::string16& text,
+ int columns) {
base::i18n::UTF16CharIterator iter(&text);
// TODO(jshin): Is u_isspace the right function to use here?
@@ -347,7 +350,7 @@ string16 FtpUtil::GetStringPartAfterColumns(const string16& text, int columns) {
iter.Advance();
}
- string16 result(text.substr(iter.array_pos()));
+ base::string16 result(text.substr(iter.array_pos()));
TrimWhitespace(result, TRIM_ALL, &result);
return result;
}
diff --git a/net/ftp/ftp_util.h b/net/ftp/ftp_util.h
index 41e9d5a..73e609e 100644
--- a/net/ftp/ftp_util.h
+++ b/net/ftp/ftp_util.h
@@ -30,26 +30,27 @@ class NET_EXPORT_PRIVATE FtpUtil {
// Converts abbreviated month (like Nov) to its number (in range 1-12).
// Note: in some locales abbreviations are more than three letters long,
// and this function also handles them correctly.
- static bool AbbreviatedMonthToNumber(const string16& text, int* number);
+ static bool AbbreviatedMonthToNumber(const base::string16& text, int* number);
// Converts a "ls -l" date listing to time. The listing comes in three
// columns. The first one contains month, the second one contains day
// of month. The third one is either a time (and then we guess the year based
// on |current_time|), or is a year (and then we don't know the time).
- static bool LsDateListingToTime(const string16& month,
- const string16& day,
- const string16& rest,
+ static bool LsDateListingToTime(const base::string16& month,
+ const base::string16& day,
+ const base::string16& rest,
const base::Time& current_time,
base::Time* result);
// Converts a Windows date listing to time. Returns true on success.
- static bool WindowsDateListingToTime(const string16& date,
- const string16& time,
+ static bool WindowsDateListingToTime(const base::string16& date,
+ const base::string16& time,
base::Time* result);
// Skips |columns| columns from |text| (whitespace-delimited), and returns the
// remaining part, without leading/trailing whitespace.
- static string16 GetStringPartAfterColumns(const string16& text, int columns);
+ static base::string16 GetStringPartAfterColumns(const base::string16& text,
+ int columns);
};
} // namespace net