diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 19:10:44 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 19:10:44 +0000 |
commit | 0f26d7b977dd50f034ca7b63b8db5d4cf923dc50 (patch) | |
tree | ecd5da8552b2a3e71d792be8ae406a5978431184 | |
parent | 66301488ce3d0df85b1f7424c77a72d97a3bd29f (diff) | |
download | chromium_src-0f26d7b977dd50f034ca7b63b8db5d4cf923dc50.zip chromium_src-0f26d7b977dd50f034ca7b63b8db5d4cf923dc50.tar.gz chromium_src-0f26d7b977dd50f034ca7b63b8db5d4cf923dc50.tar.bz2 |
Remove wstring from l10n_util. Part 5.
BUG=9911
TEST=no visible changes; all tests pass
Review URL: http://codereview.chromium.org/6023012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70530 0039d316-1c4b-4281-b951-d872f2087c98
28 files changed, 167 insertions, 128 deletions
diff --git a/app/l10n_util.h b/app/l10n_util.h index 1e20984..c9d415a 100644 --- a/app/l10n_util.h +++ b/app/l10n_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,7 +27,9 @@ // http://crbug.com/9911 . Any functions bracketed by this define are going // away; this define exists to allow compiler assistance in removing their use. +#if defined(TOOLKIT_VIEWS) #define CRBUG_9911_OBSOLETE_GOING_AWAY 1 +#endif namespace l10n_util { diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index 7f8154e..2c763c7 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -54,9 +54,9 @@ void RecordBreakpadStatusUMA(MetricsService* metrics) { void WarnAboutMinimumSystemRequirements() { if (base::win::GetVersion() < base::win::VERSION_XP) { // Display a warning message if the user is running chrome on Windows 2000. - const std::wstring text = - l10n_util::GetString(IDS_UNSUPPORTED_OS_PRE_WIN_XP); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const string16 text = + l10n_util::GetStringUTF16(IDS_UNSUPPORTED_OS_PRE_WIN_XP); + const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); app::win::MessageBox(NULL, text, caption, MB_OK | MB_ICONWARNING | MB_TOPMOST); } @@ -72,8 +72,8 @@ int AskForUninstallConfirmation() { } void ShowCloseBrowserFirstMessageBox() { - const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const string16 text = l10n_util::GetStringUTF16(IDS_UNINSTALL_CLOSE_APP); + const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST; app::win::MessageBox(NULL, text, caption, flags); } @@ -153,7 +153,7 @@ void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { // functionality so we just ask the users if they want to uninstall Chrome. int HandleIconsCommands(const CommandLine &parsed_command_line) { if (parsed_command_line.HasSwitch(switches::kHideIcons)) { - std::wstring cp_applet; + string16 cp_applet; base::win::Version version = base::win::GetVersion(); if (version >= base::win::VERSION_VISTA) { cp_applet.assign(L"Programs and Features"); // Windows Vista and later. @@ -163,9 +163,9 @@ int HandleIconsCommands(const CommandLine &parsed_command_line) { return ResultCodes::UNSUPPORTED_PARAM; // Not supported } - const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED, - cp_applet); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const string16 msg = + l10n_util::GetStringFUTF16(IDS_HIDE_ICONS_NOT_SUPPORTED, cp_applet); + const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; if (IDOK == app::win::MessageBox(NULL, msg, caption, flags)) ShellExecute(NULL, NULL, L"appwiz.cpl", NULL, NULL, SW_SHOWNORMAL); @@ -190,9 +190,9 @@ bool CheckMachineLevelInstall() { std::wstring exe = exe_path.value(); FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { - const std::wstring text = - l10n_util::GetString(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const string16 text = + l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); + const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; app::win::MessageBox(NULL, text, caption, flags); FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false, dist)); diff --git a/chrome/browser/chromeos/dom_ui/imageburner_ui.cc b/chrome/browser/chromeos/dom_ui/imageburner_ui.cc index 24fc64a..bd08dd3 100644 --- a/chrome/browser/chromeos/dom_ui/imageburner_ui.cc +++ b/chrome/browser/chromeos/dom_ui/imageburner_ui.cc @@ -295,7 +295,7 @@ void ImageBurnHandler::UpdateBurnProgress(int64 total_burnt, chromeos::BurnEventType event) { DictionaryValue progress_value; progress_value.SetString("progress_status_text", - WideToUTF16Hack(GetBurnProgressText(total_burnt, image_size))); + GetBurnProgressText(total_burnt, image_size)); if (event == chromeos::BURN_UPDATED) progress_value.SetString("state", "IN_PROGRESS"); else if (event == chromeos::BURN_CANCELED) @@ -309,26 +309,24 @@ void ImageBurnHandler::UpdateBurnProgress(int64 total_burnt, dom_ui_->CallJavascriptFunction(L"burnProgressUpdated", progress_value); } -std::wstring ImageBurnHandler::GetBurnProgressText(int64 total_burnt, - int64 image_size) { +string16 ImageBurnHandler::GetBurnProgressText(int64 total_burnt, + int64 image_size) { DataUnits amount_units = GetByteDisplayUnits(total_burnt); - std::wstring burnt_size = - UTF16ToWideHack(FormatBytes(total_burnt, amount_units, true)); + string16 burnt_size = FormatBytes(total_burnt, amount_units, true); base::i18n::AdjustStringForLocaleDirection(&burnt_size); if (image_size) { amount_units = GetByteDisplayUnits(image_size); - std::wstring total_text = - UTF16ToWideHack(FormatBytes(image_size, amount_units, true)); + string16 total_text = FormatBytes(image_size, amount_units, true); base::i18n::AdjustStringForLocaleDirection(&total_text); - return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS, - burnt_size, - total_text); + return l10n_util::GetStringFUTF16(IDS_IMAGEBURN_BURN_PROGRESS, + burnt_size, + total_text); } else { - return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN, - burnt_size); + return l10n_util::GetStringFUTF16(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN, + burnt_size); } } diff --git a/chrome/browser/chromeos/dom_ui/imageburner_ui.h b/chrome/browser/chromeos/dom_ui/imageburner_ui.h index 44041e5..97624ac 100644 --- a/chrome/browser/chromeos/dom_ui/imageburner_ui.h +++ b/chrome/browser/chromeos/dom_ui/imageburner_ui.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/scoped_ptr.h" +#include "base/string16.h" #include "base/values.h" #include "chrome/browser/chromeos/cros/burn_library.h" #include "chrome/browser/chromeos/cros/cros_library.h" @@ -113,7 +114,7 @@ class ImageBurnHandler : public DOMMessageHandler, void UpdateBurnProgress(int64 total_burnt, int64 image_size, const std::string& path, chromeos::BurnEventType evt); - std::wstring GetBurnProgressText(int64 total_burnt, int64 image_size); + string16 GetBurnProgressText(int64 total_burnt, int64 image_size); // helper functions void CreateImageUrl(); diff --git a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc index fcf69fa..547615e 100644 --- a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc +++ b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc @@ -37,12 +37,12 @@ class WrenchMenuSourceDelegate : public chromeos::MenuSourceDelegate { config->SetInteger("IDC_ZOOM_PLUS", IDC_ZOOM_PLUS); config->SetInteger("IDC_FULLSCREEN", IDC_FULLSCREEN); - config->SetString("IDS_EDIT2", WideToUTF8(l10n_util::GetString(IDS_EDIT2))); + config->SetString("IDS_EDIT2", l10n_util::GetStringUTF8(IDS_EDIT2)); config->SetString("IDS_ZOOM_MENU2", - WideToUTF8(l10n_util::GetString(IDS_ZOOM_MENU2))); - config->SetString("IDS_CUT", WideToUTF8(l10n_util::GetString(IDS_CUT))); - config->SetString("IDS_COPY", WideToUTF8(l10n_util::GetString(IDS_COPY))); - config->SetString("IDS_PASTE", WideToUTF8(l10n_util::GetString(IDS_PASTE))); + l10n_util::GetStringUTF8(IDS_ZOOM_MENU2)); + config->SetString("IDS_CUT", l10n_util::GetStringUTF8(IDS_CUT)); + config->SetString("IDS_COPY", l10n_util::GetStringUTF8(IDS_COPY)); + config->SetString("IDS_PASTE", l10n_util::GetStringUTF8(IDS_PASTE)); } }; diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc index 928508f..a6b280d 100644 --- a/chrome/browser/chromeos/external_protocol_dialog.cc +++ b/chrome/browser/chromeos/external_protocol_dialog.cc @@ -54,11 +54,12 @@ int ExternalProtocolDialog::GetDialogButtons() const { std::wstring ExternalProtocolDialog::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { - return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT); + return UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT)); } std::wstring ExternalProtocolDialog::GetWindowTitle() const { - return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_TITLE)); } void ExternalProtocolDialog::DeleteDelegate() { @@ -90,17 +91,17 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, gfx::ElideString(ASCIIToWide(url.possibly_invalid_spec()), kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); - std::wstring message_text = l10n_util::GetStringF( + std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16( IDS_EXTERNAL_PROTOCOL_INFORMATION, - ASCIIToWide(url.scheme() + ":"), - elided_url_without_scheme) + L"\n\n"; + ASCIIToUTF16(url.scheme() + ":"), + WideToUTF16(elided_url_without_scheme)) + ASCIIToUTF16("\n\n")); message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox, message_text, std::wstring(), kMessageWidth); - message_box_view_->SetCheckBoxLabel( - l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); + message_box_view_->SetCheckBoxLabel(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT))); gfx::NativeWindow parent_window; if (tab_contents) { diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc index de66b3e..fd1a4ea 100644 --- a/chrome/browser/chromeos/login/captcha_view.cc +++ b/chrome/browser/chromeos/login/captcha_view.cc @@ -90,7 +90,7 @@ bool CaptchaView::Accept() { } std::wstring CaptchaView::GetWindowTitle() const { - return l10n_util::GetString(IDS_LOGIN_CAPTCHA_DIALOG_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_DIALOG_TITLE)); } void CaptchaView::SetCaptchaURL(const GURL& captcha_url) { @@ -162,8 +162,8 @@ void CaptchaView::Init() { column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); layout->StartRow(0, column_view_set_id); - Label* label = - new views::Label(l10n_util::GetString(IDS_LOGIN_CAPTCHA_INSTRUCTIONS)); + Label* label = new views::Label( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS))); label->SetMultiLine(true); layout->AddView(label); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); @@ -182,15 +182,16 @@ void CaptchaView::Init() { layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, column_view_set_id); - label = new views::Label( - l10n_util::GetString(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP)); + label = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP))); label->SetMultiLine(true); layout->AddView(label); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); if (is_standalone_) { layout->StartRow(0, column_view_set_id); - ok_button_ = new WideTextButton(this, l10n_util::GetString(IDS_OK)); + ok_button_ = new WideTextButton( + this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); ok_button_->set_alignment(views::TextButton::ALIGN_CENTER); ok_button_->SetFocusable(true); ok_button_->SetNormalHasBorder(true); diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index b7c688a..c23a89a 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -104,7 +104,8 @@ class TpmInfoView : public views::View, // views::View overrides: virtual std::wstring GetWindowTitle() const { - return l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING); + return UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING)); } gfx::Size GetPreferredSize() { @@ -135,16 +136,16 @@ void TpmInfoView::Init() { column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); layout->StartRow(0, 0); - views::Label* label = new views::Label( - l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION)); + views::Label* label = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION))); label->SetMultiLine(true); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(label); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, 0); - label = new views::Label( - l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY)); + label = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( + IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY))); label->SetMultiLine(true); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(label); @@ -181,7 +182,8 @@ void TpmInfoView::Init() { throbber_ = chromeos::CreateDefaultThrobber(); throbber_->Start(); layout->AddView(throbber_); - busy_label_ = new views::Label(l10n_util::GetString(IDS_EULA_TPM_BUSY)); + busy_label_ = new views::Label( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_TPM_BUSY))); layout->AddView(busy_label_); layout->AddPaddingRow(0, kRelatedControlHorizontalSpacing); @@ -414,26 +416,26 @@ void EulaView::UpdateLocalizedStrings() { // Set tooltip for usage statistics checkbox if the metric is unmanaged. if (!usage_statistics_checkbox_->IsEnabled()) { usage_statistics_checkbox_->SetTooltipText( - l10n_util::GetString(IDS_OPTION_DISABLED_BY_POLICY)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTION_DISABLED_BY_POLICY))); } // Set tooltip for system security settings link if TPM is disabled. if (!system_security_settings_link_->IsEnabled()) { system_security_settings_link_->SetTooltipText( - l10n_util::GetString(IDS_EULA_TPM_DISABLED)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_TPM_DISABLED))); } // Load other labels from resources. usage_statistics_checkbox_->SetLabel( - l10n_util::GetString(IDS_EULA_CHECKBOX_ENABLE_LOGGING)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_CHECKBOX_ENABLE_LOGGING))); learn_more_link_->SetText( - l10n_util::GetString(IDS_LEARN_MORE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE))); system_security_settings_link_->SetText( - l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING)); - continue_button_->SetLabel( - l10n_util::GetString(IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING))); + continue_button_->SetLabel(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON))); back_button_->SetLabel( - l10n_util::GetString(IDS_EULA_BACK_BUTTON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_BACK_BUTTON))); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 7387a91..1b906e0 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -489,13 +489,13 @@ gfx::NativeWindow ExistingUserController::GetNativeWindow() const { void ExistingUserController::ShowError(int error_id, const std::string& details) { ClearErrors(); - std::wstring error_text; + string16 error_text; // GetStringF fails on debug build if there's no replacement in the string. if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { - error_text = l10n_util::GetStringF( - error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME)); + error_text = l10n_util::GetStringFUTF16( + error_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); } else { - error_text = l10n_util::GetString(error_id); + error_text = l10n_util::GetStringUTF16(error_id); } // TODO(dpolukhin): show detailed error info. |details| string contains // low level error info that is not localized and even is not user friendly. @@ -512,11 +512,11 @@ void ExistingUserController::ShowError(int error_id, bounds.set_width(kCursorOffset * 2); arrow = BubbleBorder::BOTTOM_LEFT; } - std::wstring help_link; + string16 help_link; if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { - help_link = l10n_util::GetString(IDS_LEARN_MORE); + help_link = l10n_util::GetStringUTF16(IDS_LEARN_MORE); } else if (num_login_attempts_ > static_cast<size_t>(1)) { - help_link = l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON); + help_link = l10n_util::GetStringUTF16(IDS_CANT_ACCESS_ACCOUNT_BUTTON); } bubble_ = MessageBubble::Show( @@ -524,8 +524,8 @@ void ExistingUserController::ShowError(int error_id, bounds, arrow, ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), - error_text, - help_link, + UTF16ToWide(error_text), + UTF16ToWide(help_link), this); } diff --git a/chrome/browser/chromeos/login/guest_user_view.cc b/chrome/browser/chromeos/login/guest_user_view.cc index c83d897..0fcc48d 100644 --- a/chrome/browser/chromeos/login/guest_user_view.cc +++ b/chrome/browser/chromeos/login/guest_user_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/login/guest_user_view.h" #include "app/l10n_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/user_controller.h" #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" #include "grit/generated_resources.h" @@ -64,7 +65,7 @@ void GuestUserView::RecreateFields() { submit_button_ = new UserEntryButton( this, user_controller_, - l10n_util::GetString(IDS_ENTER_GUEST_SESSION_BUTTON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ENTER_GUEST_SESSION_BUTTON))); AddChildView(submit_button_); Layout(); SchedulePaint(); diff --git a/chrome/browser/chromeos/login/help_app_launcher.cc b/chrome/browser/chromeos/login/help_app_launcher.cc index 0fabd79..988e015 100644 --- a/chrome/browser/chromeos/login/help_app_launcher.cc +++ b/chrome/browser/chromeos/login/help_app_launcher.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "base/file_util.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/help_app_launcher.h" #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" @@ -73,7 +74,8 @@ void HelpAppLauncher::ShowHelpTopicDialog(const GURL& topic_url) { dialog_.reset(new LoginHtmlDialog( this, parent_window_, - l10n_util::GetString(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), + UTF16ToWide( + l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE)), topic_url, LoginHtmlDialog::STYLE_BUBBLE)); } else { diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc index c37c404..d6ea7d9 100644 --- a/chrome/browser/chromeos/login/login_performer.cc +++ b/chrome/browser/chromeos/login/login_performer.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/chromeos/boot_times_loader.h" @@ -373,7 +374,7 @@ void LoginPerformer::ResolveLockNetworkAuthFailure() { << "ScreenLocker instance doesn't exist."; DCHECK(last_login_failure_.reason() == LoginFailure::NETWORK_AUTH_FAILED); - std::wstring msg; + string16 msg; bool sign_out_only = false; DVLOG(1) << "auth_error: " << last_login_failure_.error().state(); @@ -392,22 +393,22 @@ void LoginPerformer::ResolveLockNetworkAuthFailure() { return; case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: // Password change detected. - msg = l10n_util::GetString(IDS_LOGIN_ERROR_PASSWORD_CHANGED); + msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_PASSWORD_CHANGED); break; case GoogleServiceAuthError::USER_NOT_SIGNED_UP: case GoogleServiceAuthError::ACCOUNT_DELETED: case GoogleServiceAuthError::ACCOUNT_DISABLED: // Access not granted. User has to sign out. // Show error message using existing screen lock. - msg = l10n_util::GetString(IDS_LOGIN_ERROR_RESTRICTED); + msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_RESTRICTED); sign_out_only = true; break; case GoogleServiceAuthError::CAPTCHA_REQUIRED: // User is requested to enter CAPTCHA challenge. - msg = l10n_util::GetString(IDS_LOGIN_ERROR_PASSWORD_CHANGED); + msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_PASSWORD_CHANGED); ScreenLocker::default_screen_locker()->ShowCaptchaAndErrorMessage( last_login_failure_.error().captcha().image_url, - msg); + UTF16ToWide(msg)); return; default: // Unless there's new GoogleServiceAuthError state has been added. @@ -415,7 +416,8 @@ void LoginPerformer::ResolveLockNetworkAuthFailure() { break; } - ScreenLocker::default_screen_locker()->ShowErrorMessage(msg, sign_out_only); + ScreenLocker::default_screen_locker()->ShowErrorMessage(UTF16ToWide(msg), + sign_out_only); } void LoginPerformer::ResolveScreenLocked() { diff --git a/chrome/browser/chromeos/login/login_screen.cc b/chrome/browser/chromeos/login/login_screen.cc index 5270b5b..7d8fbba 100644 --- a/chrome/browser/chromeos/login/login_screen.cc +++ b/chrome/browser/chromeos/login/login_screen.cc @@ -124,7 +124,7 @@ void LoginScreen::AppendStartUrlToCmdline() { void LoginScreen::ShowError(int error_id, const std::string& details) { ClearErrors(); - std::wstring error_text = l10n_util::GetString(error_id); + std::wstring error_text = UTF16ToWide(l10n_util::GetStringUTF16(error_id)); // TODO(dpolukhin): show detailed error info. |details| string contains // low level error info that is not localized and even is not user friendly. // For now just ignore it because error_text contains all required information diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 536f4ea..ab3821a 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -845,8 +845,8 @@ GURL EnumerateModulesModel::ConstructHelpCenterUrl( GenerateHash(WideToUTF8(module.description), &description); GenerateHash(WideToUTF8(module.digital_signer), &signer); - string16 url = l10n_util::GetStringF(IDS_HELP_CENTER_VIEW_CONFLICTS, - ASCIIToWide(filename), ASCIIToWide(location), - ASCIIToWide(description), ASCIIToWide(signer)); - return GURL(WideToUTF8(url)); + string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, + ASCIIToUTF16(filename), ASCIIToUTF16(location), + ASCIIToUTF16(description), ASCIIToUTF16(signer)); + return GURL(UTF16ToUTF8(url)); } diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 34b8cdb..35f4ad4 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -123,7 +123,7 @@ void IEImporter::ImportFavorites() { if (!bookmarks.empty() && !cancelled()) { const std::wstring& first_folder_name = - l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_IE); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE)); int options = 0; if (import_to_bookmark_bar()) options = ProfileWriter::IMPORT_TO_BOOKMARK_BAR; @@ -488,7 +488,8 @@ bool IEImporter::GetFavoritesInfo(IEImporter::FavoritesInfo *info) { void IEImporter::ParseFavoritesFolder(const FavoritesInfo& info, BookmarkVector* bookmarks) { - std::wstring ie_folder = l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_IE); + std::wstring ie_folder = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE)); BookmarkVector toolbar_bookmarks; FilePath file; std::vector<FilePath::StringType> file_list; diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index e79fbba..d69aff41 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/threading/thread.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_list.h" @@ -213,7 +214,8 @@ void ImporterHost::StartImportSettings( if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) { app::win::MessageBox( NULL, - l10n_util::GetString(IDS_IMPORTER_GOOGLE_LOGIN_TEXT).c_str(), + UTF16ToWide(l10n_util::GetStringUTF16( + IDS_IMPORTER_GOOGLE_LOGIN_TEXT)).c_str(), L"", MB_OK | MB_TOPMOST); diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc index ce3f316..9574f95 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc @@ -33,7 +33,7 @@ namespace { void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) { // IE always exists and doesn't have multiple profiles. ProfileInfo* ie = new ProfileInfo(); - ie->description = l10n_util::GetString(IDS_IMPORT_FROM_IE); + ie->description = UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_IE)); ie->browser_type = importer::MS_IE; ie->source_path.clear(); ie->app_path.clear(); diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 58ad7d3..b953795 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -293,7 +293,7 @@ HRESULT UpdateCategory(ScopedComPtr<ICustomDestinationList> list, if (data.empty() || !max_slots) return S_OK; - std::wstring category = l10n_util::GetString(category_id); + std::wstring category = UTF16ToWide(l10n_util::GetStringUTF16(category_id)); // Create an EnumerableObjectCollection object. // We once add the given items to this collection object and add this @@ -348,7 +348,8 @@ HRESULT UpdateTaskCategory(ScopedComPtr<ICustomDestinationList> list, // We remove '&' characters from this string so we can share it with our // system menu. scoped_refptr<ShellLinkItem> chrome(new ShellLinkItem); - std::wstring chrome_title(l10n_util::GetString(IDS_NEW_WINDOW)); + std::wstring chrome_title = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_WINDOW)); ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L""); chrome->SetTitle(chrome_title); chrome->SetIcon(chrome_path, 0, false); @@ -360,7 +361,8 @@ HRESULT UpdateTaskCategory(ScopedComPtr<ICustomDestinationList> list, scoped_refptr<ShellLinkItem> incognito(new ShellLinkItem); incognito->SetArguments( ASCIIToWide(std::string("--") + switches::kIncognito)); - std::wstring incognito_title(l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW)); + std::wstring incognito_title = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW)); ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L""); incognito->SetTitle(incognito_title); incognito->SetIcon(chrome_path, 0, false); diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 91f0b6d..d49a852 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -34,7 +34,7 @@ enum { MemoryDetails::MemoryDetails() { static const std::wstring google_browser_name = - l10n_util::GetString(IDS_PRODUCT_NAME); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); struct { const wchar_t* name; const wchar_t* process_name; diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index a1d8f60..a52700e 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_handle.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extensions_startup.h" #include "chrome/browser/platform_util.h" @@ -142,8 +143,10 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { // If there is a visible browser window, ask the user before killing it. if (visible_window) { - std::wstring text = l10n_util::GetString(IDS_BROWSER_HUNGBROWSER_MESSAGE); - std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + std::wstring text = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE)); + std::wstring caption = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); if (!platform_util::SimpleYesNoBox(NULL, caption, text)) { // The user denied. Quit silently. return PROCESS_NOTIFIED; diff --git a/chrome/browser/ui/views/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmark_editor_view.cc index a64d42e..c6768c4 100644 --- a/chrome/browser/ui/views/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmark_editor_view.cc @@ -106,7 +106,7 @@ bool BookmarkEditorView::CanResize() const { } std::wstring BookmarkEditorView::GetWindowTitle() const { - return l10n_util::GetString(IDS_BOOMARK_EDITOR_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_TITLE)); } bool BookmarkEditorView::Accept() { @@ -271,12 +271,13 @@ void BookmarkEditorView::Init() { if (details_.type == EditDetails::EXISTING_NODE) title = details_.existing_node->GetTitle(); else if (details_.type == EditDetails::NEW_FOLDER) - title = l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME); + title = UTF16ToWide( + l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME)); title_tf_.SetText(title); title_tf_.SetController(this); title_label_ = new views::Label( - l10n_util::GetString(IDS_BOOMARK_EDITOR_NAME_LABEL)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL))); title_tf_.SetAccessibleName(title_label_->GetText()); string16 url_text; @@ -295,13 +296,15 @@ void BookmarkEditorView::Init() { url_tf_.SetController(this); url_label_ = new views::Label( - l10n_util::GetString(IDS_BOOMARK_EDITOR_URL_LABEL)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL))); url_tf_.SetAccessibleName(url_label_->GetText()); if (show_tree_) { tree_view_ = new views::TreeView(); new_group_button_.reset(new views::NativeButton( - this, l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))); + this, + UTF16ToWide(l10n_util::GetStringUTF16( + IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON)))); new_group_button_->set_parent_owned(false); tree_view_->SetContextMenuController(this); diff --git a/chrome/browser/ui/views/clear_data_view.cc b/chrome/browser/ui/views/clear_data_view.cc index 9703277..839d668 100644 --- a/chrome/browser/ui/views/clear_data_view.cc +++ b/chrome/browser/ui/views/clear_data_view.cc @@ -53,19 +53,22 @@ ClearDataView::ClearDataView(Profile* profile) void ClearDataView::Init() { tabs_ = new views::TabbedPane; - tabs_->SetAccessibleName(l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE, - l10n_util::GetString(IDS_OPTIONS_DIALOG_TITLE))); + tabs_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE, + l10n_util::GetStringUTF16(IDS_OPTIONS_DIALOG_TITLE)))); AddChildView(tabs_); int tab_index = 0; clear_browsing_data_tab_ = new ClearBrowsingDataView2(profile_, this); - tabs_->AddTabAtIndex(tab_index++, - l10n_util::GetString(IDS_CLEAR_CHROME_DATA_TAB_LABEL), - clear_browsing_data_tab_, false); + tabs_->AddTabAtIndex( + tab_index++, + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_CHROME_DATA_TAB_LABEL)), + clear_browsing_data_tab_, false); clear_server_data_tab_ = new ClearServerDataView(profile_, this); - tabs_->AddTabAtIndex(tab_index++, - l10n_util::GetString(IDS_CLEAR_OTHER_DATA_TAB_LABEL), - clear_server_data_tab_, false); + tabs_->AddTabAtIndex( + tab_index++, + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_OTHER_DATA_TAB_LABEL)), + clear_server_data_tab_, false); tabs_->SelectTabAt(static_cast<int>(0)); } @@ -126,7 +129,7 @@ int ClearDataView::GetDefaultDialogButton() const { std::wstring ClearDataView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { DCHECK(button == MessageBoxFlags::DIALOGBUTTON_CANCEL); - return l10n_util::GetString(IDS_CANCEL); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)); } int ClearDataView::GetDialogButtons() const { @@ -161,7 +164,7 @@ bool ClearDataView::IsModal() const { } std::wstring ClearDataView::GetWindowTitle() const { - return l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TITLE)); } views::View* ClearDataView::GetContentsView() { diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 9f3dbce..61415fb 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -246,14 +246,15 @@ void CreateApplicationShortcutView::InitControls() { quick_launch_check_box_ = NULL; #if defined(OS_WIN) - menu_check_box_ = AddCheckbox( - l10n_util::GetString(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX), + menu_check_box_ = AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu)); quick_launch_check_box_ = AddCheckbox( (base::win::GetVersion() >= base::win::VERSION_WIN7) ? - l10n_util::GetString(IDS_PIN_TO_TASKBAR_CHKBOX) : - l10n_util::GetString(IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX), + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PIN_TO_TASKBAR_CHKBOX)) : + UTF16ToWide(l10n_util::GetStringUTF16( + IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInQuickLaunchBar)); #elif defined(OS_LINUX) menu_check_box_ = AddCheckbox( diff --git a/chrome/browser/ui/views/infobars/infobars.cc b/chrome/browser/ui/views/infobars/infobars.cc index ab87363..4cda653 100644 --- a/chrome/browser/ui/views/infobars/infobars.cc +++ b/chrome/browser/ui/views/infobars/infobars.cc @@ -96,10 +96,12 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) switch (delegate->GetInfoBarType()) { case InfoBarDelegate::WARNING_TYPE: - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_WARNING)); + SetAccessibleName(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_WARNING))); break; case InfoBarDelegate::PAGE_ACTION_TYPE: - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_PAGE_ACTION)); + SetAccessibleName(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_PAGE_ACTION))); break; default: NOTREACHED(); @@ -113,7 +115,8 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); - close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); + close_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); AddChildView(close_button_); animation_.reset(new SlideAnimation(this)); diff --git a/chrome/browser/ui/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc index cddc79b..cd338d2 100644 --- a/chrome/browser/ui/views/instant_confirm_view.cc +++ b/chrome/browser/ui/views/instant_confirm_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/instant_confirm_view.h" #include "app/l10n_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/instant/instant_confirm_dialog.h" #include "chrome/browser/instant/instant_controller.h" @@ -23,12 +24,12 @@ InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) { views::Label* description_label = new views::Label( - l10n_util::GetString(IDS_INSTANT_OPT_IN_MESSAGE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_MESSAGE))); description_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); description_label->SetMultiLine(true); views::Link* learn_more_link = new views::Link( - l10n_util::GetString(IDS_LEARN_MORE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE))); learn_more_link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); learn_more_link->SetController(this); @@ -63,7 +64,7 @@ views::View* InstantConfirmView::GetContentsView() { } std::wstring InstantConfirmView::GetWindowTitle() const { - return l10n_util::GetString(IDS_INSTANT_OPT_IN_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_TITLE)); } gfx::Size InstantConfirmView::GetPreferredSize() { diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc index ac20b4e..a75d922 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.cc +++ b/chrome/browser/ui/views/js_modal_dialog_views.cc @@ -7,6 +7,7 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/message_box_flags.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" #include "chrome/browser/views/window.h" #include "grit/generated_resources.h" @@ -27,8 +28,8 @@ JSModalDialogViews::JSModalDialogViews( message_box_view_->AddAccelerator( views::Accelerator(app::VKEY_C, false, true, false)); if (parent->display_suppress_checkbox()) { - message_box_view_->SetCheckBoxLabel( - l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); + message_box_view_->SetCheckBoxLabel(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION))); } } @@ -119,10 +120,11 @@ std::wstring JSModalDialogViews::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (parent_->is_before_unload_dialog()) { if (button == MessageBoxFlags::DIALOGBUTTON_OK) { - return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); + return UTF16ToWide(l10n_util::GetStringUTF16( + IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL)); } else if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) { - return l10n_util::GetString( - IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); + return UTF16ToWide(l10n_util::GetStringUTF16( + IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL)); } } return DialogDelegate::GetDialogButtonLabel(button); diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc index 5d9192f..7b757e8 100644 --- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc +++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_model.h" @@ -61,8 +62,12 @@ void KeywordHintView::SetKeyword(const std::wstring& keyword) { GetKeywordShortName(keyword, &is_extension_keyword); int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; - const std::wstring keyword_hint(l10n_util::GetStringF( - message_id, std::wstring(), short_name, &content_param_offsets)); + const std::wstring keyword_hint = + UTF16ToWide(l10n_util::GetStringFUTF16( + message_id, + string16(), + WideToUTF16(short_name), + &content_param_offsets)); if (content_param_offsets.size() == 2) { leading_label_->SetText( keyword_hint.substr(0, content_param_offsets.front())); diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc index 69b639c..bf133b9 100644 --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" @@ -58,14 +59,16 @@ void SelectedKeywordView::SetKeyword(const std::wstring& keyword) { return; bool is_extension_keyword; - const std::wstring short_name = profile_->GetTemplateURLModel()-> - GetKeywordShortName(keyword, &is_extension_keyword); + const string16 short_name = WideToUTF16(profile_->GetTemplateURLModel()-> + GetKeywordShortName(keyword, &is_extension_keyword)); int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT; - full_label_.SetText(l10n_util::GetStringF(message_id, short_name)); + full_label_.SetText(UTF16ToWide( + l10n_util::GetStringFUTF16(message_id, short_name))); const std::wstring min_string( - location_bar_util::CalculateMinString(short_name)); + location_bar_util::CalculateMinString(UTF16ToWide(short_name))); partial_label_.SetText(min_string.empty() ? full_label_.GetText() : - l10n_util::GetStringF(message_id, min_string)); + UTF16ToWide(l10n_util::GetStringFUTF16(message_id, + WideToUTF16(min_string)))); } |