Skip to content

Commit

Permalink
Cleanup: Replace base::ASCIIToWide with base::ASCIIToUTF16.
Browse files Browse the repository at this point in the history
BUG=23581

Review URL: https://codereview.chromium.org/689063002

Cr-Commit-Position: refs/heads/master@{#303142}
  • Loading branch information
leizleiz authored and Commit bot committed Nov 7, 2014
1 parent 122c806 commit e5c64d9
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apps/launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions components/crash/app/breakpad_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions components/policy/core/common/policy_loader_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion content/browser/download/save_package_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion content/test/plugin/plugin_geturl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ipc/ipc_channel_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion media/audio/win/audio_device_listener_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AudioDeviceListenerWinTest : public testing::Test {
bool SimulateDefaultOutputDeviceChange(const char* new_device_id) {
return output_device_listener_->OnDefaultDeviceChanged(
static_cast<EDataFlow>(eConsole), static_cast<ERole>(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) {
Expand Down
4 changes: 2 additions & 2 deletions net/base/keygen_handler_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* 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<BYTE> spki;

if (!GetSubjectPublicKeyInfo(prov, &spki))
Expand All @@ -79,7 +79,7 @@ bool GetSignedPublicKeyAndChallenge(HCRYPTPROV prov,
pkac.dwVersion = CERT_KEYGEN_REQUEST_V1;
pkac.SubjectPublicKeyInfo =
*reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(&spki[0]);
pkac.pwszChallengeString = const_cast<wchar_t*>(wide_challenge.c_str());
pkac.pwszChallengeString = const_cast<base::char16*>(challenge16.c_str());

CRYPT_ALGORITHM_IDENTIFIER sig_alg;
memset(&sig_alg, 0, sizeof(sig_alg));
Expand Down
4 changes: 2 additions & 2 deletions net/cert/cert_verify_proc_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -752,7 +752,7 @@ int CertVerifyProcWin::VerifyInternal(
extra_policy_para.fdwChecks =
0x00001000; // SECURITY_FLAG_IGNORE_CERT_CN_INVALID
extra_policy_para.pwszServerName =
const_cast<wchar_t*>(wstr_hostname.c_str());
const_cast<base::char16*>(hostname16.c_str());

CERT_CHAIN_POLICY_PARA policy_para;
memset(&policy_para, 0, sizeof(policy_para));
Expand Down
4 changes: 2 additions & 2 deletions net/http/http_auth_sspi_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<wchar_t *>(spn_wide.c_str()), // pszTargetName
const_cast<base::char16*>(spn16.c_str()), // pszTargetName
context_flags, // fContextReq
0, // Reserved1 (must be 0)
SECURITY_NATIVE_DREP, // TargetDataRep
Expand Down
6 changes: 3 additions & 3 deletions net/http/url_security_manager_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ bool URLSecurityManagerWin::CanUseDefaultCredentials(
if (!const_cast<URLSecurityManagerWin*>(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<BYTE*>(&policy),
sizeof(policy), NULL, 0,
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions net/proxy/proxy_resolver_winhttp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tools/imagediff/image_diff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ui/base/clipboard/clipboard_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ HGLOBAL CreateGlobalData(const std::basic_string<charT>& str) {
::GlobalUnlock(data);
}
return data;
};
}

bool BitmapHasInvalidPremultipliedColors(const SkBitmap& bitmap) {
for (int x = 0; x < bitmap.width(); ++x) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions win8/delegate_execute/delegate_execute_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit e5c64d9

Please sign in to comment.