summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:32:30 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:32:30 +0000
commit400b133f204e817bb87e357cf2cb02056f8eb0a4 (patch)
tree7e7165352b123dc93482562e04c37131f84ae3f8 /net/base
parent3705f8e68cb154810dba9f9e05b3f9fb2a9155b5 (diff)
downloadchromium_src-400b133f204e817bb87e357cf2cb02056f8eb0a4.zip
chromium_src-400b133f204e817bb87e357cf2cb02056f8eb0a4.tar.gz
chromium_src-400b133f204e817bb87e357cf2cb02056f8eb0a4.tar.bz2
Remove wstring from TemplateURL and friends.
Re-landing r71485 (which was reverted in r71500). BUG=23581 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6278007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/escape.cc8
-rw-r--r--net/base/escape.h6
-rw-r--r--net/base/escape_unittest.cc14
3 files changed, 14 insertions, 14 deletions
diff --git a/net/base/escape.cc b/net/base/escape.cc
index 5479b82..ae8411b 100644
--- a/net/base/escape.cc
+++ b/net/base/escape.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -192,9 +192,9 @@ std::string EscapeQueryParamValue(const std::string& text, bool use_plus) {
// Convert the string to a sequence of bytes and then % escape anything
// except alphanumerics and !'()*-._~
-std::wstring EscapeQueryParamValueUTF8(const std::wstring& text,
- bool use_plus) {
- return UTF8ToWide(Escape(WideToUTF8(text), kQueryCharmap, use_plus));
+string16 EscapeQueryParamValueUTF8(const string16& text,
+ bool use_plus) {
+ return UTF8ToUTF16(Escape(UTF16ToUTF8(text), kQueryCharmap, use_plus));
}
// non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|}
diff --git a/net/base/escape.h b/net/base/escape.h
index 39447a5..faa7bd3 100644
--- a/net/base/escape.h
+++ b/net/base/escape.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -125,8 +125,8 @@ std::string EscapeQueryParamValue(const std::string& text, bool use_plus);
bool EscapeQueryParamValue(const string16& text, const char* codepage,
bool use_plus, string16* escaped);
-// A specialized version of EscapeQueryParamValue for wide strings that
+// A specialized version of EscapeQueryParamValue for string16s that
// assumes the codepage is UTF8. This is provided as a convenience.
-std::wstring EscapeQueryParamValueUTF8(const std::wstring& text, bool use_plus);
+string16 EscapeQueryParamValueUTF8(const string16& text, bool use_plus);
#endif // NET_BASE_ESCAPE_H_
diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc
index 04a040e..60d4ae3 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -66,7 +66,8 @@ TEST(EscapeTest, EscapeTextForFormSubmission) {
};
for (size_t i = 0; i < arraysize(escape_cases); ++i) {
EscapeCase value = escape_cases[i];
- EXPECT_EQ(value.output, EscapeQueryParamValueUTF8(value.input, true));
+ EXPECT_EQ(WideToUTF16Hack(value.output),
+ EscapeQueryParamValueUTF8(WideToUTF16Hack(value.input), true));
}
const EscapeCase escape_cases_no_plus[] = {
@@ -76,7 +77,8 @@ TEST(EscapeTest, EscapeTextForFormSubmission) {
};
for (size_t i = 0; i < arraysize(escape_cases_no_plus); ++i) {
EscapeCase value = escape_cases_no_plus[i];
- EXPECT_EQ(value.output, EscapeQueryParamValueUTF8(value.input, false));
+ EXPECT_EQ(WideToUTF16Hack(value.output),
+ EscapeQueryParamValueUTF8(WideToUTF16Hack(value.input), false));
}
// Test all the values in we're supposed to be escaping.
@@ -114,12 +116,10 @@ TEST(EscapeTest, EscapeTextForFormSubmission) {
string16 wide;
EXPECT_TRUE(EscapeQueryParamValue(test_str, base::kCodepageUTF8, true,
&wide));
- EXPECT_EQ(UTF16ToWideHack(wide),
- EscapeQueryParamValueUTF8(UTF16ToWideHack(test_str), true));
+ EXPECT_EQ(wide, EscapeQueryParamValueUTF8(test_str, true));
EXPECT_TRUE(EscapeQueryParamValue(test_str, base::kCodepageUTF8, false,
&wide));
- EXPECT_EQ(UTF16ToWideHack(wide),
- EscapeQueryParamValueUTF8(UTF16ToWideHack(test_str), false));
+ EXPECT_EQ(wide, EscapeQueryParamValueUTF8(test_str, false));
}
TEST(EscapeTest, EscapePath) {