summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-10 20:40:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-10 20:40:50 +0000
commitd6e58c6ef48f52cce6cdf781c5a507e254322425 (patch)
tree274e82d3fa22052761a146eaed25d862744633af /chrome
parent3522bda4050a25b9020d9c224e9dfc89439e2f5e (diff)
downloadchromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.zip
chromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.tar.gz
chromium_src-d6e58c6ef48f52cce6cdf781c5a507e254322425.tar.bz2
Remove the dependency on i18n/icu_string_conversions from base/string_util.h.
Fix up all files requireing this header to include it directly. Split out the ICU-dependent string util unit tests into a new file base/i18n/icu_string_util_unittest.cc TEST=none BUG=none Review URL: http://codereview.chromium.org/269034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/search_provider.cc6
-rw-r--r--chrome/browser/importer/firefox2_importer.cc21
-rw-r--r--chrome/browser/importer/mork_reader.cc9
-rw-r--r--chrome/browser/search_engines/template_url.cc14
-rw-r--r--chrome/tools/convert_dict/aff_reader.cc5
5 files changed, 31 insertions, 24 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 5c9931c..e024280 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/autocomplete/search_provider.h"
#include "app/l10n_util.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/autocomplete/keyword_provider.h"
@@ -165,8 +166,9 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
if (response_headers->GetCharset(&charset)) {
std::wstring wide_data;
// TODO(jungshik): Switch to CodePageToUTF8 after it's added.
- if (CodepageToWide(data, charset.c_str(),
- OnStringUtilConversionError::FAIL, &wide_data))
+ if (base::CodepageToWide(data, charset.c_str(),
+ base::OnStringConversionError::FAIL,
+ &wide_data))
json_data = WideToUTF8(wide_data);
}
}
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 943cb9e..c529e39 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/stl_util-inl.h"
@@ -382,8 +383,8 @@ bool Firefox2Importer::ParseFolderNameFromLine(const std::string& line,
if (end == std::string::npos || tag_end < arraysize(kFolderOpen))
return false;
- CodepageToWide(line.substr(tag_end, end - tag_end), charset.c_str(),
- OnStringUtilConversionError::SKIP, folder_name);
+ base::CodepageToWide(line.substr(tag_end, end - tag_end), charset.c_str(),
+ base::OnStringConversionError::SKIP, folder_name);
HTMLUnescape(folder_name);
std::string attribute_list = line.substr(arraysize(kFolderOpen),
@@ -442,15 +443,15 @@ bool Firefox2Importer::ParseBookmarkFromLine(const std::string& line,
return false;
// Title
- CodepageToWide(line.substr(tag_end, end - tag_end), charset.c_str(),
- OnStringUtilConversionError::SKIP, title);
+ base::CodepageToWide(line.substr(tag_end, end - tag_end), charset.c_str(),
+ base::OnStringConversionError::SKIP, title);
HTMLUnescape(title);
// URL
if (GetAttribute(attribute_list, kHrefAttribute, &value)) {
std::wstring w_url;
- CodepageToWide(value, charset.c_str(), OnStringUtilConversionError::SKIP,
- &w_url);
+ base::CodepageToWide(value, charset.c_str(),
+ base::OnStringConversionError::SKIP, &w_url);
HTMLUnescape(&w_url);
string16 url16 = WideToUTF16Hack(w_url);
@@ -464,8 +465,8 @@ bool Firefox2Importer::ParseBookmarkFromLine(const std::string& line,
// Keyword
if (GetAttribute(attribute_list, kShortcutURLAttribute, &value)) {
- CodepageToWide(value, charset.c_str(), OnStringUtilConversionError::SKIP,
- shortcut);
+ base::CodepageToWide(value, charset.c_str(),
+ base::OnStringConversionError::SKIP, shortcut);
HTMLUnescape(shortcut);
}
@@ -479,8 +480,8 @@ bool Firefox2Importer::ParseBookmarkFromLine(const std::string& line,
// Post data.
if (GetAttribute(attribute_list, kPostDataAttribute, &value)) {
- CodepageToWide(value, charset.c_str(),
- OnStringUtilConversionError::SKIP, post_data);
+ base::CodepageToWide(value, charset.c_str(),
+ base::OnStringConversionError::SKIP, post_data);
HTMLUnescape(post_data);
}
diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc
index c8b24a4..66ff12b 100644
--- a/chrome/browser/importer/mork_reader.cc
+++ b/chrome/browser/importer/mork_reader.cc
@@ -45,6 +45,7 @@
#include <algorithm>
#include "base/file_path.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
@@ -518,11 +519,11 @@ void AddToHistory(MorkReader::ColumnDataList* column_values,
// title is really a UTF-16 string at this point
std::wstring title;
if (data.swap_bytes) {
- CodepageToWide(values[kNameColumn], "UTF-16BE",
- OnStringUtilConversionError::SKIP, &title);
+ base::CodepageToWide(values[kNameColumn], base::kCodepageUTF16BE,
+ base::OnStringConversionError::SKIP, &title);
} else {
- CodepageToWide(values[kNameColumn], "UTF-16LE",
- OnStringUtilConversionError::SKIP, &title);
+ base::CodepageToWide(values[kNameColumn], base::kCodepageUTF16LE,
+ base::OnStringConversionError::SKIP, &title);
}
row.set_title(title);
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index 7c57617..3febf96 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -6,6 +6,7 @@
#include "app/gfx/favicon_size.h"
#include "app/l10n_util.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
@@ -318,8 +319,9 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
case GOOGLE_UNESCAPED_SEARCH_TERMS: {
std::string unescaped_terms;
- WideToCodepage(terms, WideToASCII(input_encoding).c_str(),
- OnStringUtilConversionError::SKIP, &unescaped_terms);
+ base::WideToCodepage(terms, WideToASCII(input_encoding).c_str(),
+ base::OnStringConversionError::SKIP,
+ &unescaped_terms);
url.insert(i->index, std::wstring(unescaped_terms.begin(),
unescaped_terms.end()));
break;
@@ -411,14 +413,14 @@ std::wstring TemplateURLRef::SearchTermToWide(const TemplateURL& host,
UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE |
UnescapeRule::URL_SPECIAL_CHARS);
for (size_t i = 0; i < encodings.size(); ++i) {
- if (CodepageToWide(unescaped, encodings[i].c_str(),
- OnStringUtilConversionError::FAIL, &result))
+ if (base::CodepageToWide(unescaped, encodings[i].c_str(),
+ base::OnStringConversionError::FAIL, &result))
return result;
}
// Always fall back on UTF-8 if it works.
- if (CodepageToWide(unescaped, "UTF-8",
- OnStringUtilConversionError::FAIL, &result))
+ if (base::CodepageToWide(unescaped, base::kCodepageUTF8,
+ base::OnStringConversionError::FAIL, &result))
return result;
// When nothing worked, just use the escaped text. We have no idea what the
diff --git a/chrome/tools/convert_dict/aff_reader.cc b/chrome/tools/convert_dict/aff_reader.cc
index 2ea8301..33fa522 100644
--- a/chrome/tools/convert_dict/aff_reader.cc
+++ b/chrome/tools/convert_dict/aff_reader.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/file_util.h"
+#include "base/i18n/icu_string_conversions.h"
#include "base/string_util.h"
#include "chrome/tools/convert_dict/hunspell_reader.h"
@@ -133,8 +134,8 @@ bool AffReader::Read() {
bool AffReader::EncodingToUTF8(const std::string& encoded,
std::string* utf8) const {
std::wstring wide_word;
- if (!CodepageToWide(encoded, encoding(),
- OnStringUtilConversionError::FAIL, &wide_word))
+ if (!base::CodepageToWide(encoded, encoding(),
+ base::OnStringConversionError::FAIL, &wide_word))
return false;
*utf8 = WideToUTF8(wide_word);
return true;