Commit 299e3d00 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Get rid of unneeded base::UTF16ToWide() conversions.

It's a no-op in Windows-only code.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274435 0039d316-1c4b-4281-b951-d872f2087c98
parent 4b0cc731
...@@ -283,15 +283,15 @@ IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) { ...@@ -283,15 +283,15 @@ IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) {
EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale()); EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage()); EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage());
EXPECT_FALSE(base::i18n::IsRTL()); EXPECT_FALSE(base::i18n::IsRTL());
const std::wstring en_str = const base::string16 en_str =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE);
RunSwitchLanguageTest("fr", "fr", true); RunSwitchLanguageTest("fr", "fr", true);
EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); EXPECT_EQ("fr", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage()); EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage());
EXPECT_FALSE(base::i18n::IsRTL()); EXPECT_FALSE(base::i18n::IsRTL());
const std::wstring fr_str = const base::string16 fr_str =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE);
EXPECT_NE(en_str, fr_str); EXPECT_NE(en_str, fr_str);
...@@ -299,8 +299,8 @@ IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) { ...@@ -299,8 +299,8 @@ IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) {
EXPECT_EQ("ar", g_browser_process->GetApplicationLocale()); EXPECT_EQ("ar", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage()); EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage());
EXPECT_TRUE(base::i18n::IsRTL()); EXPECT_TRUE(base::i18n::IsRTL());
const std::wstring ar_str = const base::string16 ar_str =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE);
EXPECT_NE(fr_str, ar_str); EXPECT_NE(fr_str, ar_str);
} }
...@@ -940,7 +940,6 @@ IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest, ...@@ -940,7 +940,6 @@ IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest,
IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest, IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest,
ControlFlowEnrollmentBack) { ControlFlowEnrollmentBack) {
EXPECT_CALL(*mock_enrollment_screen_->actor(), EXPECT_CALL(*mock_enrollment_screen_->actor(),
SetParameters(mock_enrollment_screen_, SetParameters(mock_enrollment_screen_,
EnrollmentScreenActor::ENROLLMENT_MODE_FORCED, EnrollmentScreenActor::ENROLLMENT_MODE_FORCED,
......
...@@ -95,8 +95,7 @@ bool UpdateTaskCategory(JumpListUpdater* jumplist_updater) { ...@@ -95,8 +95,7 @@ bool UpdateTaskCategory(JumpListUpdater* jumplist_updater) {
// We remove '&' characters from this string so we can share it with our // We remove '&' characters from this string so we can share it with our
// system menu. // system menu.
scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); scoped_refptr<ShellLinkItem> chrome = CreateShellLink();
std::wstring chrome_title = base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW);
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_WINDOW));
ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L""); ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L"");
chrome->set_title(chrome_title); chrome->set_title(chrome_title);
chrome->set_icon(chrome_path.value(), 0); chrome->set_icon(chrome_path.value(), 0);
...@@ -107,8 +106,8 @@ bool UpdateTaskCategory(JumpListUpdater* jumplist_updater) { ...@@ -107,8 +106,8 @@ bool UpdateTaskCategory(JumpListUpdater* jumplist_updater) {
// this item. // this item.
scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); scoped_refptr<ShellLinkItem> incognito = CreateShellLink();
incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); incognito->GetCommandLine()->AppendSwitch(switches::kIncognito);
std::wstring incognito_title = base::string16 incognito_title =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW)); l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW);
ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L""); ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L"");
incognito->set_title(incognito_title); incognito->set_title(incognito_title);
incognito->set_icon(chrome_path.value(), 0); incognito->set_icon(chrome_path.value(), 0);
......
...@@ -38,8 +38,8 @@ enum { ...@@ -38,8 +38,8 @@ enum {
MemoryDetails::MemoryDetails() MemoryDetails::MemoryDetails()
: user_metrics_mode_(UPDATE_USER_METRICS) { : user_metrics_mode_(UPDATE_USER_METRICS) {
static const std::wstring google_browser_name = static const base::string16 google_browser_name =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
struct { struct {
const wchar_t* name; const wchar_t* name;
const wchar_t* process_name; const wchar_t* process_name;
......
...@@ -156,11 +156,9 @@ bool AuthenticateUser(gfx::NativeWindow window) { ...@@ -156,11 +156,9 @@ bool AuthenticateUser(gfx::NativeWindow window) {
WCHAR displayname[CREDUI_MAX_USERNAME_LENGTH+1] = {}; WCHAR displayname[CREDUI_MAX_USERNAME_LENGTH+1] = {};
WCHAR password[CREDUI_MAX_PASSWORD_LENGTH+1] = {}; WCHAR password[CREDUI_MAX_PASSWORD_LENGTH+1] = {};
DWORD username_length = CREDUI_MAX_USERNAME_LENGTH; DWORD username_length = CREDUI_MAX_USERNAME_LENGTH;
std::wstring product_name = base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); base::string16 password_prompt =
std::wstring password_prompt = l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT);
base::UTF16ToWide(l10n_util::GetStringUTF16(
IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT));
HANDLE handle = INVALID_HANDLE_VALUE; HANDLE handle = INVALID_HANDLE_VALUE;
int tries = 0; int tries = 0;
bool use_displayname = false; bool use_displayname = false;
......
...@@ -285,11 +285,9 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, ...@@ -285,11 +285,9 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path,
// We only expect this method to be called once per process. // We only expect this method to be called once per process.
// Common enties // Common enties
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"ver", google_breakpad::CustomInfoEntry(L"ver", version.c_str()));
base::UTF16ToWide(version).c_str()));
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"prod", google_breakpad::CustomInfoEntry(L"prod", product.c_str()));
base::UTF16ToWide(product).c_str()));
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"plat", L"Win32")); google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
custom_entries_.push_back( custom_entries_.push_back(
...@@ -297,13 +295,14 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, ...@@ -297,13 +295,14 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path,
custom_entries_.push_back(google_breakpad::CustomInfoEntry( custom_entries_.push_back(google_breakpad::CustomInfoEntry(
L"pid", base::StringPrintf(L"%d", ::GetCurrentProcessId()).c_str())); L"pid", base::StringPrintf(L"%d", ::GetCurrentProcessId()).c_str()));
custom_entries_.push_back(google_breakpad::CustomInfoEntry( custom_entries_.push_back(google_breakpad::CustomInfoEntry(
L"channel", base::UTF16ToWide(channel_name).c_str())); L"channel", channel_name.c_str()));
custom_entries_.push_back(google_breakpad::CustomInfoEntry( custom_entries_.push_back(google_breakpad::CustomInfoEntry(
L"profile-type", GetProfileType().c_str())); L"profile-type", GetProfileType().c_str()));
if (!special_build.empty()) if (!special_build.empty()) {
custom_entries_.push_back(google_breakpad::CustomInfoEntry( custom_entries_.push_back(google_breakpad::CustomInfoEntry(
L"special", base::UTF16ToWide(special_build).c_str())); L"special", special_build.c_str()));
}
if (type == L"plugin" || type == L"ppapi") { if (type == L"plugin" || type == L"ppapi") {
std::wstring plugin_path = std::wstring plugin_path =
...@@ -538,10 +537,7 @@ bool ShowRestartDialogIfCrashed(bool* exit_now) { ...@@ -538,10 +537,7 @@ bool ShowRestartDialogIfCrashed(bool* exit_now) {
if (is_rtl_locale) if (is_rtl_locale)
flags |= MB_RIGHT | MB_RTLREADING; flags |= MB_RIGHT | MB_RTLREADING;
return WrapMessageBoxWithSEH(base::UTF16ToWide(message).c_str(), return WrapMessageBoxWithSEH(message.c_str(), title.c_str(), flags, exit_now);
base::UTF16ToWide(title).c_str(),
flags,
exit_now);
} }
// Crashes the process after generating a dump for the provided exception. Note // Crashes the process after generating a dump for the provided exception. Note
......
...@@ -322,7 +322,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings( ...@@ -322,7 +322,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
{ {
DEVMODE* dev_mode = scoped_dev_mode.get(); DEVMODE* dev_mode = scoped_dev_mode.get();
dev_mode->dmCopies = std::max(settings_.copies(), 1); dev_mode->dmCopies = std::max(settings_.copies(), 1);
if (dev_mode->dmCopies > 1) { // do not change unless multiple copies if (dev_mode->dmCopies > 1) { // do not change unless multiple copies
dev_mode->dmFields |= DM_COPIES; dev_mode->dmFields |= DM_COPIES;
dev_mode->dmCollate = settings_.collate() ? DMCOLLATE_TRUE : dev_mode->dmCollate = settings_.collate() ? DMCOLLATE_TRUE :
DMCOLLATE_FALSE; DMCOLLATE_FALSE;
...@@ -405,8 +405,7 @@ PrintingContext::Result PrintingContextWin::NewDocument( ...@@ -405,8 +405,7 @@ PrintingContext::Result PrintingContextWin::NewDocument(
DCHECK(SimplifyDocumentTitle(document_name) == document_name); DCHECK(SimplifyDocumentTitle(document_name) == document_name);
DOCINFO di = { sizeof(DOCINFO) }; DOCINFO di = { sizeof(DOCINFO) };
const std::wstring& document_name_wide = base::UTF16ToWide(document_name); di.lpszDocName = document_name.c_str();
di.lpszDocName = document_name_wide.c_str();
// Is there a debug dump directory specified? If so, force to print to a file. // Is there a debug dump directory specified? If so, force to print to a file.
base::FilePath debug_dump_path = PrintedDocument::debug_dump_path(); base::FilePath debug_dump_path = PrintedDocument::debug_dump_path();
...@@ -418,7 +417,7 @@ PrintingContext::Result PrintingContextWin::NewDocument( ...@@ -418,7 +417,7 @@ PrintingContext::Result PrintingContextWin::NewDocument(
filename += L"_"; filename += L"_";
filename += base::TimeFormatTimeOfDay(now); filename += base::TimeFormatTimeOfDay(now);
filename += L"_"; filename += L"_";
filename += base::UTF16ToWide(document_name); filename += document_name;
filename += L"_"; filename += L"_";
filename += L"buffer.prn"; filename += L"buffer.prn";
file_util::ReplaceIllegalCharactersInPath(&filename, '_'); file_util::ReplaceIllegalCharactersInPath(&filename, '_');
......
...@@ -150,8 +150,7 @@ google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() { ...@@ -150,8 +150,7 @@ google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() {
static wchar_t version[64]; static wchar_t version[64];
if (version_info.get()) { if (version_info.get()) {
wcscpy_s(version, wcscpy_s(version, version_info->product_version().c_str());
base::UTF16ToWide(version_info->product_version()).c_str());
} else { } else {
wcscpy_s(version, kBreakpadVersionDefault); wcscpy_s(version, kBreakpadVersionDefault);
} }
......
...@@ -550,7 +550,7 @@ void SelectFileDialogImpl::SelectFileImpl( ...@@ -550,7 +550,7 @@ void SelectFileDialogImpl::SelectFileImpl(
GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) { GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) {
if (type == SELECT_SAVEAS_FILE) { if (type == SELECT_SAVEAS_FILE) {
win8::MetroViewerProcessHost::HandleSaveFile( win8::MetroViewerProcessHost::HandleSaveFile(
base::UTF16ToWide(title), title,
default_path, default_path,
GetFilterForFileTypes(file_types), GetFilterForFileTypes(file_types),
file_type_index, file_type_index,
...@@ -562,7 +562,7 @@ void SelectFileDialogImpl::SelectFileImpl( ...@@ -562,7 +562,7 @@ void SelectFileDialogImpl::SelectFileImpl(
return; return;
} else if (type == SELECT_OPEN_FILE) { } else if (type == SELECT_OPEN_FILE) {
win8::MetroViewerProcessHost::HandleOpenFile( win8::MetroViewerProcessHost::HandleOpenFile(
base::UTF16ToWide(title), title,
default_path, default_path,
GetFilterForFileTypes(file_types), GetFilterForFileTypes(file_types),
base::Bind(&ui::SelectFileDialog::Listener::FileSelected, base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
...@@ -572,7 +572,7 @@ void SelectFileDialogImpl::SelectFileImpl( ...@@ -572,7 +572,7 @@ void SelectFileDialogImpl::SelectFileImpl(
return; return;
} else if (type == SELECT_OPEN_MULTI_FILE) { } else if (type == SELECT_OPEN_MULTI_FILE) {
win8::MetroViewerProcessHost::HandleOpenMultipleFiles( win8::MetroViewerProcessHost::HandleOpenMultipleFiles(
base::UTF16ToWide(title), title,
default_path, default_path,
GetFilterForFileTypes(file_types), GetFilterForFileTypes(file_types),
base::Bind(&ui::SelectFileDialog::Listener::MultiFilesSelected, base::Bind(&ui::SelectFileDialog::Listener::MultiFilesSelected,
...@@ -589,7 +589,7 @@ void SelectFileDialogImpl::SelectFileImpl( ...@@ -589,7 +589,7 @@ void SelectFileDialogImpl::SelectFileImpl(
IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE); IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE);
} }
win8::MetroViewerProcessHost::HandleSelectFolder( win8::MetroViewerProcessHost::HandleSelectFolder(
base::UTF16ToWide(title_string), title_string,
base::Bind(&ui::SelectFileDialog::Listener::FileSelected, base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
base::Unretained(listener_)), base::Unretained(listener_)),
base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled, base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
...@@ -600,7 +600,7 @@ void SelectFileDialogImpl::SelectFileImpl( ...@@ -600,7 +600,7 @@ void SelectFileDialogImpl::SelectFileImpl(
HWND owner = owning_window && owning_window->GetRootWindow() HWND owner = owning_window && owning_window->GetRootWindow()
? owning_window->GetHost()->GetAcceleratedWidget() : NULL; ? owning_window->GetHost()->GetAcceleratedWidget() : NULL;
ExecuteSelectParams execute_params(type, base::UTF16ToWide(title), ExecuteSelectParams execute_params(type, title,
default_path, file_types, file_type_index, default_path, file_types, file_type_index,
default_extension, BeginRun(owner), default_extension, BeginRun(owner),
owner, params); owner, params);
...@@ -639,8 +639,7 @@ void SelectFileDialogImpl::ExecuteSelectFile( ...@@ -639,8 +639,7 @@ void SelectFileDialogImpl::ExecuteSelectFile(
if (title.empty() && params.type == SELECT_UPLOAD_FOLDER) { if (title.empty() && params.type == SELECT_UPLOAD_FOLDER) {
// If it's for uploading don't use default dialog title to // If it's for uploading don't use default dialog title to
// make sure we clearly tell it's for uploading. // make sure we clearly tell it's for uploading.
title = base::UTF16ToWide( title = l10n_util::GetStringUTF16(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE);
l10n_util::GetStringUTF16(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE));
} }
success = RunSelectFolderDialog(title, success = RunSelectFolderDialog(title,
params.run_state.owner, params.run_state.owner,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment