diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-24 21:14:53 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-24 21:14:53 +0000 |
commit | 47e870bf26f0c01dafe611ec03c0139c735063df (patch) | |
tree | 43b29b36654d896cf3fd1bd3cc27b830c63522b0 /chrome/common | |
parent | 883844f40f19b80880e0730a8e2836e6383d1400 (diff) | |
download | chromium_src-47e870bf26f0c01dafe611ec03c0139c735063df.zip chromium_src-47e870bf26f0c01dafe611ec03c0139c735063df.tar.gz chromium_src-47e870bf26f0c01dafe611ec03c0139c735063df.tar.bz2 |
Revert 184352
> Add utf_string_conversions to base namespace.
>
> This adds "using"s for all functions so those can be fixed in a separate pass.
>
> This converts the "Wide" versions of the functions in the Chrome directory as a first pass on the changeover.
>
> BUG=
>
> Review URL: https://codereview.chromium.org/12314090
TBR=brettw@chromium.org
Review URL: https://codereview.chromium.org/12315071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/child_process_logging_mac.mm | 2 | ||||
-rw-r--r-- | chrome/common/child_process_logging_posix.cc | 2 | ||||
-rw-r--r-- | chrome/common/child_process_logging_win.cc | 10 | ||||
-rw-r--r-- | chrome/common/extensions/extension.cc | 16 | ||||
-rw-r--r-- | chrome/common/extensions/extension_file_util.cc | 2 | ||||
-rw-r--r-- | chrome/common/extensions/extension_file_util_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/common/json_value_serializer_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/logging_chrome.cc | 4 | ||||
-rw-r--r-- | chrome/common/service_process_util.cc | 2 | ||||
-rw-r--r-- | chrome/common/service_process_util_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/service_process_util_win.cc | 18 |
12 files changed, 32 insertions, 36 deletions
diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index 7dd5380..39c05cd 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -95,7 +95,7 @@ void SetClientId(const std::string& client_id) { base::strlcpy(g_client_id, str.c_str(), kClientIdSize); SetClientIdImpl(str, SetCrashKeyValue); - std::wstring wstr = base::ASCIIToWide(str); + std::wstring wstr = ASCIIToWide(str); GoogleUpdateSettings::SetMetricsId(wstr); } diff --git a/chrome/common/child_process_logging_posix.cc b/chrome/common/child_process_logging_posix.cc index 03ae371..39544b0 100644 --- a/chrome/common/child_process_logging_posix.cc +++ b/chrome/common/child_process_logging_posix.cc @@ -72,7 +72,7 @@ void SetClientId(const std::string& client_id) { return; base::strlcpy(g_client_id, str.c_str(), kClientIdSize); - std::wstring wstr = base::ASCIIToWide(str); + std::wstring wstr = ASCIIToWide(str); GoogleUpdateSettings::SetMetricsId(wstr); } diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 0832676..4d7ab12 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -80,7 +80,7 @@ void SetActiveURL(const GURL& url) { return; } - (set_active_url)(base::UTF8ToWide(url.possibly_invalid_spec()).c_str()); + (set_active_url)(UTF8ToWide(url.possibly_invalid_spec()).c_str()); } void SetClientId(const std::string& client_id) { @@ -91,7 +91,7 @@ void SetClientId(const std::string& client_id) { if (str.empty()) return; - std::wstring wstr = base::ASCIIToWide(str); + std::wstring wstr = ASCIIToWide(str); std::wstring old_wstr; if (!GoogleUpdateSettings::GetMetricsId(&old_wstr) || wstr != old_wstr) @@ -114,7 +114,7 @@ void SetClientId(const std::string& client_id) { std::string GetClientId() { std::wstring wstr_client_id; if (GoogleUpdateSettings::GetMetricsId(&wstr_client_id)) - return base::WideToASCII(wstr_client_id); + return WideToASCII(wstr_client_id); else return std::string(); } @@ -149,7 +149,7 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) { std::set<std::string>::const_iterator iter = extension_ids.begin(); for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) { if (iter != extension_ids.end()) { - (set_extension_id)(i, base::ASCIIToWide(iter->c_str()).c_str()); + (set_extension_id)(i, ASCIIToWide(iter->c_str()).c_str()); ++iter; } else { (set_extension_id)(i, L""); @@ -189,7 +189,7 @@ void SetPrinterInfo(const char* printer_info) { if (!set_printer_info) return; } - (set_printer_info)(base::UTF8ToWide(printer_info).c_str()); + (set_printer_info)(UTF8ToWide(printer_info).c_str()); } void SetCommandLine(const CommandLine* command_line) { diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index a3fa24b..b8f18f7 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -387,7 +387,7 @@ ExtensionResource Extension::GetResource( #if defined(OS_POSIX) base::FilePath relative_file_path(new_path); #elif defined(OS_WIN) - base::FilePath relative_file_path(base::UTF8ToWide(new_path)); + base::FilePath relative_file_path(UTF8ToWide(new_path)); #endif ExtensionResource r(id(), path(), relative_file_path); if ((creation_flags() & Extension::FOLLOW_SYMLINKS_ANYWHERE)) { @@ -790,14 +790,14 @@ bool Extension::ShowConfigureContextMenus() const { std::set<base::FilePath> Extension::GetBrowserImages() const { std::set<base::FilePath> image_paths; - // TODO(viettrungluu): These |FilePath::FromWStringHack(base::UTF8ToWide())| + // TODO(viettrungluu): These |FilePath::FromWStringHack(UTF8ToWide())| // indicate that we're doing something wrong. // Extension icons. for (ExtensionIconSet::IconMap::const_iterator iter = icons().map().begin(); iter != icons().map().end(); ++iter) { image_paths.insert( - base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); + base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); } // Theme images. @@ -806,10 +806,8 @@ std::set<base::FilePath> Extension::GetBrowserImages() const { for (DictionaryValue::Iterator it(*theme_images); !it.IsAtEnd(); it.Advance()) { std::string val; - if (it.value().GetAsString(&val)) { - image_paths.insert(base::FilePath::FromWStringHack( - base::UTF8ToWide(val))); - } + if (it.value().GetAsString(&val)) + image_paths.insert(base::FilePath::FromWStringHack(UTF8ToWide(val))); } } @@ -820,7 +818,7 @@ std::set<base::FilePath> Extension::GetBrowserImages() const { iter != page_action_info->default_icon.map().end(); ++iter) { image_paths.insert( - base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); + base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); } } @@ -831,7 +829,7 @@ std::set<base::FilePath> Extension::GetBrowserImages() const { iter != browser_action->default_icon.map().end(); ++iter) { image_paths.insert( - base::FilePath::FromWStringHack(base::UTF8ToWide(iter->second))); + base::FilePath::FromWStringHack(UTF8ToWide(iter->second))); } } diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 589c8a2..0a3a36b 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -707,7 +707,7 @@ base::FilePath ExtensionURLToRelativeFilePath(const GURL& url) { #if defined(OS_POSIX) base::FilePath(file_path); #elif defined(OS_WIN) - base::FilePath(base::UTF8ToWide(file_path)); + base::FilePath(UTF8ToWide(file_path)); #else base::FilePath(); NOTIMPLEMENTED(); diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index 231dfd76..dc3fd3b 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -300,7 +300,7 @@ TEST_F(ExtensionFileUtilTest, ExtensionURLToRelativeFilePath) { base::FilePath expected_path(test_cases[i].expected_relative_path); #elif defined(OS_WIN) base::FilePath expected_path( - base::UTF8ToWide(test_cases[i].expected_relative_path)); + UTF8ToWide(test_cases[i].expected_relative_path)); #endif base::FilePath actual_path = diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc index 347a899..656dd0f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc @@ -164,7 +164,7 @@ TEST_F(InitValueManifestTest, InitFromValueValidNameInRTL) { // Strong RTL characters in name. extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); - localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); + localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); base::i18n::AdjustStringForLocaleDirection(&localized_name); EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc index 39e2359..46f45ab 100644 --- a/chrome/common/json_value_serializer_unittest.cc +++ b/chrome/common/json_value_serializer_unittest.cc @@ -122,7 +122,7 @@ TEST(JSONValueSerializerTest, StringEscape) { TEST(JSONValueSerializerTest, UnicodeStrings) { // unicode string json -> escaped ascii text DictionaryValue root; - string16 test(base::WideToUTF16(L"\x7F51\x9875")); + string16 test(WideToUTF16(L"\x7F51\x9875")); root.SetString("web", test); std::string expected = "{\"web\":\"\\u7F51\\u9875\"}"; @@ -146,7 +146,7 @@ TEST(JSONValueSerializerTest, UnicodeStrings) { TEST(JSONValueSerializerTest, HexStrings) { // hex string json -> escaped ascii text DictionaryValue root; - string16 test(base::WideToUTF16(L"\x01\x02")); + string16 test(WideToUTF16(L"\x01\x02")); root.SetString("test", test); std::string expected = "{\"test\":\"\\u0001\\u0002\"}"; diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index fbfdfc9..896cc7b 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -383,7 +383,7 @@ base::FilePath GetLogFileName() { scoped_ptr<base::Environment> env(base::Environment::Create()); if (env->GetVar(env_vars::kLogFileName, &filename) && !filename.empty()) { #if defined(OS_WIN) - return base::FilePath(base::UTF8ToWide(filename)); + return base::FilePath(UTF8ToWide(filename)); #elif defined(OS_POSIX) return base::FilePath(filename); #endif @@ -422,7 +422,7 @@ size_t GetFatalAssertions(AssertionList* assertions) { while (!log_file.eof()) { getline(log_file, utf8_line); if (utf8_line.find(":FATAL:") != std::string::npos) { - wide_line = base::UTF8ToWide(utf8_line); + wide_line = UTF8ToWide(utf8_line); if (assertions) assertions->push_back(wide_line); ++assertion_count; diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc index 0a33e38..bed0614 100644 --- a/chrome/common/service_process_util.cc +++ b/chrome/common/service_process_util.cc @@ -107,7 +107,7 @@ std::string GetServiceProcessScopedName(const std::string& append_str) { base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); #if defined(OS_WIN) - std::string user_data_dir_path = base::WideToUTF8(user_data_dir.value()); + std::string user_data_dir_path = WideToUTF8(user_data_dir.value()); #elif defined(OS_POSIX) std::string user_data_dir_path = user_data_dir.value(); #endif // defined(OS_WIN) diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 0ead384..8322c5d 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -125,7 +125,7 @@ TEST_F(ServiceProcessStateTest, AutoRun) { std::string value_name = GetServiceProcessScopedName("_service_run"); string16 value; EXPECT_TRUE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER, - base::UTF8ToWide(value_name), + UTF8ToWide(value_name), &value)); autorun_command_line.reset(new CommandLine(CommandLine::FromString(value))); #elif defined(OS_POSIX) && !defined(OS_MACOSX) @@ -155,7 +155,7 @@ TEST_F(ServiceProcessStateTest, AutoRun) { ASSERT_TRUE(state.RemoveFromAutoRun()); #if defined(OS_WIN) EXPECT_FALSE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER, - base::UTF8ToWide(value_name), + UTF8ToWide(value_name), &value)); #elif defined(OS_POSIX) && !defined(OS_MACOSX) EXPECT_FALSE(AutoStart::GetAutostartFileValue( diff --git a/chrome/common/service_process_util_win.cc b/chrome/common/service_process_util_win.cc index 486740b..dfa2fc4 100644 --- a/chrome/common/service_process_util_win.cc +++ b/chrome/common/service_process_util_win.cc @@ -23,12 +23,12 @@ namespace { const char* kTerminateEventSuffix = "_service_terminate_evt"; string16 GetServiceProcessReadyEventName() { - return base::UTF8ToWide( + return UTF8ToWide( GetServiceProcessScopedVersionedName("_service_ready")); } string16 GetServiceProcessTerminateEventName() { - return base::UTF8ToWide( + return UTF8ToWide( GetServiceProcessScopedVersionedName(kTerminateEventSuffix)); } @@ -41,7 +41,7 @@ std::string GetServiceProcessAutoRunKey() { std::string GetObsoleteServiceProcessAutoRunKey() { base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); - std::string scoped_name = base::WideToUTF8(user_data_dir.value()); + std::string scoped_name = WideToUTF8(user_data_dir.value()); std::replace(scoped_name.begin(), scoped_name.end(), '\\', '!'); std::replace(scoped_name.begin(), scoped_name.end(), '/', '!'); scoped_name.append("_service_run"); @@ -88,7 +88,7 @@ bool ForceServiceProcessShutdown(const std::string& version, std::string versioned_name = version; versioned_name.append(kTerminateEventSuffix); string16 event_name = - base::UTF8ToWide(GetServiceProcessScopedName(versioned_name)); + UTF8ToWide(GetServiceProcessScopedName(versioned_name)); terminate_event.Set(OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name.c_str())); if (!terminate_event.IsValid()) return false; @@ -153,11 +153,10 @@ bool ServiceProcessState::AddToAutoRun() { // Remove the old autorun value first because we changed the naming scheme // for the autorun value name. base::win::RemoveCommandFromAutoRun( - HKEY_CURRENT_USER, - base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); + HKEY_CURRENT_USER, UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); return base::win::AddCommandToAutoRun( HKEY_CURRENT_USER, - base::UTF8ToWide(GetServiceProcessAutoRunKey()), + UTF8ToWide(GetServiceProcessAutoRunKey()), autorun_command_line_->GetCommandLineString()); } @@ -165,10 +164,9 @@ bool ServiceProcessState::RemoveFromAutoRun() { // Remove the old autorun value first because we changed the naming scheme // for the autorun value name. base::win::RemoveCommandFromAutoRun( - HKEY_CURRENT_USER, - base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); + HKEY_CURRENT_USER, UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); return base::win::RemoveCommandFromAutoRun( - HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); + HKEY_CURRENT_USER, UTF8ToWide(GetServiceProcessAutoRunKey())); } void ServiceProcessState::TearDownState() { |