diff options
34 files changed, 288 insertions, 222 deletions
diff --git a/app/l10n_util_win.cc b/app/l10n_util_win.cc index eacdb35..d1e9392 100644 --- a/app/l10n_util_win.cc +++ b/app/l10n_util_win.cc @@ -123,9 +123,9 @@ bool NeedOverrideDefaultUIFont(std::wstring* override_font_family, ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER_XP; } - std::wstring ui_font_family = GetString(ui_font_family_id); + std::wstring ui_font_family = GetStringUTF16(ui_font_family_id); int scaler100; - if (!base::StringToInt(l10n_util::GetString(ui_font_size_scaler_id), + if (!base::StringToInt(l10n_util::GetStringUTF16(ui_font_size_scaler_id), &scaler100)) return false; diff --git a/app/os_exchange_data_provider_win.cc b/app/os_exchange_data_provider_win.cc index 032380a..d6635ea 100644 --- a/app/os_exchange_data_provider_win.cc +++ b/app/os_exchange_data_provider_win.cc @@ -846,7 +846,8 @@ static void CreateValidFileNameFromTitle(const GURL& url, url, std::string(), std::string(), FilePath()).ToWStringHack(); } else { // Nothing else can be done, just use a default. - *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); + *validated = + l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); } } else { *validated = title; diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 181cfea..6b12dfc 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -1315,8 +1315,8 @@ int BrowserMain(const MainFunctionParams& parameters) { case ProcessSingleton::PROCESS_NOTIFIED: #if defined(OS_POSIX) && !defined(OS_MACOSX) - printf("%s\n", base::SysWideToNativeMB( - l10n_util::GetString(IDS_USED_EXISTING_BROWSER)).c_str()); + printf("%s\n", base::SysWideToNativeMB(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_USED_EXISTING_BROWSER))).c_str()); #endif return ResultCodes::NORMAL_EXIT; diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index c48f6313..b1b95eb 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -976,13 +976,15 @@ void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) { GetKeywordShortName(keyword, &is_extension_keyword); int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT; - std::wstring full_name(l10n_util::GetStringF(message_id, short_name)); - std::wstring partial_name(l10n_util::GetStringF( - message_id, location_bar_util::CalculateMinString(short_name))); + string16 full_name = l10n_util::GetStringFUTF16(message_id, + WideToUTF16Hack(short_name)); + string16 partial_name = l10n_util::GetStringFUTF16( + message_id, + WideToUTF16Hack(location_bar_util::CalculateMinString(short_name))); gtk_label_set_text(GTK_LABEL(tab_to_search_full_label_), - WideToUTF8(full_name).c_str()); + UTF16ToUTF8(full_name).c_str()); gtk_label_set_text(GTK_LABEL(tab_to_search_partial_label_), - WideToUTF8(partial_name).c_str()); + UTF16ToUTF8(partial_name).c_str()); if (last_keyword_ != keyword) { last_keyword_ = keyword; @@ -1017,17 +1019,20 @@ void LocationBarViewGtk::SetKeywordHintLabel(const std::wstring& keyword) { int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; std::vector<size_t> content_param_offsets; - const std::wstring keyword_hint(l10n_util::GetStringF( - message_id, std::wstring(), short_name, &content_param_offsets)); + const string16 keyword_hint = l10n_util::GetStringFUTF16( + message_id, + string16(), + WideToUTF16Hack(short_name), + &content_param_offsets); if (content_param_offsets.size() != 2) { // See comments on an identical NOTREACHED() in search_provider.cc. NOTREACHED(); return; } - std::string leading(WideToUTF8( + std::string leading(UTF16ToUTF8( keyword_hint.substr(0, content_param_offsets.front()))); - std::string trailing(WideToUTF8( + std::string trailing(UTF16ToUTF8( keyword_hint.substr(content_param_offsets.front()))); gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_), leading.c_str()); diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index acf982d..982f370 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -298,16 +298,17 @@ bool ParseLockPath(const FilePath& path, void DisplayProfileInUseError(const std::string& lock_path, const std::string& hostname, int pid) { - std::wstring error = l10n_util::GetStringF(IDS_PROFILE_IN_USE_LINUX, - UTF8ToWide(base::IntToString(pid)), - ASCIIToWide(hostname), - base::SysNativeMBToWide(lock_path), - l10n_util::GetString(IDS_PRODUCT_NAME)); - LOG(ERROR) << base::SysWideToNativeMB(error).c_str(); + string16 error = l10n_util::GetStringFUTF16( + IDS_PROFILE_IN_USE_LINUX, + base::IntToString16(pid), + ASCIIToUTF16(hostname), + WideToUTF16(base::SysNativeMBToWide(lock_path)), + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + LOG(ERROR) << base::SysWideToNativeMB(UTF16ToWide(error)).c_str(); #if defined(TOOLKIT_GTK) if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kNoProcessSingletonDialog)) - ProcessSingletonDialog::ShowAndRun(WideToUTF8(error)); + ProcessSingletonDialog::ShowAndRun(UTF16ToUTF8(error)); #endif } diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index 83ccad0..3027da3 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -66,7 +66,7 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate) const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); heading_ = new views::Label( - l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_HEADING)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING))); heading_->SetFont(font); heading_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); AddChildView(heading_); @@ -83,12 +83,14 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate) icon_->SetHorizontalAlignment(views::ImageView::CENTER); AddChildView(icon_); - cancel_ = new views::NativeButton(this, l10n_util::GetString(IDS_CANCEL)); + cancel_ = new views::NativeButton( + this, + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL))); AddChildView(cancel_); try_again_ = new views::NativeButton( this, - l10n_util::GetString(IDS_SPEECH_INPUT_TRY_AGAIN)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN))); AddChildView(try_again_); } @@ -103,11 +105,13 @@ void ContentView::UpdateLayout(SpeechInputBubbleBase::DisplayMode mode, if (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE) { message_->SetText(UTF16ToWideHack(message_text)); } else if (mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING) { - heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_HEADING)); + heading_->SetText(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING))); icon_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_SPEECH_INPUT_MIC_EMPTY)); } else { - heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_WORKING)); + heading_->SetText(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_WORKING))); } } diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index 4417cd5..fa99f0f 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -203,7 +203,7 @@ void AboutChromeView::Init() { // Add the dialog labels. about_title_label_ = new views::Label( - l10n_util::GetString(IDS_PRODUCT_NAME)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont).DeriveFont(18)); about_title_label_->SetColor(SK_ColorBLACK); @@ -233,14 +233,15 @@ void AboutChromeView::Init() { // The copyright URL portion of the main label. copyright_label_ = new views::Label( - l10n_util::GetString(IDS_ABOUT_VERSION_COPYRIGHT)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT))); copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(copyright_label_); main_text_label_ = new views::Label(L""); // Figure out what to write in the main label of the About box. - std::wstring text = l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE); + std::wstring text = + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE)); chromium_url_appears_first_ = text.find(kBeginLinkChr) < text.find(kBeginLinkOss); @@ -564,14 +565,14 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add, std::wstring AboutChromeView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) { - return l10n_util::GetString(IDS_RESTART_AND_UPDATE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE)); } else if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) { if (restart_button_visible_) - return l10n_util::GetString(IDS_NOT_NOW); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW)); // The OK button (which is the default button) has been re-purposed to be // 'Restart Now' so we want the Cancel button should have the label // OK but act like a Cancel button in all other ways. - return l10n_util::GetString(IDS_OK); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK)); } NOTREACHED(); @@ -579,7 +580,7 @@ std::wstring AboutChromeView::GetDialogButtonLabel( } std::wstring AboutChromeView::GetWindowTitle() const { - return l10n_util::GetString(IDS_ABOUT_CHROME_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE)); } bool AboutChromeView::IsDialogButtonEnabled( diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 28bd95e..fa3ab68 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -200,8 +200,8 @@ class AutocompletePopupContentsView::InstantOptInView bg_painter_(views::Painter::CreateVerticalGradient( SkColorSetRGB(255, 242, 183), SkColorSetRGB(250, 230, 145))) { - views::Label* label = - new views::Label(l10n_util::GetString(IDS_INSTANT_OPT_IN_LABEL)); + views::Label* label = new views::Label( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_LABEL))); label->SetFont(label_font); views::GridLayout* layout = new views::GridLayout(this); @@ -252,7 +252,7 @@ class AutocompletePopupContentsView::InstantOptInView // TODO: these buttons look crap. Figure out the right border/background to // use. views::TextButton* button = - new views::TextButton(this, l10n_util::GetString(id)); + new views::TextButton(this, UTF16ToWide(l10n_util::GetStringUTF16(id))); button->set_border(new OptInButtonBorder()); button->SetNormalHasBorder(true); button->set_tag(id); @@ -458,8 +458,8 @@ void AutocompleteResultView::Paint(gfx::Canvas* canvas) { // would also let us use a more properly-localizable string than we get with // just the IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR. if (!match_.description.empty()) { - std::wstring separator = - l10n_util::GetString(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); + std::wstring separator = UTF16ToWide(l10n_util::GetStringUTF16( + IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR)); ACMatchClassifications classifications; classifications.push_back( ACMatchClassification(0, ACMatchClassification::NONE)); diff --git a/chrome/browser/ui/views/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc index a89eb2d..36af2a6 100644 --- a/chrome/browser/ui/views/bookmark_bar_instructions_view.cc +++ b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/bookmark_bar_instructions_view.h" #include "app/l10n_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/defaults.h" #include "chrome/browser/themes/browser_theme_provider.h" #include "grit/generated_resources.h" @@ -22,12 +23,12 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate) baseline_(-1), updated_colors_(false) { instructions_ = new views::Label( - l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS))); AddChildView(instructions_); if (browser_defaults::kShowImportOnBookmarkBar) { import_link_ = new views::Link( - l10n_util::GetString(IDS_BOOKMARK_BAR_IMPORT_LINK)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK))); // We don't want the link to alter tab navigation. import_link_->SetFocusable(false); import_link_->SetController(this); diff --git a/chrome/browser/ui/views/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmark_bar_view.cc index 37e9580..924d9cb 100644 --- a/chrome/browser/ui/views/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmark_bar_view.cc @@ -915,7 +915,7 @@ void BookmarkBarView::Init() { bookmarks_separator_view_ = new ButtonSeparatorView(); bookmarks_separator_view_->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_SEPARATOR)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR))); AddChildView(bookmarks_separator_view_); instructions_ = new BookmarkBarInstructionsView(this); @@ -928,14 +928,16 @@ void BookmarkBarView::Init() { MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { MenuButton* button = new BookmarkFolderButton( - this, l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this, + this, + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)), + this, false); button->SetID(VIEW_ID_OTHER_BOOKMARKS); button->SetIcon(GetGroupIcon()); button->SetContextMenuController(this); button->set_tag(kOtherFolderButtonTag); button->SetAccessibleName( - l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED))); return button; } @@ -957,7 +959,7 @@ MenuButton* BookmarkBarView::CreateOverflowButton() { button->SetVisible(false); // Set accessibility name. button->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_BOOKMARKS_CHEVRON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS_CHEVRON))); return button; } @@ -1725,16 +1727,16 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { views::TextButton* BookmarkBarView::CreateSyncErrorButton() { views::TextButton* sync_error_button = - new views::TextButton(this, - l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR)); + new views::TextButton(this, UTF16ToWide( + l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR))); sync_error_button->set_tag(kSyncErrorButtonTag); // The tooltip is the only way we have to display text explaining the error // to the user. sync_error_button->SetTooltipText( - l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC))); sync_error_button->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON))); sync_error_button->SetIcon( *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); return sync_error_button; diff --git a/chrome/browser/ui/views/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmark_bubble_view.cc index 75dabc0..fdb47df 100644 --- a/chrome/browser/ui/views/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmark_bubble_view.cc @@ -9,6 +9,7 @@ #include "app/resource_bundle.h" #include "base/string16.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -181,27 +182,28 @@ void BookmarkBubbleView::Init() { initialized = true; } - remove_link_ = new Link(l10n_util::GetString( - IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK)); + remove_link_ = new Link(UTF16ToWide(l10n_util::GetStringUTF16( + IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK))); remove_link_->SetController(this); edit_button_ = new NativeButton( - this, l10n_util::GetString(IDS_BOOMARK_BUBBLE_OPTIONS)); + this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_OPTIONS))); - close_button_ = new NativeButton(this, l10n_util::GetString(IDS_DONE)); + close_button_ = + new NativeButton(this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); close_button_->SetIsDefault(true); Label* combobox_label = new Label( - l10n_util::GetString(IDS_BOOMARK_BUBBLE_FOLDER_TEXT)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_FOLDER_TEXT))); parent_combobox_ = new Combobox(&parent_model_); parent_combobox_->SetSelectedItem(parent_model_.node_parent_index()); parent_combobox_->set_listener(this); parent_combobox_->SetAccessibleName(combobox_label->GetText()); - Label* title_label = new Label(l10n_util::GetString( + Label* title_label = new Label(UTF16ToWide(l10n_util::GetStringUTF16( newly_bookmarked_ ? IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED : - IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK)); + IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK))); title_label->SetFont( ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); title_label->SetColor(kTitleColor); @@ -244,8 +246,8 @@ void BookmarkBubbleView::Init() { layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); layout->StartRow(0, 2); - layout->AddView( - new Label(l10n_util::GetString(IDS_BOOMARK_BUBBLE_TITLE_TEXT))); + layout->AddView(new Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_TITLE_TEXT)))); title_tf_ = new views::Textfield(); title_tf_->SetText(GetTitle()); layout->AddView(title_tf_); @@ -328,7 +330,8 @@ bool BookmarkBubbleView::CloseOnEscape() { } std::wstring BookmarkBubbleView::accessible_name() { - return l10n_util::GetString(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK); + return UTF16ToWide( + l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK)); } void BookmarkBubbleView::Close() { diff --git a/chrome/browser/ui/views/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmark_context_menu.cc index bd435ae..9067dd9 100644 --- a/chrome/browser/ui/views/bookmark_context_menu.cc +++ b/chrome/browser/ui/views/bookmark_context_menu.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/i18n/rtl.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/notification_service.h" @@ -73,7 +74,8 @@ void BookmarkContextMenu::CloseMenu() { } void BookmarkContextMenu::AddItemWithStringId(int command_id, int string_id) { - menu_->AppendMenuItemWithLabel(command_id, l10n_util::GetString(string_id)); + menu_->AppendMenuItemWithLabel( + command_id, UTF16ToWide(l10n_util::GetStringUTF16(string_id))); } void BookmarkContextMenu::AddSeparator() { @@ -81,7 +83,8 @@ void BookmarkContextMenu::AddSeparator() { } void BookmarkContextMenu::AddCheckboxItem(int command_id, int string_id) { - menu_->AppendMenuItem(command_id, l10n_util::GetString(string_id), + menu_->AppendMenuItem(command_id, + UTF16ToWide(l10n_util::GetStringUTF16(string_id)), views::MenuItemView::CHECKBOX); } diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 1f6f61c..39cb337 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -288,8 +288,8 @@ BrowserActionView::BrowserActionView(const Extension* extension, button_->SetDragController(panel_); AddChildView(button_); button_->UpdateState(); - SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION)); + SetAccessibleName(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION))); } BrowserActionView::~BrowserActionView() { @@ -368,18 +368,20 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser, resize_animation_.reset(new SlideAnimation(this)); resize_area_ = new views::ResizeArea(this); - resize_area_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_SEPARATOR)); + resize_area_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR))); AddChildView(resize_area_); chevron_ = new views::MenuButton(NULL, std::wstring(), this, false); chevron_->set_border(NULL); chevron_->EnableCanvasFlippingForRTLUI(true); chevron_->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_CHEVRON)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON))); chevron_->SetVisible(false); AddChildView(chevron_); - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_EXTENSIONS)); + SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS))); } BrowserActionsContainer::~BrowserActionsContainer() { diff --git a/chrome/browser/ui/views/clear_browsing_data.cc b/chrome/browser/ui/views/clear_browsing_data.cc index 0f9a331..0693d5a 100644 --- a/chrome/browser/ui/views/clear_browsing_data.cc +++ b/chrome/browser/ui/views/clear_browsing_data.cc @@ -86,42 +86,48 @@ void ClearBrowsingDataView::Init() { throbber_->SetVisible(false); status_label_ = new views::Label( - l10n_util::GetString(IDS_CLEAR_DATA_DELETING)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DELETING))); status_label_->SetVisible(false); // Regular view controls we draw by ourself. First, we add the dialog label. delete_all_label_ = new views::Label( - l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_LABEL))); AddChildView(delete_all_label_); // Add all the check-boxes. del_history_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_BROWSING_HISTORY_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory)); del_downloads_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory)); del_cache_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_CACHE_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache)); del_cookies_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_COOKIES_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies)); del_passwords_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_PASSWORDS_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords)); del_form_data_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX), + AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DEL_FORM_DATA_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData)); // Add a label which appears before the combo box for the time period. - time_period_label_ = new views::Label( - l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL)); + time_period_label_ = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TIME_LABEL))); AddChildView(time_period_label_); // Add the combo box showing how far back in time we want to delete. @@ -247,8 +253,9 @@ std::wstring ClearBrowsingDataView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { DCHECK((button == MessageBoxFlags::DIALOGBUTTON_OK) || (button == MessageBoxFlags::DIALOGBUTTON_CANCEL)); - return l10n_util::GetString((button == MessageBoxFlags::DIALOGBUTTON_OK) ? - IDS_CLEAR_BROWSING_DATA_COMMIT : IDS_CANCEL); + return UTF16ToWide(l10n_util::GetStringUTF16( + (button == MessageBoxFlags::DIALOGBUTTON_OK) ? + IDS_CLEAR_BROWSING_DATA_COMMIT : IDS_CANCEL)); } bool ClearBrowsingDataView::IsDialogButtonEnabled( @@ -289,7 +296,7 @@ bool ClearBrowsingDataView::IsModal() const { } std::wstring ClearBrowsingDataView::GetWindowTitle() const { - return l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TITLE)); } bool ClearBrowsingDataView::Accept() { @@ -324,8 +331,8 @@ views::View* ClearBrowsingDataView::GetInitiallyFocusedView() { views::ClientView* ClearBrowsingDataView::CreateClientView( views::Window* window) { - views::Link* flash_link = - new views::Link(l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS)); + views::Link* flash_link = new views::Link( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_FLASH_STORAGE_SETTINGS))); flash_link->SetController(this); views::View* settings_view = new views::View(); diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index 27104a2..25122f2 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -336,6 +336,7 @@ void ContentSettingBubbleContents::InitControlLayout() { layout->AddView(manage_link_); close_button_ = - new views::NativeButton(this, l10n_util::GetString(IDS_DONE)); + new views::NativeButton(this, + UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); layout->AddView(close_button_); } diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index da6e668..9f3dbce 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -235,11 +235,11 @@ void CreateApplicationShortcutView::InitControls() { app_info_ = new AppInfoView(shortcut_info_.title, shortcut_info_.description, shortcut_info_.favicon); create_shortcuts_label_ = new views::Label( - l10n_util::GetString(IDS_CREATE_SHORTCUTS_LABEL)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL))); create_shortcuts_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); - desktop_check_box_ = AddCheckbox( - l10n_util::GetString(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX), + desktop_check_box_ = AddCheckbox(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateOnDesktop)); menu_check_box_ = NULL; @@ -257,7 +257,7 @@ void CreateApplicationShortcutView::InitControls() { profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInQuickLaunchBar)); #elif defined(OS_LINUX) menu_check_box_ = AddCheckbox( - l10n_util::GetString(IDS_CREATE_SHORTCUTS_MENU_CHKBOX), + UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_MENU_CHKBOX)), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu)); #endif @@ -311,7 +311,7 @@ gfx::Size CreateApplicationShortcutView::GetPreferredSize() { std::wstring CreateApplicationShortcutView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) { - return l10n_util::GetString(IDS_CREATE_SHORTCUTS_COMMIT); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_COMMIT)); } return std::wstring(); @@ -350,7 +350,7 @@ bool CreateApplicationShortcutView::IsModal() const { } std::wstring CreateApplicationShortcutView::GetWindowTitle() const { - return l10n_util::GetString(IDS_CREATE_SHORTCUTS_TITLE); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_TITLE)); } bool CreateApplicationShortcutView::Accept() { diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc index 3ebdf44..4c7dc06 100644 --- a/chrome/browser/ui/views/download_item_view.cc +++ b/chrome/browser/ui/views/download_item_view.cc @@ -114,7 +114,8 @@ DownloadItemView::DownloadItemView(DownloadItem* download, : warning_icon_(NULL), download_(download), parent_(parent), - status_text_(l10n_util::GetString(IDS_DOWNLOAD_STATUS_STARTING)), + status_text_(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING))), show_status_text_(true), body_state_(NORMAL), drop_down_state_(NORMAL), @@ -245,12 +246,13 @@ DownloadItemView::DownloadItemView(DownloadItem* download, drop_down_state_ = DANGEROUS; warning_icon_ = rb.GetBitmapNamed(IDR_WARNING); - save_button_ = new views::NativeButton(this, l10n_util::GetString( - download->is_extension_install() ? - IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_SAVE_DOWNLOAD)); + save_button_ = new views::NativeButton(this, + UTF16ToWide(l10n_util::GetStringUTF16( + download->is_extension_install() ? + IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_SAVE_DOWNLOAD))); save_button_->set_ignore_minimum_size(true); discard_button_ = new views::NativeButton( - this, l10n_util::GetString(IDS_DISCARD_DOWNLOAD)); + this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD))); discard_button_->set_ignore_minimum_size(true); AddChildView(save_button_); AddChildView(discard_button_); @@ -282,8 +284,8 @@ DownloadItemView::DownloadItemView(DownloadItem* download, // The dangerous download label text is different for an extension file. if (download->is_extension_install()) { - dangerous_download_label_ = new views::Label( - l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION)); + dangerous_download_label_ = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION))); } else { gfx::ElideString(rootname, kFileNameMaxLength - extension.length(), @@ -291,8 +293,9 @@ DownloadItemView::DownloadItemView(DownloadItem* download, std::wstring filename = rootname + L"." + extension; filename = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( WideToUTF16(filename))); - dangerous_download_label_ = new views::Label( - l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename)); + dangerous_download_label_ = new views::Label(UTF16ToWide( + l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, + WideToUTF16(filename)))); } dangerous_download_label_->SetMultiLine(true); dangerous_download_label_->SetHorizontalAlignment( @@ -609,9 +612,8 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) { font_, kTextWidth); } else { // First, Calculate the download status opening string width. - std::wstring empty_string; - std::wstring status_string = - l10n_util::GetStringF(IDS_DOWNLOAD_STATUS_OPENING, empty_string); + std::wstring status_string = UTF16ToWide( + l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING, string16())); int status_string_width = font_.GetStringWidth(status_string); // Then, elide the file name. string16 filename_string = diff --git a/chrome/browser/ui/views/download_shelf_view.cc b/chrome/browser/ui/views/download_shelf_view.cc index 5db8ba1..17c4fd1 100644 --- a/chrome/browser/ui/views/download_shelf_view.cc +++ b/chrome/browser/ui/views/download_shelf_view.cc @@ -10,6 +10,7 @@ #include "app/resource_bundle.h" #include "app/slide_animation.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/download/download_item.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" @@ -102,8 +103,8 @@ void DownloadShelfView::Init() { arrow_image_->SetImage(rb.GetBitmapNamed(IDR_DOWNLOADS_FAVICON)); AddChildView(arrow_image_); - show_all_view_ = - new views::Link(l10n_util::GetString(IDS_SHOW_ALL_DOWNLOADS)); + show_all_view_ = new views::Link( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS))); show_all_view_->SetController(this); AddChildView(show_all_view_); @@ -114,7 +115,8 @@ void DownloadShelfView::Init() { 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))); UpdateButtonColors(); AddChildView(close_button_); diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt.cc b/chrome/browser/ui/views/extensions/extension_install_prompt.cc index bf04056..ea32328 100644 --- a/chrome/browser/ui/views/extensions/extension_install_prompt.cc +++ b/chrome/browser/ui/views/extensions/extension_install_prompt.cc @@ -45,9 +45,9 @@ class InstallDialogContent : public views::View, public views::DialogDelegate { icon_->SetImage(*icon); AddChildView(icon_); - heading_ = new views::Label( - l10n_util::GetStringF(ExtensionInstallUI::kHeadingIds[type_], - UTF8ToWide(extension->name()))); + heading_ = new views::Label(UTF16ToWide( + l10n_util::GetStringFUTF16(ExtensionInstallUI::kHeadingIds[type_], + UTF8ToUTF16(extension->name())))); heading_->SetMultiLine(true); heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(heading_); @@ -59,9 +59,10 @@ class InstallDialogContent : public views::View, public views::DialogDelegate { MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_OK: - return l10n_util::GetString(ExtensionInstallUI::kButtonIds[type_]); + return UTF16ToWide( + l10n_util::GetStringUTF16(ExtensionInstallUI::kButtonIds[type_])); case MessageBoxFlags::DIALOGBUTTON_CANCEL: - return l10n_util::GetString(IDS_CANCEL); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)); default: NOTREACHED(); return L""; @@ -85,7 +86,8 @@ class InstallDialogContent : public views::View, public views::DialogDelegate { // WindowDelegate virtual bool IsModal() const { return true; } virtual std::wstring GetWindowTitle() const { - return l10n_util::GetString(ExtensionInstallUI::kTitleIds[type_]); + return UTF16ToWide( + l10n_util::GetStringUTF16(ExtensionInstallUI::kTitleIds[type_])); } virtual views::View* GetContentsView() { return this; } diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc index 6ee8285..0a4e2d6 100644 --- a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc +++ b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc @@ -135,9 +135,9 @@ InstallDialogContent2::InstallDialogContent2( icon_->SetVerticalAlignment(views::ImageView::CENTER); AddChildView(icon_); - heading_ = new views::Label( - l10n_util::GetStringF(IDS_EXTENSION_INSTALL_PROMPT_HEADING, - UTF8ToWide(extension->name()))); + heading_ = new views::Label(UTF16ToWide( + l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALL_PROMPT_HEADING, + UTF8ToUTF16(extension->name())))); heading_->SetFont(heading_->font().DeriveFont(kHeadingFontSizeDelta, gfx::Font::BOLD)); heading_->SetMultiLine(true); @@ -148,8 +148,8 @@ InstallDialogContent2::InstallDialogContent2( right_column_width_ = kNoPermissionsRightColumnWidth; } else { right_column_width_ = kPermissionBoxWidth; - will_have_access_to_ = new views::Label( - l10n_util::GetString(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO)); + will_have_access_to_ = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO))); will_have_access_to_->SetMultiLine(true); will_have_access_to_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(will_have_access_to_); @@ -176,9 +176,10 @@ std::wstring InstallDialogContent2::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_OK: - return l10n_util::GetString(IDS_EXTENSION_PROMPT_INSTALL_BUTTON); + return UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_INSTALL_BUTTON)); case MessageBoxFlags::DIALOGBUTTON_CANCEL: - return l10n_util::GetString(IDS_CANCEL); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)); default: NOTREACHED(); return L""; @@ -204,7 +205,8 @@ bool InstallDialogContent2::IsModal() const { } std::wstring InstallDialogContent2::GetWindowTitle() const { - return l10n_util::GetString(IDS_EXTENSION_INSTALL_PROMPT_TITLE); + return UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_PROMPT_TITLE)); } views::View* InstallDialogContent2::GetContentsView() { diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 1b549d3..b2e0697 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -84,19 +84,19 @@ class InstalledBubbleContent : public views::View, icon_->SetImage(*icon); AddChildView(icon_); - std::wstring extension_name = UTF8ToWide(extension->name()); + string16 extension_name = UTF8ToUTF16(extension->name()); base::i18n::AdjustStringForLocaleDirection(&extension_name); - heading_ = new views::Label( - l10n_util::GetStringF(IDS_EXTENSION_INSTALLED_HEADING, - extension_name)); + heading_ = new views::Label(UTF16ToWide( + l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, + extension_name))); heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); heading_->SetMultiLine(true); heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(heading_); if (type_ == ExtensionInstalledBubble::PAGE_ACTION) { - info_ = new views::Label(l10n_util::GetString( - IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); + info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( + IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO))); info_->SetFont(font); info_->SetMultiLine(true); info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -104,17 +104,17 @@ class InstalledBubbleContent : public views::View, } if (type_ == ExtensionInstalledBubble::OMNIBOX_KEYWORD) { - info_ = new views::Label(l10n_util::GetStringF( + info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, - UTF8ToWide(extension->omnibox_keyword()))); + UTF8ToUTF16(extension->omnibox_keyword())))); info_->SetFont(font); info_->SetMultiLine(true); info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(info_); } - manage_ = new views::Label( - l10n_util::GetString(IDS_EXTENSION_INSTALLED_MANAGE_INFO)); + manage_ = new views::Label(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); manage_->SetFont(font); manage_->SetMultiLine(true); manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 72f722c..acf1b3f 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -102,7 +102,8 @@ FindBarView::FindBarView(FindBarHost* host) find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); find_text_->set_default_width_in_chars(kDefaultCharWidth); find_text_->SetController(this); - find_text_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FIND)); + find_text_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND))); AddChildView(find_text_); match_count_text_ = new views::Label(); @@ -124,10 +125,10 @@ FindBarView::FindBarView(FindBarHost* host) rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H)); find_previous_button_->SetImage(views::CustomButton::BS_DISABLED, rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P)); - find_previous_button_->SetTooltipText( - l10n_util::GetString(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)); + find_previous_button_->SetTooltipText(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP))); find_previous_button_->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_PREVIOUS)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS))); AddChildView(find_previous_button_); find_next_button_ = new views::ImageButton(this); @@ -140,8 +141,9 @@ FindBarView::FindBarView(FindBarHost* host) find_next_button_->SetImage(views::CustomButton::BS_DISABLED, rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P)); find_next_button_->SetTooltipText( - l10n_util::GetString(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)); - find_next_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEXT)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP))); + find_next_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT))); AddChildView(find_next_button_); close_button_ = new views::ImageButton(this); @@ -154,8 +156,9 @@ FindBarView::FindBarView(FindBarHost* host) close_button_->SetImage(views::CustomButton::BS_PUSHED, rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); close_button_->SetTooltipText( - l10n_util::GetString(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); - close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP))); + close_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); AddChildView(close_button_); if (kDialog_left == NULL) { @@ -209,10 +212,10 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, } if (!find_text.empty() && have_valid_range) { - match_count_text_->SetText( - l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT, - UTF8ToWide(base::IntToString(result.active_match_ordinal())), - UTF8ToWide(base::IntToString(result.number_of_matches())))); + match_count_text_->SetText(UTF16ToWide( + l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT, + base::IntToString16(result.active_match_ordinal()), + base::IntToString16(result.number_of_matches())))); UpdateMatchCountAppearance(result.number_of_matches() == 0 && result.final_update()); diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc index 51a12a1..b6de9d6 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc @@ -7,6 +7,7 @@ #include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "app/os_exchange_data.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_match.h" @@ -22,7 +23,7 @@ BrowserRootView::BrowserRootView(BrowserView* browser_view, : views::RootView(widget), browser_view_(browser_view), forwarding_to_tab_strip_(false) { - SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); + SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); } bool BrowserRootView::GetDropFormats( diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index e8d65f7..ac11ece 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -289,35 +289,36 @@ class DownloadInProgressConfirmDialogDelegate : public views::DialogDelegate, public: explicit DownloadInProgressConfirmDialogDelegate(Browser* browser) : browser_(browser), - product_name_(l10n_util::GetString(IDS_PRODUCT_NAME)) { + product_name_( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))) { int download_count = browser->profile()->GetDownloadManager()-> in_progress_count(); std::wstring warning_text; std::wstring explanation_text; if (download_count == 1) { - warning_text = - l10n_util::GetStringF(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, - product_name_); - explanation_text = - l10n_util::GetStringF(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION, - product_name_); - ok_button_text_ = l10n_util::GetString( - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); - cancel_button_text_ = l10n_util::GetString( - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); + warning_text = UTF16ToWide(l10n_util::GetStringFUTF16( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, + WideToUTF16(product_name_))); + explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION, + WideToUTF16(product_name_))); + ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL)); + cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL)); } else { - warning_text = - l10n_util::GetStringF(IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING, - product_name_, - UTF8ToWide(base::IntToString(download_count))); - explanation_text = - l10n_util::GetStringF( - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION, product_name_); - ok_button_text_ = l10n_util::GetString( - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL); - cancel_button_text_ = l10n_util::GetString( - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); + warning_text = UTF16ToWide(l10n_util::GetStringFUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING, + WideToUTF16(product_name_), + UTF8ToUTF16(base::IntToString(download_count)))); + explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION, + WideToUTF16(product_name_))); + ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL)); + cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL)); } // There are two lines of text: the bold warning label and the text @@ -1566,8 +1567,9 @@ std::wstring BrowserView::GetWindowTitle() const { std::wstring BrowserView::GetAccessibleWindowTitle() const { if (IsOffTheRecord()) { - return l10n_util::GetStringF( - IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT, GetWindowTitle()); + return UTF16ToWide(l10n_util::GetStringFUTF16( + IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT, + WideToUTF16(GetWindowTitle()))); } return GetWindowTitle(); } @@ -1868,7 +1870,8 @@ void BrowserView::InitTabStrip(TabStripModel* model) { else tabstrip_ = new TabStrip(tabstrip_controller); - tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP)); + tabstrip_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP))); AddChildView(tabstrip_); tabstrip_controller->InitFromModel(tabstrip_); @@ -1894,14 +1897,15 @@ void BrowserView::Init() { } LoadAccelerators(); - SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); + SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); InitTabStrip(browser_->tabstrip_model()); toolbar_ = new ToolbarView(browser_.get()); AddChildView(toolbar_); toolbar_->Init(browser_->profile()); - toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); + toolbar_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR))); infobar_container_ = new InfoBarContainer(this); AddChildView(infobar_container_); @@ -1925,8 +1929,8 @@ void BrowserView::Init() { sidebar_container_, views::SingleSplitView::HORIZONTAL_SPLIT); sidebar_split_->SetID(VIEW_ID_SIDE_BAR_SPLIT); - sidebar_split_-> - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_SIDE_BAR)); + sidebar_split_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR))); sidebar_split_->set_background( views::Background::CreateSolidBackground(bg_color)); } @@ -1945,8 +1949,8 @@ void BrowserView::Init() { devtools_container_, views::SingleSplitView::VERTICAL_SPLIT); contents_split_->SetID(VIEW_ID_CONTENTS_SPLIT); - contents_split_-> - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_WEB_CONTENTS)); + contents_split_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS))); contents_split_->set_background( views::Background::CreateSolidBackground(bg_color)); AddChildView(contents_split_); @@ -2024,8 +2028,8 @@ bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { bookmark_bar_view_->SetProfile(contents->profile()); } bookmark_bar_view_->SetPageNavigator(contents->tab_contents()); - bookmark_bar_view_-> - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BOOKMARKS)); + bookmark_bar_view_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS))); new_bookmark_bar_view = bookmark_bar_view_.get(); } return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); @@ -2499,8 +2503,8 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { BrowserView* view = new BrowserView(browser); BrowserFrame::Create(view, browser->profile()); - view->GetWindow()->GetNonClientView()-> - SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); + view->GetWindow()->GetNonClientView()->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); return view; } diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index d5bd3b3..0704ebd 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -8,6 +8,7 @@ #include "app/resource_bundle.h" #include "app/theme_provider.h" #include "base/compiler_specific.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/themes/browser_theme_provider.h" #include "chrome/browser/views/frame/browser_frame.h" @@ -121,7 +122,7 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK)); } minimize_button_->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_MINIMIZE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MINIMIZE))); AddChildView(minimize_button_); maximize_button_->SetImage(views::CustomButton::BS_NORMAL, @@ -135,7 +136,7 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK)); } maximize_button_->SetAccessibleName( - l10n_util::GetString(IDS_ACCNAME_MAXIMIZE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE))); AddChildView(maximize_button_); restore_button_->SetImage(views::CustomButton::BS_NORMAL, @@ -148,7 +149,8 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, restore_button_->SetBackground(color, background, tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK)); } - restore_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RESTORE)); + restore_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_RESTORE))); AddChildView(restore_button_); close_button_->SetImage(views::CustomButton::BS_NORMAL, @@ -161,7 +163,8 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, close_button_->SetBackground(color, background, tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); } - close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); + close_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); AddChildView(close_button_); // Initializing the TabIconView is expensive, so only do it if we need to. diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc index 3e303a2..41bac15 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc @@ -8,6 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/slide_animation.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "gfx/canvas_skia.h" #include "grit/generated_resources.h" @@ -51,9 +52,12 @@ FullscreenExitBubble::FullscreenExitView::FullscreenExitView( const std::wstring& accelerator) { link_.set_parent_owned(false); #if !defined(OS_CHROMEOS) - link_.SetText(l10n_util::GetStringF(IDS_EXIT_FULLSCREEN_MODE, accelerator)); + link_.SetText( + UTF16ToWide(l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE, + WideToUTF16(accelerator)))); #else - link_.SetText(l10n_util::GetString(IDS_EXIT_FULLSCREEN_MODE)); + link_.SetText( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE))); #endif link_.SetController(bubble); link_.SetFont(ResourceBundle::GetSharedInstance().GetFont( diff --git a/chrome/browser/ui/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc index 527aacc..e9706ff 100644 --- a/chrome/browser/ui/views/infobars/infobar_container.cc +++ b/chrome/browser/ui/views/infobars/infobar_container.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/infobars/infobar_container.h" #include "app/l10n_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/view_ids.h" @@ -19,7 +20,8 @@ InfoBarContainer::InfoBarContainer(Delegate* delegate) : delegate_(delegate), tab_contents_(NULL) { SetID(VIEW_ID_INFO_BAR_CONTAINER); - SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_CONTAINER)); + SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER))); } InfoBarContainer::~InfoBarContainer() { diff --git a/views/accelerator.cc b/views/accelerator.cc index 6eeddb5..9cf6884 100644 --- a/views/accelerator.cc +++ b/views/accelerator.cc @@ -68,7 +68,7 @@ std::wstring Accelerator::GetShortcutText() const { break; } - std::wstring shortcut; + string16 shortcut; if (!string_id) { #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character @@ -95,20 +95,20 @@ std::wstring Accelerator::GetShortcutText() const { } if (name) { if (name[0] != 0 && name[1] == 0) - shortcut += static_cast<wchar_t>(g_ascii_toupper(name[0])); + shortcut += static_cast<string16::value_type>(g_ascii_toupper(name[0])); else - shortcut += UTF8ToWide(name); + shortcut += UTF8ToUTF16(name); } #endif } else { - shortcut = l10n_util::GetString(string_id); + shortcut = l10n_util::GetStringUTF16(string_id); } // Checking whether the character used for the accelerator is alphanumeric. // If it is not, then we need to adjust the string later on if the locale is // right-to-left. See below for more information of why such adjustment is // required. - std::wstring shortcut_rtl; + string16 shortcut_rtl; bool adjust_shortcut_for_rtl = false; if (base::i18n::IsRTL() && shortcut.length() == 1 && !IsAsciiAlpha(shortcut.at(0)) && !IsAsciiDigit(shortcut.at(0))) { @@ -117,15 +117,15 @@ std::wstring Accelerator::GetShortcutText() const { } if (IsShiftDown()) - shortcut = l10n_util::GetStringF(IDS_APP_SHIFT_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut); // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut. // See http://blogs.msdn.com/oldnewthing/archive/2004/03/29/101121.aspx for // more information. if (IsCtrlDown()) - shortcut = l10n_util::GetStringF(IDS_APP_CONTROL_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut); else if (IsAltDown()) - shortcut = l10n_util::GetStringF(IDS_APP_ALT_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut); // For some reason, menus in Windows ignore standard Unicode directionality // marks (such as LRE, PDF, etc.). On RTL locales, we use RTL menus and @@ -150,14 +150,14 @@ std::wstring Accelerator::GetShortcutText() const { if (adjust_shortcut_for_rtl) { int key_length = static_cast<int>(shortcut_rtl.length()); DCHECK_GT(key_length, 0); - shortcut_rtl.append(L"+"); + shortcut_rtl.append(ASCIIToUTF16("+")); // Subtracting the size of the shortcut key and 1 for the '+' sign. shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); shortcut.swap(shortcut_rtl); } - return shortcut; + return UTF16ToWide(shortcut); } } // namespace views diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc index 6fa8dee..b1b691f 100644 --- a/views/controls/button/button_dropdown.cc +++ b/views/controls/button/button_dropdown.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "base/utf_string_conversions.h" #include "grit/app_strings.h" #include "views/controls/menu/view_menu_delegate.h" #include "views/widget/widget.h" @@ -165,7 +166,7 @@ void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { //////////////////////////////////////////////////////////////////////////////// std::wstring ButtonDropDown::GetAccessibleDefaultAction() { - return l10n_util::GetString(IDS_APP_ACCACTION_PRESS); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS)); } AccessibilityTypes::Role ButtonDropDown::GetAccessibleRole() { diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 1b94359..e7d746a 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -7,6 +7,7 @@ #include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas.h" #include "grit/app_strings.h" #include "grit/app_resources.h" @@ -256,7 +257,7 @@ void MenuButton::OnMouseExited(const MouseEvent& event) { //////////////////////////////////////////////////////////////////////////////// std::wstring MenuButton::GetAccessibleDefaultAction() { - return l10n_util::GetString(IDS_APP_ACCACTION_PRESS); + return UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS)); } AccessibilityTypes::Role MenuButton::GetAccessibleRole() { diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index cfec12c..17e8ef8 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -34,7 +34,8 @@ class EmptyMenuMenuItem : public MenuItemView { public: explicit EmptyMenuMenuItem(MenuItemView* parent) : MenuItemView(parent, 0, NORMAL) { - SetTitle(l10n_util::GetString(IDS_APP_MENU_EMPTY_SUBMENU)); + SetTitle(UTF16ToWide( + l10n_util::GetStringUTF16(IDS_APP_MENU_EMPTY_SUBMENU))); // Set this so that we're not identified as a normal menu item. SetID(kEmptyMenuItemViewID); SetEnabled(false); diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index d170b50..12f98c1 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -13,6 +13,8 @@ #include "base/callback.h" #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "base/string16.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas.h" #include "grit/app_strings.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -574,36 +576,38 @@ void BitmapScrollBar::ShowContextMenu(View* source, // BitmapScrollBar, Menu::Delegate implementation: std::wstring BitmapScrollBar::GetLabel(int id) const { + int ids_value = 0; switch (id) { case ScrollBarContextMenuCommand_ScrollHere: - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE); + ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE; + break; case ScrollBarContextMenuCommand_ScrollStart: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFTEDGE); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLHOME); + ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFTEDGE + : IDS_APP_SCROLLBAR_CXMENU_SCROLLHOME; + break; case ScrollBarContextMenuCommand_ScrollEnd: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHTEDGE); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLEND); + ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHTEDGE + : IDS_APP_SCROLLBAR_CXMENU_SCROLLEND; + break; case ScrollBarContextMenuCommand_ScrollPageUp: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEUP); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEUP); + ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEUP; + break; case ScrollBarContextMenuCommand_ScrollPageDown: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEDOWN); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEDOWN); + ids_value = IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEDOWN; + break; case ScrollBarContextMenuCommand_ScrollPrev: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFT); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLUP); + ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFT + : IDS_APP_SCROLLBAR_CXMENU_SCROLLUP; + break; case ScrollBarContextMenuCommand_ScrollNext: - if (IsHorizontal()) - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHT); - return l10n_util::GetString(IDS_APP_SCROLLBAR_CXMENU_SCROLLDOWN); + ids_value = IsHorizontal() ? IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHT + : IDS_APP_SCROLLBAR_CXMENU_SCROLLDOWN; + break; + default: + NOTREACHED() << "Invalid BitmapScrollBar Context Menu command!"; } - NOTREACHED() << "Invalid BitmapScrollBar Context Menu command!"; - return L""; + + return ids_value ? UTF16ToWide(l10n_util::GetStringUTF16(ids_value)) : L""; } bool BitmapScrollBar::IsCommandEnabled(int id) const { diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc index 002bb37..b43b678 100644 --- a/views/window/custom_frame_view.cc +++ b/views/window/custom_frame_view.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas.h" #include "gfx/font.h" #include "gfx/path.h" @@ -76,13 +77,14 @@ CustomFrameView::CustomFrameView(Window* frame) ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - close_button_->SetAccessibleName(l10n_util::GetString(IDS_APP_ACCNAME_CLOSE)); + close_button_->SetAccessibleName( + UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE))); // Close button images will be set in LayoutWindowControls(). AddChildView(close_button_); restore_button_->SetAccessibleName( - l10n_util::GetString(IDS_APP_ACCNAME_RESTORE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCNAME_RESTORE))); restore_button_->SetImage(CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_RESTORE)); restore_button_->SetImage(CustomButton::BS_HOT, @@ -92,7 +94,7 @@ CustomFrameView::CustomFrameView(Window* frame) AddChildView(restore_button_); maximize_button_->SetAccessibleName( - l10n_util::GetString(IDS_APP_ACCNAME_MAXIMIZE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE))); maximize_button_->SetImage(CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_MAXIMIZE)); maximize_button_->SetImage(CustomButton::BS_HOT, @@ -102,7 +104,7 @@ CustomFrameView::CustomFrameView(Window* frame) AddChildView(maximize_button_); minimize_button_->SetAccessibleName( - l10n_util::GetString(IDS_APP_ACCNAME_MINIMIZE)); + UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE))); minimize_button_->SetImage(CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_MINIMIZE)); minimize_button_->SetImage(CustomButton::BS_HOT, diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 9dd45ac..8ce2224 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -17,6 +17,7 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas_skia.h" #include "gfx/font.h" #include "grit/app_strings.h" @@ -129,7 +130,7 @@ void DialogClientView::ShowDialogButtons() { std::wstring label = dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_OK); if (label.empty()) - label = l10n_util::GetString(IDS_APP_OK); + label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_OK)); bool is_default_button = (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0; ok_button_ = new DialogButton(this, window(), @@ -148,9 +149,9 @@ void DialogClientView::ShowDialogButtons() { dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_CANCEL); if (label.empty()) { if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) { - label = l10n_util::GetString(IDS_APP_CANCEL); + label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_CANCEL)); } else { - label = l10n_util::GetString(IDS_APP_CLOSE); + label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); } } bool is_default_button = |