From e5c64d9a2cb63bce791faeed3691db80ecc127b5 Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 6 Nov 2014 17:19:24 -0800 Subject: Cleanup: Replace base::ASCIIToWide with base::ASCIIToUTF16. BUG=23581 Review URL: https://codereview.chromium.org/689063002 Cr-Commit-Position: refs/heads/master@{#303142} --- apps/launcher.cc | 2 +- components/crash/app/breakpad_win.cc | 4 ++-- components/policy/core/common/policy_loader_win_unittest.cc | 4 ++-- content/browser/download/save_package_unittest.cc | 2 +- content/test/plugin/plugin_geturl_test.cc | 2 +- ipc/ipc_channel_win.cc | 4 ++-- media/audio/win/audio_device_listener_win_unittest.cc | 2 +- net/base/keygen_handler_win.cc | 4 ++-- net/cert/cert_verify_proc_win.cc | 4 ++-- net/http/http_auth_sspi_win.cc | 4 ++-- net/http/url_security_manager_win.cc | 6 +++--- net/proxy/proxy_resolver_winhttp.cc | 8 ++++---- tools/imagediff/image_diff.cc | 2 +- ui/base/clipboard/clipboard_win.cc | 6 +++--- win8/delegate_execute/delegate_execute_util_unittest.cc | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/apps/launcher.cc b/apps/launcher.cc index f4875aa..25c3a5f 100644 --- a/apps/launcher.cc +++ b/apps/launcher.cc @@ -328,7 +328,7 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, #if defined(OS_WIN) base::CommandLine::StringType about_blank_url( - base::ASCIIToWide(url::kAboutBlankURL)); + base::ASCIIToUTF16(url::kAboutBlankURL)); #else base::CommandLine::StringType about_blank_url(url::kAboutBlankURL); #endif diff --git a/components/crash/app/breakpad_win.cc b/components/crash/app/breakpad_win.cc index 32c4891..862174c 100644 --- a/components/crash/app/breakpad_win.cc +++ b/components/crash/app/breakpad_win.cc @@ -508,7 +508,7 @@ void InitCrashReporter(const std::string& process_type_switch) { // Disable the message box for assertions. _CrtSetReportMode(_CRT_ASSERT, 0); - std::wstring process_type = base::ASCIIToWide(process_type_switch); + base::string16 process_type = base::ASCIIToUTF16(process_type_switch); if (process_type.empty()) process_type = L"browser"; @@ -555,7 +555,7 @@ void InitCrashReporter(const std::string& process_type_switch) { InitDefaultCrashCallback(default_filter); return; } - std::wstring pipe_name = base::ASCIIToWide(pipe_name_ascii); + base::string16 pipe_name = base::ASCIIToUTF16(pipe_name_ascii); #ifdef _WIN64 // The protocol for connecting to the out-of-process Breakpad crash diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc index 8c0975e..708ef66 100644 --- a/components/policy/core/common/policy_loader_win_unittest.cc +++ b/components/policy/core/common/policy_loader_win_unittest.cc @@ -155,7 +155,7 @@ class ScopedGroupPolicyRegistrySandbox { // Deletes the sandbox keys. void DeleteKeys(); - std::wstring key_name_; + base::string16 key_name_; // Keys are created for the lifetime of a test to contain // the sandboxed HKCU and HKLM hives, respectively. @@ -296,7 +296,7 @@ ScopedGroupPolicyRegistrySandbox::ScopedGroupPolicyRegistrySandbox() { // Generate a unique registry key for the override for each test. This // makes sure that tests executing in parallel won't delete each other's // key, at DeleteKeys(). - key_name_ = base::ASCIIToWide(base::StringPrintf( + key_name_ = base::ASCIIToUTF16(base::StringPrintf( "SOFTWARE\\chromium unittest %d", base::GetCurrentProcId())); std::wstring hklm_key_name = key_name_ + L"\\HKLM"; std::wstring hkcu_key_name = key_name_ + L"\\HKCU"; diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc index 0d3b31f..c0dcbf0 100644 --- a/content/browser/download/save_package_unittest.cc +++ b/content/browser/download/save_package_unittest.cc @@ -242,7 +242,7 @@ TEST_F(SavePackageTest, MAYBE_TestLongSafePureFilename) { const base::FilePath::StringType ext(FPL_HTML_EXTENSION); base::FilePath::StringType filename = #if defined(OS_WIN) - base::ASCIIToWide(long_file_name); + base::ASCIIToUTF16(long_file_name); #else long_file_name; #endif diff --git a/content/test/plugin/plugin_geturl_test.cc b/content/test/plugin/plugin_geturl_test.cc index 825c75a..ed686f2a 100644 --- a/content/test/plugin/plugin_geturl_test.cc +++ b/content/test/plugin/plugin_geturl_test.cc @@ -206,7 +206,7 @@ NPError PluginGetURLTest::NewStream(NPMIMEType type, NPStream* stream, #if defined(OS_WIN) filename = filename.substr(8); // remove "file:///" // Assume an ASCII path on Windows. - base::FilePath path = base::FilePath(base::ASCIIToWide(filename)); + base::FilePath path = base::FilePath(base::ASCIIToUTF16(filename)); #else filename = filename.substr(7); // remove "file://" base::FilePath path = base::FilePath(filename); diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 870cf53..db8c961 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -231,13 +231,13 @@ const base::string16 ChannelWin::PipeName( if (index != std::string::npos) { if (secret) // Retrieve the secret if asked for. base::StringToInt(channel_id.substr(index + 1), secret); - return base::ASCIIToWide(name.append(channel_id.substr(0, index - 1))); + return base::ASCIIToUTF16(name.append(channel_id.substr(0, index - 1))); } // This case is here to support predictable named pipes in tests. if (secret) *secret = 0; - return base::ASCIIToWide(name.append(channel_id)); + return base::ASCIIToUTF16(name.append(channel_id)); } bool ChannelWin::CreatePipe(const IPC::ChannelHandle &channel_handle, diff --git a/media/audio/win/audio_device_listener_win_unittest.cc b/media/audio/win/audio_device_listener_win_unittest.cc index 14b70a8..49a1359 100644 --- a/media/audio/win/audio_device_listener_win_unittest.cc +++ b/media/audio/win/audio_device_listener_win_unittest.cc @@ -47,7 +47,7 @@ class AudioDeviceListenerWinTest : public testing::Test { bool SimulateDefaultOutputDeviceChange(const char* new_device_id) { return output_device_listener_->OnDefaultDeviceChanged( static_cast(eConsole), static_cast(eRender), - base::ASCIIToWide(new_device_id).c_str()) == S_OK; + base::ASCIIToUTF16(new_device_id).c_str()) == S_OK; } void SetOutputDeviceId(std::string new_device_id) { diff --git a/net/base/keygen_handler_win.cc b/net/base/keygen_handler_win.cc index ffa3b2e..44365fa 100644 --- a/net/base/keygen_handler_win.cc +++ b/net/base/keygen_handler_win.cc @@ -65,7 +65,7 @@ bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector* output) { bool GetSignedPublicKeyAndChallenge(HCRYPTPROV prov, const std::string& challenge, std::string* output) { - std::wstring wide_challenge = base::ASCIIToWide(challenge); + base::string16 challenge16 = base::ASCIIToUTF16(challenge); std::vector spki; if (!GetSubjectPublicKeyInfo(prov, &spki)) @@ -79,7 +79,7 @@ bool GetSignedPublicKeyAndChallenge(HCRYPTPROV prov, pkac.dwVersion = CERT_KEYGEN_REQUEST_V1; pkac.SubjectPublicKeyInfo = *reinterpret_cast(&spki[0]); - pkac.pwszChallengeString = const_cast(wide_challenge.c_str()); + pkac.pwszChallengeString = const_cast(challenge16.c_str()); CRYPT_ALGORITHM_IDENTIFIER sig_alg; memset(&sig_alg, 0, sizeof(sig_alg)); diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc index 60e2286..13a337b 100644 --- a/net/cert/cert_verify_proc_win.cc +++ b/net/cert/cert_verify_proc_win.cc @@ -741,7 +741,7 @@ int CertVerifyProcWin::VerifyInternal( if (CertSubjectCommonNameHasNull(cert_handle)) verify_result->cert_status |= CERT_STATUS_INVALID; - std::wstring wstr_hostname = base::ASCIIToWide(hostname); + base::string16 hostname16 = base::ASCIIToUTF16(hostname); SSL_EXTRA_CERT_CHAIN_POLICY_PARA extra_policy_para; memset(&extra_policy_para, 0, sizeof(extra_policy_para)); @@ -752,7 +752,7 @@ int CertVerifyProcWin::VerifyInternal( extra_policy_para.fdwChecks = 0x00001000; // SECURITY_FLAG_IGNORE_CERT_CN_INVALID extra_policy_para.pwszServerName = - const_cast(wstr_hostname.c_str()); + const_cast(hostname16.c_str()); CERT_CHAIN_POLICY_PARA policy_para; memset(&policy_para, 0, sizeof(policy_para)); diff --git a/net/http/http_auth_sspi_win.cc b/net/http/http_auth_sspi_win.cc index 66038d1..156a55f 100644 --- a/net/http/http_auth_sspi_win.cc +++ b/net/http/http_auth_sspi_win.cc @@ -360,11 +360,11 @@ int HttpAuthSSPI::GetNextSecurityToken( // This returns a token that is passed to the remote server. DWORD context_attribute; - std::wstring spn_wide = base::ASCIIToWide(spn); + base::string16 spn16 = base::ASCIIToUTF16(spn); SECURITY_STATUS status = library_->InitializeSecurityContext( &cred_, // phCredential ctxt_ptr, // phContext - const_cast(spn_wide.c_str()), // pszTargetName + const_cast(spn16.c_str()), // pszTargetName context_flags, // fContextReq 0, // Reserved1 (must be 0) SECURITY_NATIVE_DREP, // TargetDataRep diff --git a/net/http/url_security_manager_win.cc b/net/http/url_security_manager_win.cc index 4e2d938..db5620f 100644 --- a/net/http/url_security_manager_win.cc +++ b/net/http/url_security_manager_win.cc @@ -53,10 +53,10 @@ bool URLSecurityManagerWin::CanUseDefaultCredentials( if (!const_cast(this)->EnsureSystemSecurityManager()) return false; - std::wstring url_w = base::ASCIIToWide(auth_origin.spec()); + base::string16 url16 = base::ASCIIToUTF16(auth_origin.spec()); DWORD policy = 0; HRESULT hr; - hr = security_manager_->ProcessUrlAction(url_w.c_str(), + hr = security_manager_->ProcessUrlAction(url16.c_str(), URLACTION_CREDENTIALS_USE, reinterpret_cast(&policy), sizeof(policy), NULL, 0, @@ -84,7 +84,7 @@ bool URLSecurityManagerWin::CanUseDefaultCredentials( // URLZONE_INTERNET 3 // URLZONE_UNTRUSTED 4 DWORD zone = 0; - hr = security_manager_->MapUrlToZone(url_w.c_str(), &zone, 0); + hr = security_manager_->MapUrlToZone(url16.c_str(), &zone, 0); if (FAILED(hr)) { LOG(ERROR) << "IInternetSecurityManager::MapUrlToZone failed: " << hr; return false; diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 2d90dab..755a1bf 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -54,8 +54,8 @@ int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, WINHTTP_AUTOPROXY_OPTIONS options = {0}; options.fAutoLogonIfChallenged = FALSE; options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; - std::wstring pac_url_wide = base::ASCIIToWide(pac_url_.spec()); - options.lpszAutoConfigUrl = pac_url_wide.c_str(); + base::string16 pac_url16 = base::ASCIIToUTF16(pac_url_.spec()); + options.lpszAutoConfigUrl = pac_url16.c_str(); WINHTTP_PROXY_INFO info = {0}; DCHECK(session_handle_); @@ -66,13 +66,13 @@ int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, // get good performance in the case where WinHTTP uses an out-of-process // resolver. This is important for Vista and Win2k3. BOOL ok = WinHttpGetProxyForUrl(session_handle_, - base::ASCIIToWide(query_url.spec()).c_str(), + base::ASCIIToUTF16(query_url.spec()).c_str(), &options, &info); if (!ok) { if (ERROR_WINHTTP_LOGIN_FAILURE == GetLastError()) { options.fAutoLogonIfChallenged = TRUE; ok = WinHttpGetProxyForUrl( - session_handle_, base::ASCIIToWide(query_url.spec()).c_str(), + session_handle_, base::ASCIIToUTF16(query_url.spec()).c_str(), &options, &info); } if (!ok) { diff --git a/tools/imagediff/image_diff.cc b/tools/imagediff/image_diff.cc index 936bf5d..6a9ebb9 100644 --- a/tools/imagediff/image_diff.cc +++ b/tools/imagediff/image_diff.cc @@ -397,7 +397,7 @@ int DiffImages(const base::FilePath& file1, const base::FilePath& file2, // paths as non-wide strings anyway. base::FilePath FilePathFromASCII(const std::string& str) { #if defined(OS_WIN) - return base::FilePath(base::ASCIIToWide(str)); + return base::FilePath(base::ASCIIToUTF16(str)); #else return base::FilePath(str); #endif diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index f37f077..b46aba5 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -136,7 +136,7 @@ HGLOBAL CreateGlobalData(const std::basic_string& str) { ::GlobalUnlock(data); } return data; -}; +} bool BitmapHasInvalidPremultipliedColors(const SkBitmap& bitmap) { for (int x = 0; x < bitmap.width(); ++x) { @@ -238,7 +238,7 @@ bool Clipboard::FormatType::Equals(const FormatType& other) const { Clipboard::FormatType Clipboard::GetFormatType( const std::string& format_string) { return FormatType( - ::RegisterClipboardFormat(base::ASCIIToWide(format_string).c_str())); + ::RegisterClipboardFormat(base::ASCIIToUTF16(format_string).c_str())); } // static @@ -727,7 +727,7 @@ void ClipboardWin::WriteBookmark(const char* title_data, bookmark.append(1, L'\n'); bookmark.append(url_data, url_len); - base::string16 wide_bookmark = base::UTF8ToWide(bookmark); + base::string16 wide_bookmark = base::UTF8ToUTF16(bookmark); HGLOBAL glob = CreateGlobalData(wide_bookmark); WriteToClipboard(GetUrlWFormatType().ToFormatEtc().cfFormat, glob); diff --git a/win8/delegate_execute/delegate_execute_util_unittest.cc b/win8/delegate_execute/delegate_execute_util_unittest.cc index 40a2e71..49c1776 100644 --- a/win8/delegate_execute/delegate_execute_util_unittest.cc +++ b/win8/delegate_execute/delegate_execute_util_unittest.cc @@ -29,7 +29,7 @@ TEST(DelegateExecuteUtil, CommandLineFromParametersTest) { // Parameters with a switch are parsed properly. cl = delegate_execute::CommandLineFromParameters( base::StringPrintf(L"--%ls", - base::ASCIIToWide(kSomeSwitch).c_str()).c_str()); + base::ASCIIToUTF16(kSomeSwitch).c_str()).c_str()); EXPECT_EQ(std::wstring(), cl.GetProgram().value()); EXPECT_TRUE(cl.HasSwitch(kSomeSwitch)); } @@ -62,7 +62,7 @@ TEST(DelegateExecuteUtil, MakeChromeCommandLineTest) { cl = delegate_execute::MakeChromeCommandLine( this_exe, delegate_execute::CommandLineFromParameters( base::StringPrintf(L"--%ls -- %ls", - base::ASCIIToWide(kSomeSwitch).c_str(), + base::ASCIIToUTF16(kSomeSwitch).c_str(), kOtherArgument).c_str()), base::string16(kSomeArgument)); EXPECT_EQ(5, cl.argv().size()); -- cgit v1.1