summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/base/escape.cc9
-rw-r--r--net/base/escape_unittest.cc5
-rw-r--r--net/base/net_util.cc11
-rw-r--r--net/proxy/proxy_script_fetcher.cc10
4 files changed, 21 insertions, 14 deletions
diff --git a/net/base/escape.cc b/net/base/escape.cc
index 615f062..3d2aca2 100644
--- a/net/base/escape.cc
+++ b/net/base/escape.cc
@@ -6,6 +6,7 @@
#include "net/base/escape.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
#include "base/string_util.h"
@@ -220,8 +221,8 @@ bool EscapeQueryParamValue(const std::wstring& text, const char* codepage,
// TODO(brettw) bug 1201094: this function should be removed, this "SKIP"
// behavior is wrong when the character can't be encoded properly.
std::string encoded;
- if (!WideToCodepage(text, codepage,
- OnStringUtilConversionError::SKIP, &encoded))
+ if (!base::WideToCodepage(text, codepage,
+ base::OnStringConversionError::SKIP, &encoded))
return false;
// It's safe to use UTF8ToWide here because Escape should only return
@@ -234,8 +235,8 @@ std::wstring UnescapeAndDecodeURLComponent(const std::string& text,
const char* codepage,
UnescapeRule::Type rules) {
std::wstring result;
- if (CodepageToWide(UnescapeURLImpl(text, rules), codepage,
- OnStringUtilConversionError::FAIL, &result))
+ if (base::CodepageToWide(UnescapeURLImpl(text, rules), codepage,
+ base::OnStringConversionError::FAIL, &result))
return result; // Character set looks like it's valid.
return UTF8ToWide(text); // Return the escaped version when it's not.
}
diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc
index 3a9ed70..44bb9972 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -7,6 +7,7 @@
#include "net/base/escape.h"
#include "base/basictypes.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,7 +43,7 @@ struct EscapeForHTMLCase {
const char* expected_output;
};
-}
+} // namespace
TEST(Escape, EscapeTextForFormSubmission) {
const EscapeCase escape_cases[] = {
@@ -88,7 +89,7 @@ TEST(Escape, EscapeTextForFormSubmission) {
test_str.push_back(i);
}
std::wstring wide;
- EXPECT_TRUE(EscapeQueryParamValue(test_str, kCodepageUTF8, &wide));
+ EXPECT_TRUE(EscapeQueryParamValue(test_str, base::kCodepageUTF8, &wide));
EXPECT_EQ(wide, EscapeQueryParamValueUTF8(test_str));
}
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index fc2fa84..1d7d558 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -30,6 +30,8 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/file_util_icu.h"
+#include "base/i18n/icu_string_conversions.h"
+#include "base/i18n/time_formatting.h"
#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
@@ -42,7 +44,7 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/time.h"
-#include "base/i18n/time_formatting.h"
+#include "base/utf_string_conversions.h"
#include "grit/net_resources.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
@@ -264,8 +266,9 @@ bool DecodeWord(const std::string& encoded_word,
} else {
std::wstring wide_output;
if (!referrer_charset.empty() &&
- CodepageToWide(encoded_word, referrer_charset.c_str(),
- OnStringUtilConversionError::FAIL, &wide_output)) {
+ base::CodepageToWide(encoded_word, referrer_charset.c_str(),
+ base::OnStringConversionError::FAIL,
+ &wide_output)) {
*output = WideToUTF8(wide_output);
} else {
*output = WideToUTF8(base::SysNativeMBToWide(encoded_word));
diff --git a/net/proxy/proxy_script_fetcher.cc b/net/proxy/proxy_script_fetcher.cc
index 83189ef..882c406 100644
--- a/net/proxy/proxy_script_fetcher.cc
+++ b/net/proxy/proxy_script_fetcher.cc
@@ -5,10 +5,12 @@
#include "net/proxy/proxy_script_fetcher.h"
#include "base/compiler_specific.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -50,7 +52,7 @@ void ConvertResponseToUTF8(const std::string& charset, std::string* bytes) {
if (charset.empty()) {
// Assume ISO-8859-1 if no charset was specified.
- codepage = "ISO-8859-1";
+ codepage = base::kCodepageLatin1;
} else {
// Otherwise trust the charset that was provided.
codepage = charset.c_str();
@@ -60,9 +62,9 @@ void ConvertResponseToUTF8(const std::string& charset, std::string* bytes) {
// outside of |charset| (i.e. invalid), then substitute them with
// U+FFFD rather than failing.
std::wstring tmp_wide;
- CodepageToWide(*bytes, codepage,
- OnStringUtilConversionError::SUBSTITUTE,
- &tmp_wide);
+ base::CodepageToWide(*bytes, codepage,
+ base::OnStringConversionError::SUBSTITUTE,
+ &tmp_wide);
// TODO(eroman): would be nice to have a CodepageToUTF8() function.
*bytes = WideToUTF8(tmp_wide);
}