diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-26 07:07:56 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-26 07:07:56 +0000 |
commit | f729d7a55a06bb521176d8bc354c8d88b452e067 (patch) | |
tree | e51eef22ad5119f1cb54501d46216debc235300d | |
parent | 0af059171ce1156f75ff11191fe0bdebe70f1039 (diff) | |
download | chromium_src-f729d7a55a06bb521176d8bc354c8d88b452e067.zip chromium_src-f729d7a55a06bb521176d8bc354c8d88b452e067.tar.gz chromium_src-f729d7a55a06bb521176d8bc354c8d88b452e067.tar.bz2 |
Remove UTF string conversion functions from the global namespace.
BUG=330556
TEST=no change
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/102993018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242519 0039d316-1c4b-4281-b951-d872f2087c98
43 files changed, 103 insertions, 90 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index e00eee6..cf36cab 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -339,7 +339,7 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string, const CommandLine::StringType& value) { std::string switch_key(LowerASCIIOnWindows(switch_string)); #if defined(OS_WIN) - StringType combined_switch_string(ASCIIToWide(switch_key)); + StringType combined_switch_string(base::ASCIIToWide(switch_key)); #elif defined(OS_POSIX) StringType combined_switch_string(switch_string); #endif @@ -357,7 +357,7 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string, void CommandLine::AppendSwitchASCII(const std::string& switch_string, const std::string& value_string) { #if defined(OS_WIN) - AppendSwitchNative(switch_string, ASCIIToWide(value_string)); + AppendSwitchNative(switch_string, base::ASCIIToWide(value_string)); #elif defined(OS_POSIX) AppendSwitchNative(switch_string, value_string); #endif @@ -386,7 +386,7 @@ CommandLine::StringVector CommandLine::GetArgs() const { void CommandLine::AppendArg(const std::string& value) { #if defined(OS_WIN) DCHECK(IsStringUTF8(value)); - AppendArgNative(UTF8ToWide(value)); + AppendArgNative(base::UTF8ToWide(value)); #elif defined(OS_POSIX) AppendArgNative(value); #endif diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index 2c947fc..06c5006 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -198,10 +198,14 @@ TEST(CommandLineTest, GetArgumentsString) { cl.AppendArg(kFourthArgName); #if defined(OS_WIN) - CommandLine::StringType expected_first_arg(UTF8ToUTF16(kFirstArgName)); - CommandLine::StringType expected_second_arg(UTF8ToUTF16(kSecondArgName)); - CommandLine::StringType expected_third_arg(UTF8ToUTF16(kThirdArgName)); - CommandLine::StringType expected_fourth_arg(UTF8ToUTF16(kFourthArgName)); + CommandLine::StringType expected_first_arg( + base::UTF8ToUTF16(kFirstArgName)); + CommandLine::StringType expected_second_arg( + base::UTF8ToUTF16(kSecondArgName)); + CommandLine::StringType expected_third_arg( + base::UTF8ToUTF16(kThirdArgName)); + CommandLine::StringType expected_fourth_arg( + base::UTF8ToUTF16(kFourthArgName)); #elif defined(OS_POSIX) CommandLine::StringType expected_first_arg(kFirstArgName); CommandLine::StringType expected_second_arg(kSecondArgName); diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc index 9b05250..3864d22 100644 --- a/base/i18n/file_util_icu.cc +++ b/base/i18n/file_util_icu.cc @@ -145,14 +145,16 @@ bool LocaleAwareCompareFilenames(const base::FilePath& a, #if defined(OS_WIN) return base::i18n::CompareString16WithCollator(collator.get(), - WideToUTF16(a.value()), WideToUTF16(b.value())) == UCOL_LESS; + base::WideToUTF16(a.value()), base::WideToUTF16(b.value())) == UCOL_LESS; #elif defined(OS_POSIX) // On linux, the file system encoding is not defined. We assume // SysNativeMBToWide takes care of it. - return base::i18n::CompareString16WithCollator(collator.get(), - WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), - WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) == UCOL_LESS; + return base::i18n::CompareString16WithCollator( + collator.get(), + base::WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), + base::WideToUTF16(base::SysNativeMBToWide(b.value().c_str())) + ) == UCOL_LESS; #else #error Not implemented on your system #endif diff --git a/base/i18n/file_util_icu_unittest.cc b/base/i18n/file_util_icu_unittest.cc index e3af9ad..dd81226 100644 --- a/base/i18n/file_util_icu_unittest.cc +++ b/base/i18n/file_util_icu_unittest.cc @@ -73,9 +73,9 @@ TEST_F(FileUtilICUTest, ReplaceIllegalCharactersInPathTest) { file_util::ReplaceIllegalCharactersInPath(&bad_name, '-'); EXPECT_EQ(kIllegalCharacterCases[i].good_name, bad_name); #elif defined(OS_MACOSX) - std::string bad_name(WideToUTF8(kIllegalCharacterCases[i].bad_name)); + std::string bad_name(base::WideToUTF8(kIllegalCharacterCases[i].bad_name)); file_util::ReplaceIllegalCharactersInPath(&bad_name, '-'); - EXPECT_EQ(WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name); + EXPECT_EQ(base::WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name); #endif } } diff --git a/base/logging.cc b/base/logging.cc index e836092..e1305f1 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -494,7 +494,7 @@ void DisplayDebugMessageInDialog(const std::string& str) { backslash[1] = 0; wcscat_s(prog_name, MAX_PATH, L"debug_message.exe"); - std::wstring cmdline = UTF8ToWide(str); + std::wstring cmdline = base::UTF8ToWide(str); if (cmdline.empty()) return; @@ -862,5 +862,5 @@ std::wstring GetLogFileFullPath() { } // namespace logging std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { - return out << WideToUTF8(std::wstring(wstr)); + return out << base::WideToUTF8(std::wstring(wstr)); } diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc index cee124b..4b102c5 100644 --- a/base/strings/string_util.cc +++ b/base/strings/string_util.cc @@ -532,7 +532,7 @@ string16 FormatBytesUnlocalized(int64 bytes) { kByteStringsUnlocalized[dimension]); } - return ASCIIToUTF16(buf); + return base::ASCIIToUTF16(buf); } template<class StringType> diff --git a/base/strings/utf_string_conversions.h b/base/strings/utf_string_conversions.h index 3461aa4..fa245ea 100644 --- a/base/strings/utf_string_conversions.h +++ b/base/strings/utf_string_conversions.h @@ -39,19 +39,6 @@ BASE_EXPORT bool UTF16ToUTF8(const char16* src, size_t src_len, std::string* output); BASE_EXPORT std::string UTF16ToUTF8(const string16& utf16); -// We are trying to get rid of wstring as much as possible, but it's too big -// a mess to do it all at once. These conversions should be used when we -// really should just be passing a string16 around, but we haven't finished -// porting whatever module uses wstring and the conversion is being used as a -// stopcock. This makes it easy to grep for the ones that should be removed. -#if defined(OS_WIN) -# define WideToUTF16Hack -# define UTF16ToWideHack -#else -# define WideToUTF16Hack WideToUTF16 -# define UTF16ToWideHack UTF16ToWide -#endif - // These convert an ASCII string, typically a hardcoded constant, to a // UTF16/Wide string. BASE_EXPORT std::wstring ASCIIToWide(const StringPiece& ascii); @@ -59,14 +46,12 @@ BASE_EXPORT string16 ASCIIToUTF16(const StringPiece& ascii); } // namespace base -// TODO(brettw) remove these when callers are fixed up. -using base::WideToUTF8; -using base::UTF8ToWide; -using base::WideToUTF16; -using base::UTF16ToWide; -using base::UTF8ToUTF16; -using base::UTF16ToUTF8; -using base::ASCIIToWide; -using base::ASCIIToUTF16; +// We are trying to get rid of wstring as much as possible, but it's too big a +// mess to do it all at once. These synonyms should be used when we really +// should just be passing a string16 around, but we haven't finished porting +// whatever module uses wstring and the conversion is being used as a stopgap. +// This makes it easy to grep for the ones that should be removed. +#define WideToUTF16Hack WideToUTF16 +#define UTF16ToWideHack UTF16ToWide #endif // BASE_STRINGS_UTF_STRING_CONVERSIONS_H_ diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc index 3e1b9eb..1f9efd6 100644 --- a/base/test/test_file_util_posix.cc +++ b/base/test/test_file_util_posix.cc @@ -89,10 +89,10 @@ bool EvictFileFromSystemCache(const base::FilePath& file) { #endif std::wstring FilePathAsWString(const base::FilePath& path) { - return UTF8ToWide(path.value()); + return base::UTF8ToWide(path.value()); } base::FilePath WStringAsFilePath(const std::wstring& path) { - return base::FilePath(WideToUTF8(path)); + return base::FilePath(base::WideToUTF8(path)); } bool MakeFileUnreadable(const base::FilePath& path) { diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index d65f737..42a4b1e 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -972,7 +972,7 @@ void TestingAutomationProvider::GetTabTitle(int handle, NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); if (entry != NULL) { - *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string())); + *title = base::UTF16ToWideHack(entry->GetTitleForDisplay(std::string())); } else { *title = std::wstring(); } @@ -1033,8 +1033,9 @@ void TestingAutomationProvider::ExecuteJavascript( } new DomOperationMessageSender(this, reply_message, false); - ExecuteJavascriptInRenderViewFrame(WideToUTF16Hack(frame_xpath), - WideToUTF16Hack(script), reply_message, + ExecuteJavascriptInRenderViewFrame(base::WideToUTF16Hack(frame_xpath), + base::WideToUTF16Hack(script), + reply_message, web_contents->GetRenderViewHost()); } diff --git a/chrome/browser/importer/firefox_importer_browsertest.cc b/chrome/browser/importer/firefox_importer_browsertest.cc index becd7e0..d841c9b 100644 --- a/chrome/browser/importer/firefox_importer_browsertest.cc +++ b/chrome/browser/importer/firefox_importer_browsertest.cc @@ -180,7 +180,7 @@ class FirefoxObserver : public ProfileWriter, base::string16 keyword = template_urls[i]->keyword(); for (size_t j = 0; j < arraysize(kFirefoxKeywords); ++j) { if (template_urls[i]->keyword() == - WideToUTF16Hack(kFirefoxKeywords[j].keyword)) { + base::WideToUTF16Hack(kFirefoxKeywords[j].keyword)) { EXPECT_EQ(kFirefoxKeywords[j].url, template_urls[i]->url()); found = true; break; diff --git a/chrome/browser/importer/importer_unittest_utils.cc b/chrome/browser/importer/importer_unittest_utils.cc index d0ff6eb..284a6f9 100644 --- a/chrome/browser/importer/importer_unittest_utils.cc +++ b/chrome/browser/importer/importer_unittest_utils.cc @@ -10,10 +10,12 @@ void TestEqualBookmarkEntry(const ImportedBookmarkEntry& entry, const BookmarkInfo& expected) { - ASSERT_EQ(WideToUTF16Hack(expected.title), entry.title); + ASSERT_EQ(base::WideToUTF16Hack(expected.title), entry.title); ASSERT_EQ(expected.in_toolbar, entry.in_toolbar) << entry.title; ASSERT_EQ(expected.path_size, entry.path.size()) << entry.title; ASSERT_EQ(expected.url, entry.url.spec()) << entry.title; - for (size_t i = 0; i < expected.path_size; ++i) - ASSERT_EQ(WideToUTF16Hack(expected.path[i]), entry.path[i]) << entry.title; + for (size_t i = 0; i < expected.path_size; ++i) { + ASSERT_EQ(base::WideToUTF16Hack(expected.path[i]), + entry.path[i]) << entry.title; + } } diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 0908071..5714115 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -26,6 +26,7 @@ #include "ui/gfx/image/image_unittest_util.h" using base::ASCIIToUTF16; +using base::UTF8ToUTF16; using content::BrowserThread; ProfileNameVerifierObserver::ProfileNameVerifierObserver( diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc index 9509ecf..79501af 100644 --- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc @@ -29,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" using base::ASCIIToUTF16; +using base::UTF8ToUTF16; using base::Time; namespace { diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index c0dd5b6..22cf82c 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -75,7 +75,7 @@ void BookmarkChangeProcessor::UpdateSyncNodeProperties( syncer::WriteNode* dst) { // Set the properties of the item. dst->SetIsFolder(src->is_folder()); - dst->SetTitle(UTF16ToWideHack(src->GetTitle())); + dst->SetTitle(base::UTF16ToWideHack(src->GetTitle())); sync_pb::BookmarkSpecifics bookmark_specifics(dst->GetBookmarkSpecifics()); if (!src->is_folder()) bookmark_specifics.set_url(src->url().spec()); diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc index c8e7be8..79c6b64 100644 --- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc @@ -654,7 +654,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { const BookmarkNode* bnode = model_associator_->GetChromeNodeFromSyncId(sync_id); ASSERT_TRUE(bnode); - EXPECT_EQ(bnode->GetTitle(), WideToUTF16Hack(title)); + EXPECT_EQ(bnode->GetTitle(), base::WideToUTF16Hack(title)); } void ExpectBrowserNodeURL(int64 sync_id, const std::string& url) { @@ -1430,10 +1430,10 @@ void ProfileSyncServiceBookmarkTestWithData::PopulateFromTestData( if (item.url) { const base::Time add_time = start_time_ + base::TimeDelta::FromMinutes(*running_count); - model_->AddURLWithCreationTime(node, i, WideToUTF16Hack(item.title), + model_->AddURLWithCreationTime(node, i, base::WideToUTF16Hack(item.title), GURL(item.url), add_time); } else { - model_->AddFolder(node, i, WideToUTF16Hack(item.title)); + model_->AddFolder(node, i, base::WideToUTF16Hack(item.title)); } (*running_count)++; } @@ -1453,7 +1453,7 @@ void ProfileSyncServiceBookmarkTestWithData::CompareWithTestData( const TestData& item = data[i]; GURL url = GURL(item.url == NULL ? "" : item.url); BookmarkNode test_node(url); - test_node.SetTitle(WideToUTF16Hack(item.title)); + test_node.SetTitle(base::WideToUTF16Hack(item.title)); EXPECT_EQ(child_node->GetTitle(), test_node.GetTitle()); if (item.url) { EXPECT_FALSE(child_node->is_folder()); @@ -1895,7 +1895,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateDateAdded) { const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(0); ASSERT_TRUE(node); EXPECT_TRUE(node->is_url()); - EXPECT_EQ(WideToUTF16Hack(kTitle), node->GetTitle()); + EXPECT_EQ(base::WideToUTF16Hack(kTitle), node->GetTitle()); EXPECT_EQ(kUrl, node->url().possibly_invalid_spec()); EXPECT_EQ(node->date_added(), base::Time::FromInternalValue(30)); } @@ -2061,7 +2061,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateTransactionVersion) { // versions of others remain same. const BookmarkNode* changed_bookmark = model_->bookmark_bar_node()->GetChild(0); - model_->SetTitle(changed_bookmark, WideToUTF16Hack(L"test")); + model_->SetTitle(changed_bookmark, base::ASCIIToUTF16("test")); base::MessageLoop::current()->RunUntilIdle(); GetTransactionVersions(model_->root_node(), &new_versions); EXPECT_EQ(initial_versions[model_->root_node()->id()] + 2, diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 014a64b..6300ada 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -332,8 +332,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_SearchWithinSpecialURL) { FlushHistoryService(); EXPECT_EQ(1, FindInPageWchar(web_contents, - ASCIIToWide(download_url.spec()).c_str(), kFwd, - kIgnoreCase, NULL)); + base::ASCIIToWide(download_url.spec()).c_str(), + kFwd, kIgnoreCase, NULL)); } // Verify search selection coordinates. The data file used is set-up such that @@ -416,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { base::FilePath().AppendASCII("LongFind.txt")); std::string query; base::ReadFileToString(path, &query); - std::wstring search_string = UTF8ToWide(query); + std::wstring search_string = base::UTF8ToWide(query); EXPECT_EQ(1, FindInPageWchar(web_contents, search_string.c_str(), kFwd, kIgnoreCase, NULL)); @@ -479,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) { std::string query; base::ReadFileToString(path, &query); - std::wstring search_string = UTF8ToWide(query); + std::wstring search_string = base::UTF8ToWide(query); EXPECT_EQ(1, FindInPageWchar(web_contents, search_string.c_str(), false, false, NULL)); diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc index 1a9eeab..76d49bb 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc @@ -135,8 +135,9 @@ ExternalProtocolDialog::ExternalProtocolDialog(const GURL& url, base::string16 elided_url_without_scheme; base::string16 elided_command; gfx::ElideString(base::ASCIIToUTF16(url.possibly_invalid_spec()), - kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); - gfx::ElideString(WideToUTF16Hack(command), kMaxCommandSize, &elided_command); + kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); + gfx::ElideString(base::WideToUTF16Hack(command), + kMaxCommandSize, &elided_command); base::string16 message_text = l10n_util::GetStringFUTF16( IDS_EXTERNAL_PROTOCOL_INFORMATION, diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index fbe717f..7237507 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -53,6 +53,7 @@ using base::ASCIIToUTF16; using base::UTF8ToUTF16; +using base::UTF16ToUTF8; using content::BrowserThread; namespace { diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.cc b/chrome/browser/webdata/autofill_profile_syncable_service.cc index 3146b89..46aebfa 100644 --- a/chrome/browser/webdata/autofill_profile_syncable_service.cc +++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc @@ -20,6 +20,7 @@ #include "sync/protocol/sync.pb.h" using base::ASCIIToUTF16; +using base::UTF8ToUTF16; using base::UTF16ToUTF8; using autofill::AutofillCountry; using autofill::ServerFieldType; diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index 2ff6a4e..2d6ae05 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc @@ -25,6 +25,8 @@ #include "ui/events/keycodes/keyboard_codes.h" using autofill::PasswordForm; +using base::ASCIIToUTF16; +using base::UTF16ToUTF8; using blink::WebDocument; using blink::WebElement; using blink::WebFrame; diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc index e2b121a..b8627de 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc @@ -188,7 +188,8 @@ TEST_F(PhishingTermFeatureExtractorTest, ExtractFeatures) { // Chinese translation of the phrase "hello goodbye". This tests that // we can correctly separate terms in languages that don't use spaces. - page_text = UTF8ToUTF16("\xe4\xbd\xa0\xe5\xa5\xbd\xe5\x86\x8d\xe8\xa7\x81"); + page_text = + base::UTF8ToUTF16("\xe4\xbd\xa0\xe5\xa5\xbd\xe5\x86\x8d\xe8\xa7\x81"); expected_features.Clear(); expected_features.AddBooleanFeature( features::kPageTerm + std::string("\xe4\xbd\xa0\xe5\xa5\xbd")); diff --git a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc index a9d5f18..97bd32b 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc @@ -15,6 +15,7 @@ // Tests for Hunspell functionality in SpellcheckingProvider using base::ASCIIToUTF16; +using base::WideToUTF16; namespace { diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 0360360..b564552 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -60,7 +60,7 @@ int TabProxy::FindInPage(const std::wstring& search_string, return -1; AutomationMsg_Find_Params params; - params.search_string = WideToUTF16Hack(search_string); + params.search_string = base::WideToUTF16Hack(search_string); params.find_next = find_next; params.match_case = (match_case == CASE_SENSITIVE); params.forward = (forward == FWD); @@ -181,7 +181,7 @@ bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath, succeeded = value->GetAsString(&read_value); if (succeeded) { // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?) - *string_value = UTF16ToWideHack(read_value); + *string_value = base::UTF16ToWideHack(read_value); } } return succeeded; diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index e894fad..bd75d6f 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -653,7 +653,7 @@ void ChromeFrameAutomationClient::FindInPage(const std::wstring& search_string, // the SyncMessageReplyDispatcher to avoid concerns about blocking // synchronous messages. AutomationMsg_Find_Params params; - params.search_string = WideToUTF16Hack(search_string); + params.search_string = base::WideToUTF16Hack(search_string); params.find_next = find_next; params.match_case = (match_case == CASE_SENSITIVE); params.forward = (forward == FWD); diff --git a/components/autofill/core/browser/form_field_unittest.cc b/components/autofill/core/browser/form_field_unittest.cc index 2fb1a72..763d776 100644 --- a/components/autofill/core/browser/form_field_unittest.cc +++ b/components/autofill/core/browser/form_field_unittest.cc @@ -117,7 +117,7 @@ TEST(FormFieldTest, Match) { EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("\\bcon\\b"), FormField::MATCH_LABEL)); // Make sure the circumflex in 'crepe' is not treated as a word boundary. - field.label = UTF8ToUTF16("cr" "\xC3\xAA" "pe"); + field.label = base::UTF8ToUTF16("cr" "\xC3\xAA" "pe"); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("\\bcr\\b"), FormField::MATCH_LABEL)); } diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc index fb60cc9..13a3ed0 100644 --- a/components/policy/core/common/policy_loader_win_unittest.cc +++ b/components/policy/core/common/policy_loader_win_unittest.cc @@ -38,6 +38,7 @@ #include "testing/gtest/include/gtest/gtest.h" using base::UTF8ToUTF16; +using base::UTF16ToUTF8; using base::win::RegKey; namespace policy { diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 1361561..b404fa7 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -69,7 +69,7 @@ using blink::WebString; using blink::WebTextDirection; using blink::WebURLError; -namespace content { +namespace content { namespace { @@ -1067,7 +1067,7 @@ TEST_F(RenderViewImplTest, ImeComposition) { case IME_SETCOMPOSITION: view()->OnImeSetComposition( - WideToUTF16Hack(ime_message->ime_string), + base::WideToUTF16Hack(ime_message->ime_string), std::vector<blink::WebCompositionUnderline>(), ime_message->selection_start, ime_message->selection_end); @@ -1075,7 +1075,7 @@ TEST_F(RenderViewImplTest, ImeComposition) { case IME_CONFIRMCOMPOSITION: view()->OnImeConfirmComposition( - WideToUTF16Hack(ime_message->ime_string), + base::WideToUTF16Hack(ime_message->ime_string), gfx::Range::InvalidRange(), false); break; @@ -1098,7 +1098,7 @@ TEST_F(RenderViewImplTest, ImeComposition) { // Retrieve the content of this page and compare it with the expected // result. const int kMaxOutputCharacters = 128; - std::wstring output = UTF16ToWideHack( + std::wstring output = base::UTF16ToWideHack( GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(output, ime_message->result); } @@ -1147,7 +1147,7 @@ TEST_F(RenderViewImplTest, OnSetTextDirection) { // Copy the document content to std::wstring and compare with the // expected result. const int kMaxOutputCharacters = 16; - std::wstring output = UTF16ToWideHack( + std::wstring output = base::UTF16ToWideHack( GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(output, kTextDirection[i].expected_result); } @@ -1527,7 +1527,7 @@ TEST_F(RenderViewImplTest, MAYBE_InsertCharacters) { // text created from a virtual-key code, a character code, and the // modifier-key status. const int kMaxOutputCharacters = 4096; - std::wstring output = UTF16ToWideHack( + std::wstring output = base::UTF16ToWideHack( GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(kLayouts[i].expected_result, output); } @@ -1995,7 +1995,7 @@ TEST_F(RenderViewImplTest, NavigateFrame) { // Copy the document content to std::wstring and compare with the // expected result. const int kMaxOutputCharacters = 256; - std::wstring output = UTF16ToWideHack( + std::wstring output = base::UTF16ToWideHack( GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(output, L"hello \n\nworld"); } diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index b5a866c..922c5d5 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -84,7 +84,8 @@ int fdatasync(int fildes) { // Wide-char safe fopen wrapper. FILE* fopen_internal(const char* fname, const char* mode) { #if defined(OS_WIN) - return _wfopen(UTF8ToUTF16(fname).c_str(), ASCIIToUTF16(mode).c_str()); + return _wfopen(base::UTF8ToUTF16(fname).c_str(), + base::ASCIIToUTF16(mode).c_str()); #else return fopen(fname, mode); #endif @@ -92,7 +93,7 @@ FILE* fopen_internal(const char* fname, const char* mode) { base::FilePath CreateFilePath(const std::string& file_path) { #if defined(OS_WIN) - return base::FilePath(UTF8ToUTF16(file_path)); + return base::FilePath(base::UTF8ToUTF16(file_path)); #else return base::FilePath(file_path); #endif @@ -487,7 +488,7 @@ bool IsCorruption(const leveldb::Status& status) { std::string FilePathToString(const base::FilePath& file_path) { #if defined(OS_WIN) - return UTF16ToUTF8(file_path.value()); + return base::UTF16ToUTF8(file_path.value()); #else return file_path.value(); #endif diff --git a/third_party/zlib/google/zip_internal.cc b/third_party/zlib/google/zip_internal.cc index b4f54d5..a01ae8c 100644 --- a/third_party/zlib/google/zip_internal.cc +++ b/third_party/zlib/google/zip_internal.cc @@ -54,7 +54,7 @@ void* ZipOpenFunc(void *opaque, const char* filename, int mode) { creation_disposition = CREATE_ALWAYS; } - base::string16 filename16 = UTF8ToUTF16(filename); + base::string16 filename16 = base::UTF8ToUTF16(filename); if ((filename != NULL) && (desired_access != 0)) { file = CreateFile(filename16.c_str(), desired_access, share_mode, NULL, creation_disposition, flags_and_attributes, NULL); diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc index f1b9f72..8787254 100644 --- a/third_party/zlib/google/zip_reader.cc +++ b/third_party/zlib/google/zip_reader.cc @@ -39,8 +39,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, // We also consider that the file name is unsafe, if it's invalid UTF-8. base::string16 file_name_utf16; - if (!UTF8ToUTF16(file_name_in_zip.data(), file_name_in_zip.size(), - &file_name_utf16)) { + if (!base::UTF8ToUTF16(file_name_in_zip.data(), file_name_in_zip.size(), + &file_name_utf16)) { is_unsafe_ = true; } diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 09d60fc..aca7020 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -29,6 +29,7 @@ #endif using base::ASCIIToUTF16; +using base::UTF8ToUTF16; using base::WideToUTF16; namespace gfx { diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc index 455275b..d364554 100644 --- a/ui/gfx/text_elider_unittest.cc +++ b/ui/gfx/text_elider_unittest.cc @@ -19,6 +19,7 @@ using base::ASCIIToUTF16; using base::UTF16ToUTF8; +using base::UTF16ToWide; using base::UTF8ToUTF16; using base::WideToUTF16; diff --git a/ui/views/corewm/tooltip_aura_unittest.cc b/ui/views/corewm/tooltip_aura_unittest.cc index 9850c6e..d85e1a9 100644 --- a/ui/views/corewm/tooltip_aura_unittest.cc +++ b/ui/views/corewm/tooltip_aura_unittest.cc @@ -12,6 +12,7 @@ #include "ui/views/test/views_test_base.h" using base::ASCIIToUTF16; +using base::UTF8ToUTF16; namespace views { namespace corewm { diff --git a/ui/views/examples/label_example.cc b/ui/views/examples/label_example.cc index 66e238d..9b4b6e2 100644 --- a/ui/views/examples/label_example.cc +++ b/ui/views/examples/label_example.cc @@ -11,6 +11,7 @@ #include "ui/views/view.h" using base::ASCIIToUTF16; +using base::WideToUTF16; namespace views { namespace examples { diff --git a/ui/views/examples/textfield_example.cc b/ui/views/examples/textfield_example.cc index 3738fe7..4ae31f9 100644 --- a/ui/views/examples/textfield_example.cc +++ b/ui/views/examples/textfield_example.cc @@ -15,6 +15,7 @@ #include "ui/views/view.h" using base::ASCIIToUTF16; +using base::UTF16ToUTF8; namespace views { namespace examples { diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc index e1d0259..67882bf 100644 --- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc +++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc @@ -24,6 +24,7 @@ using base::ASCIIToUTF16; using base::UTF16ToUTF8; +using base::WideToUTF16; namespace { // Should match kSelectionHandlePadding in touch_selection_controller. diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 463ba0e..af3eb65 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -42,6 +42,8 @@ #include "ui/events/gestures/gesture_recognizer.h" #endif +using base::ASCIIToUTF16; + namespace { // Returns true if |ancestor| is an ancestor of |layer|. diff --git a/webkit/browser/database/database_tracker_unittest.cc b/webkit/browser/database/database_tracker_unittest.cc index bdb5b0c..d7efeb5 100644 --- a/webkit/browser/database/database_tracker_unittest.cc +++ b/webkit/browser/database/database_tracker_unittest.cc @@ -20,7 +20,7 @@ #include "webkit/browser/quota/quota_manager.h" #include "webkit/common/database/database_identifier.h" -using base::ASCIIToWide; +using base::ASCIIToUTF16; namespace { diff --git a/webkit/browser/database/database_util_unittest.cc b/webkit/browser/database/database_util_unittest.cc index f7c5d5f..6d3c08d 100644 --- a/webkit/browser/database/database_util_unittest.cc +++ b/webkit/browser/database/database_util_unittest.cc @@ -8,7 +8,7 @@ #include "webkit/browser/database/database_util.h" #include "webkit/common/database/database_identifier.h" -using base::ASCIIToWide; +using base::ASCIIToUTF16; using webkit_database::DatabaseUtil; static void TestVfsFilePath(bool expected_result, diff --git a/webkit/browser/database/databases_table_unittest.cc b/webkit/browser/database/databases_table_unittest.cc index cca7506..d1192ad 100644 --- a/webkit/browser/database/databases_table_unittest.cc +++ b/webkit/browser/database/databases_table_unittest.cc @@ -12,7 +12,7 @@ #include "third_party/sqlite/sqlite3.h" #include "webkit/browser/database/databases_table.h" -using base::ASCIIToWide; +using base::ASCIIToUTF16; namespace webkit_database { diff --git a/webkit/child/ftp_directory_listing_response_delegate.cc b/webkit/child/ftp_directory_listing_response_delegate.cc index 4b35b58..3ff37f0 100644 --- a/webkit/child/ftp_directory_listing_response_delegate.cc +++ b/webkit/child/ftp_directory_listing_response_delegate.cc @@ -48,7 +48,7 @@ base::string16 ConvertPathToUTF16(const std::string& path) { } // Use system native encoding as the last resort. - return WideToUTF16Hack(base::SysNativeMBToWide(path)); + return base::WideToUTF16Hack(base::SysNativeMBToWide(path)); } } // namespace diff --git a/webkit/common/database/database_connections_unittest.cc b/webkit/common/database/database_connections_unittest.cc index 4f9f780..ee22033 100644 --- a/webkit/common/database/database_connections_unittest.cc +++ b/webkit/common/database/database_connections_unittest.cc @@ -9,7 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/common/database/database_connections.h" -using base::ASCIIToWide; +using base::ASCIIToUTF16; namespace webkit_database { diff --git a/webkit/common/webpreferences.cc b/webkit/common/webpreferences.cc index 59f2c61..98629ef 100644 --- a/webkit/common/webpreferences.cc +++ b/webkit/common/webpreferences.cc @@ -148,19 +148,19 @@ WebPreferences::WebPreferences() #endif { standard_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Times New Roman"); + base::ASCIIToUTF16("Times New Roman"); fixed_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Courier New"); + base::ASCIIToUTF16("Courier New"); serif_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Times New Roman"); + base::ASCIIToUTF16("Times New Roman"); sans_serif_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Arial"); + base::ASCIIToUTF16("Arial"); cursive_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Script"); + base::ASCIIToUTF16("Script"); fantasy_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Impact"); + base::ASCIIToUTF16("Impact"); pictograph_font_family_map[webkit_glue::kCommonScript] = - ASCIIToUTF16("Times New Roman"); + base::ASCIIToUTF16("Times New Roman"); } WebPreferences::~WebPreferences() { |