diff options
author | yosin@chromium.org <yosin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 06:57:01 +0000 |
---|---|---|
committer | yosin@chromium.org <yosin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 06:57:01 +0000 |
commit | 730718e87bf37f12c934c62ef5cba922527a2db6 (patch) | |
tree | 6413633c8f88b79619825d5a157c41ba58f00b00 /chrome/browser/ui | |
parent | 20f1870eda54d1bde430f2e6b33c9cdf3c0ce4a1 (diff) | |
download | chromium_src-730718e87bf37f12c934c62ef5cba922527a2db6.zip chromium_src-730718e87bf37f12c934c62ef5cba922527a2db6.tar.gz chromium_src-730718e87bf37f12c934c62ef5cba922527a2db6.tar.bz2 |
Change std::wstring to string16 for views::Label and views::Label
Redo for CR=8113031, it failed on linux_chromeos_clang.
Following files are missed in CR=8113031
1 chrome/browser/chromeos/drop_shadow_label.cc
2 chrome/browser/chromeos/drop_shadow_label.h
3 chrome/browser/ui/views/cookie_info_view.cc
4 chrome/browser/ui/views/database_info_view.cc
5 chrome/browser/ui/views/hung_renderer_view.cccc
6 chrome/browser/ui/views/importer/import_lock_dialog_view.cc
7 chrome/browser/ui/views/task_manager_view.cc
8 ui/aura_shell/examples/bubble.cc
9 views/examples/bubble_example.cc
10 views/examples/link_example.cc
11 views/examples/native_theme_button_example.cc
12 views/examples/text_example.cc
13 views/examples/textfield_example.cc
BUG=68267
TEST=no user visible changes
Review URL: http://codereview.chromium.org/8162013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
48 files changed, 281 insertions, 269 deletions
diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc index f6d716b..4df13f6 100644 --- a/chrome/browser/ui/input_window_dialog_win.cc +++ b/chrome/browser/ui/input_window_dialog_win.cc @@ -197,7 +197,7 @@ void ContentView::InitControlLayout() { GridLayout::USE_PREF, kTextfieldWidth, kTextfieldWidth); layout->StartRow(0, 0); - views::Label* label = new views::Label(UTF16ToWideHack(delegate_->label())); + views::Label* label = new views::Label(delegate_->label()); layout->AddView(label); layout->AddView(text_field_); diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index 62176db..a149c46 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -278,7 +278,7 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame, AddChildView(title_icon_); title_icon_->Update(); - title_label_ = new views::Label(std::wstring()); + title_label_ = new views::Label(string16()); title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(title_label_); @@ -691,8 +691,7 @@ void PanelBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) { } void PanelBrowserFrameView::UpdateTitleBar() { - title_label_->SetText( - UTF16ToWideHack(frame_->widget_delegate()->GetWindowTitle())); + title_label_->SetText(frame_->widget_delegate()->GetWindowTitle()); } void PanelBrowserFrameView::OnFocusChanged(bool focused) { diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index f8728ee..b8ddaac 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -52,20 +52,19 @@ namespace { // These are used as placeholder text around the links in the text in the about // dialog. -const wchar_t* kBeginLink = L"BEGIN_LINK"; -const wchar_t* kEndLink = L"END_LINK"; -const wchar_t* kBeginLinkChr = L"BEGIN_LINK_CHR"; -const wchar_t* kBeginLinkOss = L"BEGIN_LINK_OSS"; -const wchar_t* kEndLinkChr = L"END_LINK_CHR"; -const wchar_t* kEndLinkOss = L"END_LINK_OSS"; +const string16 kBeginLink(ASCIIToUTF16("BEGIN_LINK")); +const string16 kEndLink(ASCIIToUTF16("END_LINK")); +const string16 kBeginLinkChr(ASCIIToUTF16("BEGIN_LINK_CHR")); +const string16 kBeginLinkOss(ASCIIToUTF16("BEGIN_LINK_OSS")); +const string16 kEndLinkChr(ASCIIToUTF16("END_LINK_CHR")); +const string16 kEndLinkOss(ASCIIToUTF16("END_LINK_OSS")); // The background bitmap used to draw the background color for the About box // and the separator line (this is the image we will draw the logo on top of). static const SkBitmap* kBackgroundBmp = NULL; // Returns a substring from |text| between start and end. -std::wstring StringSubRange(const std::wstring& text, size_t start, - size_t end) { +string16 StringSubRange(const string16& text, size_t start, size_t end) { DCHECK(end > start); return text.substr(start, end - start); } @@ -164,7 +163,7 @@ void AboutChromeView::Init() { // Add the dialog labels. about_title_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont).DeriveFont(18)); about_title_label_->SetColor(SK_ColorBLACK); @@ -184,15 +183,14 @@ void AboutChromeView::Init() { // The copyright URL portion of the main label. copyright_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT))); + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT)); copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(copyright_label_); - main_text_label_ = new views::Label(L""); + main_text_label_ = new views::Label(string16()); // Figure out what to write in the main label of the About box. - std::wstring text = - UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE)); + string16 text = l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE); chromium_url_appears_first_ = text.find(kBeginLinkChr) < text.find(kBeginLinkOss); @@ -207,20 +205,20 @@ void AboutChromeView::Init() { DCHECK(link1_end != std::wstring::npos); main_label_chunk1_ = text.substr(0, link1); - main_label_chunk2_ = StringSubRange(text, link1_end + wcslen(kEndLinkOss), + main_label_chunk2_ = StringSubRange(text, link1_end + kEndLinkOss.size(), link2); - main_label_chunk3_ = text.substr(link2_end + wcslen(kEndLinkOss)); + main_label_chunk3_ = text.substr(link2_end + kEndLinkOss.size()); // The Chromium link within the main text of the dialog. chromium_url_ = new views::Link( - StringSubRange(text, text.find(kBeginLinkChr) + wcslen(kBeginLinkChr), + StringSubRange(text, text.find(kBeginLinkChr) + kBeginLinkChr.size(), text.find(kEndLinkChr))); AddChildView(chromium_url_); chromium_url_->set_listener(this); // The Open Source link within the main text of the dialog. open_source_url_ = new views::Link( - StringSubRange(text, text.find(kBeginLinkOss) + wcslen(kBeginLinkOss), + StringSubRange(text, text.find(kBeginLinkOss) + kBeginLinkOss.size(), text.find(kEndLinkOss))); AddChildView(open_source_url_); open_source_url_->set_listener(this); @@ -228,9 +226,9 @@ void AboutChromeView::Init() { // Add together all the strings in the dialog for the purpose of calculating // the height of the dialog. The space for the Terms of Service string is not // included (it is added later, if needed). - std::wstring full_text = main_label_chunk1_ + chromium_url_->GetText() + - main_label_chunk2_ + open_source_url_->GetText() + - main_label_chunk3_; + string16 full_text = main_label_chunk1_ + chromium_url_->GetText() + + main_label_chunk2_ + open_source_url_->GetText() + + main_label_chunk3_; dialog_dimensions_ = views::Widget::GetLocalizedContentsSize( IDS_ABOUT_DIALOG_WIDTH_CHARS, @@ -254,17 +252,17 @@ void AboutChromeView::Init() { #if defined(GOOGLE_CHROME_BUILD) std::vector<size_t> url_offsets; - text = UTF16ToWide(l10n_util::GetStringFUTF16(IDS_ABOUT_TERMS_OF_SERVICE, - string16(), - string16(), - &url_offsets)); + text = l10n_util::GetStringFUTF16(IDS_ABOUT_TERMS_OF_SERVICE, + string16(), + string16(), + &url_offsets); main_label_chunk4_ = text.substr(0, url_offsets[0]); main_label_chunk5_ = text.substr(url_offsets[0]); // The Terms of Service URL at the bottom. terms_of_service_url_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_TERMS_OF_SERVICE))); + l10n_util::GetStringUTF16(IDS_TERMS_OF_SERVICE)); AddChildView(terms_of_service_url_); terms_of_service_url_->set_listener(this); @@ -406,16 +404,16 @@ void AboutChromeView::OnPaint(gfx::Canvas* canvas) { gfx::Size position; // Draw the first text chunk and position the Chromium url. view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, - main_label_chunk1_, link1, rect1, &position, text_direction_is_rtl_, - label_bounds, font); + UTF16ToWideHack(main_label_chunk1_), link1, rect1, &position, + text_direction_is_rtl_, label_bounds, font); // Draw the second text chunk and position the Open Source url. view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, - main_label_chunk2_, link2, rect2, &position, text_direction_is_rtl_, - label_bounds, font); + UTF16ToWideHack(main_label_chunk2_), link2, rect2, &position, + text_direction_is_rtl_, label_bounds, font); // Draw the third text chunk (which has no URL associated with it). view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, - main_label_chunk3_, NULL, NULL, &position, text_direction_is_rtl_, - label_bounds, font); + UTF16ToWideHack(main_label_chunk3_), NULL, NULL, &position, + text_direction_is_rtl_, label_bounds, font); #if defined(GOOGLE_CHROME_BUILD) // Insert a line break and some whitespace. @@ -424,12 +422,13 @@ void AboutChromeView::OnPaint(gfx::Canvas* canvas) { // And now the Terms of Service and position the TOS url. view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, - main_label_chunk4_, terms_of_service_url_, &terms_of_service_url_rect_, - &position, text_direction_is_rtl_, label_bounds, font); + UTF16ToWideHack(main_label_chunk4_), terms_of_service_url_, + &terms_of_service_url_rect_, &position, text_direction_is_rtl_, + label_bounds, font); // The last text chunk doesn't have a URL associated with it. view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_, - main_label_chunk5_, NULL, NULL, &position, text_direction_is_rtl_, - label_bounds, font); + UTF16ToWideHack(main_label_chunk5_), NULL, NULL, &position, + text_direction_is_rtl_, label_bounds, font); // Position the TOS URL within the main label. terms_of_service_url_->SetBounds(terms_of_service_url_rect_.x(), @@ -699,11 +698,11 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error")); restart_button_visible_ = false; if (error_code != GOOGLE_UPDATE_DISABLED_BY_POLICY) { - update_label_.SetText(UTF16ToWide( - l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code))); + update_label_.SetText( + l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code)); } else { - update_label_.SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_UPGRADE_DISABLED_BY_POLICY))); + update_label_.SetText( + l10n_util::GetStringUTF16(IDS_UPGRADE_DISABLED_BY_POLICY)); } show_timeout_indicator = true; break; diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h index d8bd35e..ed85ebc 100644 --- a/chrome/browser/ui/views/about_chrome_view.h +++ b/chrome/browser/ui/views/about_chrome_view.h @@ -118,11 +118,11 @@ class AboutChromeView : public views::DialogDelegateView, // The text to display as the main label of the About box. We draw this text // word for word with the help of the WordIterator, and make room for URLs // which are drawn using views::Link. See also |url_offsets_|. - std::wstring main_label_chunk1_; - std::wstring main_label_chunk2_; - std::wstring main_label_chunk3_; - std::wstring main_label_chunk4_; - std::wstring main_label_chunk5_; + string16 main_label_chunk1_; + string16 main_label_chunk2_; + string16 main_label_chunk3_; + string16 main_label_chunk4_; + string16 main_label_chunk5_; // Determines the order of the two links we draw in the main label. bool chromium_url_appears_first_; 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 5b7238a..6da0bce 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -4,6 +4,12 @@ #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h" +#if defined(OS_WIN) +#include <commctrl.h> +#include <dwmapi.h> +#include <objidl.h> +#endif + #include "base/compiler_specific.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" @@ -33,10 +39,6 @@ #include "views/widget/widget.h" #if defined(OS_WIN) -#include <commctrl.h> -#include <dwmapi.h> -#include <objidl.h> - #include "base/win/scoped_gdi_object.h" #if !defined(USE_AURA) #include "views/widget/native_widget_win.h" @@ -148,7 +150,7 @@ class AutocompletePopupContentsView::AutocompletePopupWidget virtual ~AutocompletePopupWidget() {} private: - DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); + DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); }; class AutocompletePopupContentsView::InstantOptInView @@ -163,7 +165,7 @@ class AutocompletePopupContentsView::InstantOptInView SkColorSetRGB(255, 242, 183), SkColorSetRGB(250, 230, 145))) { views::Label* label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_LABEL))); + l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_LABEL)); label->SetFont(label_font); views::GridLayout* layout = new views::GridLayout(this); @@ -211,8 +213,8 @@ class AutocompletePopupContentsView::InstantOptInView views::View* CreateButton(int id, const gfx::Font& font) { // NOTE: we can't use NativeButton as the popup is a layered window and // native buttons don't draw in layered windows. - // TODO: these buttons look crap. Figure out the right border/background to - // use. + // TODO(sky): these buttons look crap. Figure out the right + // border/background to use. views::TextButton* button = new views::TextButton(this, UTF16ToWide(l10n_util::GetStringUTF16(id))); button->set_border(new OptInButtonBorder()); @@ -320,7 +322,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() { // we have enough row views. size_t child_rv_count = child_count(); if (opt_in_view_) { - DCHECK(child_rv_count > 0); + DCHECK_GT(child_rv_count, 0u); child_rv_count--; } for (size_t i = 0; i < model_->result().size(); ++i) { @@ -373,8 +375,8 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() { if (!popup_.get()) { // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose // focus, thereby closing (and destroying) the popup. - // TODO: this won't be needed once we close the omnibox on input window - // showing. + // TODO(sky): this won't be needed once we close the omnibox on input + // window showing. return; } popup_->Show(); diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc index 2b7df41..43b7061 100644 --- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc +++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" +#include <algorithm> + #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/ui/browser.h" @@ -58,6 +60,7 @@ gfx::Rect GetCenteredAndScaledRect(int src_width, int src_height, // Delegate to callback when the highlight state of a control changes. class HighlightDelegate { public: + virtual ~HighlightDelegate() {} virtual void OnHighlightStateChanged() = 0; }; @@ -68,7 +71,7 @@ class EditProfileLink : public views::Link { public: explicit EditProfileLink(const string16& title, HighlightDelegate* delegate) - : views::Link(UTF16ToWideHack(title)), + : views::Link(title), delegate_(delegate), state_(views::CustomButton::BS_NORMAL) { } @@ -121,7 +124,7 @@ class ProfileItemView : public views::CustomButton, AddChildView(image_view_); // Add a label to show the profile name. - name_label_ = new views::Label(UTF16ToWideHack(item_.name)); + name_label_ = new views::Label(item_.name); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); int style = item_.active ? gfx::Font::BOLD : 0; @@ -131,7 +134,7 @@ class ProfileItemView : public views::CustomButton, AddChildView(name_label_); // Add a label to show the sync state. - sync_state_label_ = new views::Label(UTF16ToWideHack(item_.sync_state)); + sync_state_label_ = new views::Label(item_.sync_state); const int kStateFontDelta = -1; sync_state_label_->SetFont(base_font.DeriveFont(kStateFontDelta)); sync_state_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -247,7 +250,7 @@ class ProfileItemView : public views::CustomButton, views::Label* sync_state_label_; }; -} // namespace +} // namespace AvatarMenuBubbleView::AvatarMenuBubbleView(Browser* browser) : add_profile_link_(NULL), @@ -365,8 +368,8 @@ void AvatarMenuBubbleView::OnAvatarMenuModelChanged( separator_ = new views::Separator(); AddChildView(separator_); - add_profile_link_ = new views::Link(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK))); + add_profile_link_ = new views::Link( + l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); add_profile_link_->set_listener(this); add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); add_profile_link_->SetNormalColor(SkColorSetRGB(0, 0x79, 0xda)); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc index 85c3c5c..e279e8d 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" +#include <algorithm> + #include "base/utf_string_conversions.h" #include "chrome/browser/defaults.h" #include "chrome/browser/themes/theme_service.h" @@ -26,12 +28,12 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate) baseline_(-1), updated_colors_(false) { instructions_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS))); + l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS)); AddChildView(instructions_); if (browser_defaults::kShowImportOnBookmarkBar) { import_link_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK))); + l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)); // We don't want the link to alter tab navigation. import_link_->set_focusable(false); import_link_->set_listener(this); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 108d2f4..f51c286 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -190,8 +190,8 @@ void BookmarkBubbleView::Init() { initialized = true; } - remove_link_ = new views::Link(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK))); + remove_link_ = new views::Link(l10n_util::GetStringUTF16( + IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); remove_link_->set_listener(this); edit_button_ = new views::NativeTextButton( @@ -203,18 +203,17 @@ void BookmarkBubbleView::Init() { close_button_->SetIsDefault(true); views::Label* combobox_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT))); + l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT)); parent_combobox_ = new views::Combobox(&parent_model_); parent_combobox_->SetSelectedItem(parent_model_.node_parent_index()); parent_combobox_->set_listener(this); - parent_combobox_->SetAccessibleName( - WideToUTF16Hack(combobox_label->GetText())); + parent_combobox_->SetAccessibleName(combobox_label->GetText()); views::Label* title_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( + l10n_util::GetStringUTF16( newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : - IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK))); + IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK)); title_label->SetFont( ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); title_label->SetColor(kTitleColor); @@ -257,8 +256,8 @@ void BookmarkBubbleView::Init() { layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); layout->StartRow(0, 2); - layout->AddView(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)))); + layout->AddView(new views::Label( + l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT))); title_tf_ = new views::Textfield(); title_tf_->SetText(GetTitle()); layout->AddView(title_tf_); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 5899988..a1ebe0a 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -313,8 +313,8 @@ void BookmarkEditorView::Init() { title_tf_.SetController(this); title_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL))); - title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText())); + l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); + title_tf_.SetAccessibleName(title_label_->GetText()); if (show_tree_) { tree_view_ = new views::TreeView(); @@ -368,7 +368,7 @@ void BookmarkEditorView::Init() { if (details_.type != EditDetails::NEW_FOLDER) { url_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL))); + l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); std::string languages = profile_ ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) @@ -383,7 +383,7 @@ void BookmarkEditorView::Init() { url_tf_ = new views::Textfield; url_tf_->SetText(UTF16ToWide(url_text)); url_tf_->SetController(this); - url_tf_->SetAccessibleName(WideToUTF16Hack(url_label_->GetText())); + url_tf_->SetAccessibleName(url_label_->GetText()); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index ba23cc6..df6ed68 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -240,8 +240,8 @@ views::View* CollectedCookiesWin::CreateAllowedPane() { TabSpecificContentSettings* content_settings = wrapper_->content_settings(); // Create the controls that go into the pane. - allowed_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL))); + allowed_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)); allowed_cookies_tree_model_.reset( content_settings->GetAllowedCookiesTreeModel()); allowed_cookies_tree_ = new views::TreeView(); @@ -292,10 +292,10 @@ views::View* CollectedCookiesWin::CreateBlockedPane() { // Create the controls that go into the pane. blocked_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( + l10n_util::GetStringUTF16( host_content_settings_map->BlockThirdPartyCookies() ? IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : - IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL))); + IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)); blocked_label_->SetMultiLine(true); blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); blocked_cookies_tree_model_.reset( diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index ff1d7ec..29332a7 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -8,6 +8,11 @@ #include <gdk/gdk.h> #endif +#include <algorithm> +#include <string> +#include <set> +#include <vector> + #include "base/utf_string_conversions.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/profiles/profile.h" @@ -194,7 +199,7 @@ void ContentSettingBubbleContents::InitControlLayout() { bool bubble_content_empty = true; if (!bubble_content.title.empty()) { - views::Label* title_label = new views::Label(UTF8ToWide( + views::Label* title_label = new views::Label(UTF8ToUTF16( bubble_content.title)); layout->StartRow(0, single_column_set_id); layout->AddView(title_label); @@ -207,10 +212,10 @@ void ContentSettingBubbleContents::InitControlLayout() { layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); for (std::set<std::string>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { - std::wstring name = UTF16ToWide( - webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); + string16 name = + webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it); if (name.empty()) - name = UTF8ToWide(*it); + name = UTF8ToUTF16(*it); layout->StartRow(0, single_column_set_id); layout->AddView(new views::Label(name)); bubble_content_empty = false; @@ -236,7 +241,7 @@ void ContentSettingBubbleContents::InitControlLayout() { layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->StartRow(0, popup_column_set_id); - views::Link* link = new views::Link(UTF8ToWide(i->title)); + views::Link* link = new views::Link(UTF8ToUTF16(i->title)); link->set_listener(this); link->SetElideInMiddle(true); popup_links_[link] = i - bubble_content.popup_items.begin(); @@ -281,20 +286,20 @@ void ContentSettingBubbleContents::InitControlLayout() { bubble_content.domain_lists.begin(); i != bubble_content.domain_lists.end(); ++i) { layout->StartRow(0, single_column_set_id); - views::Label* section_title = new views::Label(UTF8ToWide(i->title)); + views::Label* section_title = new views::Label(UTF8ToUTF16(i->title)); section_title->SetMultiLine(true); section_title->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(section_title, 1, 1, GridLayout::FILL, GridLayout::LEADING); for (std::set<std::string>::const_iterator j = i->hosts.begin(); j != i->hosts.end(); ++j) { layout->StartRow(0, indented_single_column_set_id); - layout->AddView(new views::Label(UTF8ToWide(*j), domain_font)); + layout->AddView(new views::Label(UTF8ToUTF16(*j), domain_font)); } bubble_content_empty = false; } if (!bubble_content.custom_link.empty()) { - custom_link_ = new views::Link(UTF8ToWide(bubble_content.custom_link)); + custom_link_ = new views::Link(UTF8ToUTF16(bubble_content.custom_link)); custom_link_->SetEnabled(bubble_content.custom_link_enabled); custom_link_->set_listener(this); if (!bubble_content_empty) @@ -323,7 +328,7 @@ void ContentSettingBubbleContents::InitControlLayout() { GridLayout::USE_PREF, 0, 0); layout->StartRow(0, double_column_set_id); - manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); + manage_link_ = new views::Link(UTF8ToUTF16(bubble_content.manage_link)); manage_link_->set_listener(this); layout->AddView(manage_link_); diff --git a/chrome/browser/ui/views/cookie_info_view.cc b/chrome/browser/ui/views/cookie_info_view.cc index 4507366..7e5f5e8 100644 --- a/chrome/browser/ui/views/cookie_info_view.cc +++ b/chrome/browser/ui/views/cookie_info_view.cc @@ -186,25 +186,25 @@ void CookieInfoView::Init() { set_border(border); name_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL)); name_value_field_ = new views::Textfield; content_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CONTENT_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CONTENT_LABEL)); content_value_field_ = new views::Textfield; domain_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL)); domain_value_field_ = new views::Textfield; path_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_PATH_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_PATH_LABEL)); path_value_field_ = new views::Textfield; send_for_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_LABEL)); send_for_value_field_ = new views::Textfield; created_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CREATED_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CREATED_LABEL)); created_value_field_ = new views::Textfield; expires_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL)); if (editable_expiration_date_) expires_value_combobox_ = new views::Combobox(this); else diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 0aee131..4f42a13 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -93,7 +93,7 @@ void AppInfoView::Init(const string16& title_text, icon_->SetImage(icon); icon_->SetImageSize(gfx::Size(kAppIconSize, kAppIconSize)); - title_ = new views::Label(UTF16ToWide(title_text)); + title_ = new views::Label(title_text); title_->SetMultiLine(true); title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); title_->SetFont(ResourceBundle::GetSharedInstance().GetFont( @@ -110,9 +110,9 @@ void AppInfoView::PrepareDescriptionLabel(const string16& description) { DCHECK(!description.empty()); static const size_t kMaxLength = 200; - static const wchar_t* const kEllipsis = L" ... "; + static const string16 kEllipsis(ASCIIToUTF16(" ... ")); - std::wstring text = UTF16ToWide(description); + string16 text = description; if (text.length() > kMaxLength) { text = text.substr(0, kMaxLength); text += kEllipsis; @@ -152,7 +152,7 @@ void AppInfoView::SetupLayout() { void AppInfoView::UpdateText(const string16& title, const string16& description) { - title_->SetText(UTF16ToWideHack(title)); + title_->SetText(title); PrepareDescriptionLabel(description); SetupLayout(); @@ -249,7 +249,7 @@ void CreateApplicationShortcutView::InitControls() { app_info_ = new AppInfoView(shortcut_info_.title, shortcut_info_.description, shortcut_info_.favicon); create_shortcuts_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL))); + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); create_shortcuts_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); desktop_check_box_ = AddCheckbox(UTF16ToWide( diff --git a/chrome/browser/ui/views/database_info_view.cc b/chrome/browser/ui/views/database_info_view.cc index 8f1e7c2..71db3eb 100644 --- a/chrome/browser/ui/views/database_info_view.cc +++ b/chrome/browser/ui/views/database_info_view.cc @@ -81,19 +81,17 @@ void DatabaseInfoView::Init() { set_border(border); views::Label* name_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL)); name_value_field_ = new views::Textfield; views::Label* description_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL)); description_value_field_ = new views::Textfield; views::Label* size_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL))); + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)); size_value_field_ = new views::Textfield; views::Label* last_modified_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL))); + l10n_util::GetStringUTF16( + IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)); last_modified_value_field_ = new views::Textfield; using views::GridLayout; diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc index 8bfbfad..cd6fba0 100644 --- a/chrome/browser/ui/views/default_search_view.cc +++ b/chrome/browser/ui/views/default_search_view.cc @@ -59,7 +59,7 @@ void GetShortNameAndLogoId(PrefService* prefs, views::Label* CreateProviderLabel(int message_id) { views::Label* choice_label = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id))); + new views::Label(l10n_util::GetStringUTF16(message_id)); choice_label->SetColor(SK_ColorBLACK); choice_label->SetFont( choice_label->font().DeriveFont(1, gfx::Font::NORMAL)); @@ -279,9 +279,9 @@ void DefaultSearchView::SetupControls(PrefService* prefs) { // Add text informing the user about the requested default change. layout->StartRowWithPadding(0, kPaddedWholeDialogViewSetId, 1, views::kLabelToControlVerticalSpacing); - Label* summary_label = new Label(UTF16ToWide(l10n_util::GetStringFUTF16( + Label* summary_label = new Label(l10n_util::GetStringFUTF16( IDS_DEFAULT_SEARCH_SUMMARY, - WideToUTF16(proposed_short_name)))); + WideToUTF16(proposed_short_name))); summary_label->SetColor(SK_ColorBLACK); summary_label->SetFont( summary_label->font().DeriveFont(1, gfx::Font::NORMAL)); diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc index 11d5293..660a387 100644 --- a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc +++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc @@ -28,27 +28,27 @@ DownloadInProgressDialogView::DownloadInProgressDialogView(Browser* browser) int download_count = browser->profile()->GetDownloadManager()-> in_progress_count(); - std::wstring warning_text; - std::wstring explanation_text; + string16 warning_text; + string16 explanation_text; if (download_count == 1) { - warning_text = UTF16ToWide(l10n_util::GetStringFUTF16( + warning_text = l10n_util::GetStringFUTF16( IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, - product_name_)); - explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16( + product_name_); + explanation_text = l10n_util::GetStringFUTF16( IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION, - product_name_)); + product_name_); ok_button_text_ = l10n_util::GetStringUTF16( IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); cancel_button_text_ = l10n_util::GetStringUTF16( IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); } else { - warning_text = UTF16ToWide(l10n_util::GetStringFUTF16( + warning_text = l10n_util::GetStringFUTF16( IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING, product_name_, - UTF8ToUTF16(base::IntToString(download_count)))); - explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16( + UTF8ToUTF16(base::IntToString(download_count))); + explanation_text = l10n_util::GetStringFUTF16( IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION, - product_name_)); + product_name_); ok_button_text_ = l10n_util::GetStringUTF16( IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL); cancel_button_text_ = l10n_util::GetStringUTF16( diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index b7ffde5..36ab280 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/download/download_item_view.h" +#include <algorithm> #include <vector> #include "base/callback.h" @@ -276,7 +277,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download, } } - dangerous_download_label_ = new views::Label(UTF16ToWide(dangerous_label)); + dangerous_download_label_ = new views::Label(dangerous_label); dangerous_download_label_->SetMultiLine(true); dangerous_download_label_->SetHorizontalAlignment( views::Label::ALIGN_LEFT); @@ -1034,7 +1035,7 @@ void DownloadItemView::SizeLabelToMinWidth() { if (dangerous_download_label_sized_) return; - string16 text = WideToUTF16(dangerous_download_label_->GetText()); + string16 text = dangerous_download_label_->GetText(); TrimWhitespace(text, TRIM_ALL, &text); DCHECK_EQ(string16::npos, text.find('\n')); @@ -1065,7 +1066,7 @@ void DownloadItemView::SizeLabelToMinWidth() { current_text.replace(pos - 1, 1, 1, char16('\n')); else current_text.insert(pos, 1, char16('\n')); - dangerous_download_label_->SetText(UTF16ToWide(current_text)); + dangerous_download_label_->SetText(current_text); size = dangerous_download_label_->GetPreferredSize(); if (min_width == -1) @@ -1073,7 +1074,7 @@ void DownloadItemView::SizeLabelToMinWidth() { // If the width is growing again, it means we passed the optimal width spot. if (size.width() > min_width) { - dangerous_download_label_->SetText(UTF16ToWide(prev_text)); + dangerous_download_label_->SetText(prev_text); break; } else { min_width = size.width(); @@ -1107,7 +1108,7 @@ bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { void DownloadItemView::UpdateAccessibleName() { string16 new_name; if (download_->safety_state() == DownloadItem::DANGEROUS) { - new_name = WideToUTF16Hack(dangerous_download_label_->GetText()); + new_name = dangerous_download_label_->GetText(); } else { new_name = status_text_ + char16(' ') + download_->GetFileNameToReportUser().LossyDisplayName(); diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index f60424a..c2c3338 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/download/download_shelf_view.h" #include <algorithm> +#include <vector> #include "base/logging.h" #include "base/utf_string_conversions.h" @@ -106,7 +107,7 @@ void DownloadShelfView::Init() { AddChildView(arrow_image_); show_all_view_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS))); + l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); show_all_view_->set_listener(this); AddChildView(show_all_view_); diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc index 9d75625..c97f7be 100644 --- a/chrome/browser/ui/views/edit_search_engine_dialog.cc +++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc @@ -226,7 +226,7 @@ void EditSearchEngineDialog::Init() { views::Label* EditSearchEngineDialog::CreateLabel(int message_id) { views::Label* label = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id))); + new views::Label(l10n_util::GetStringUTF16(message_id)); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); return label; } diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc index cdbad68..a1270eb 100644 --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc @@ -162,8 +162,8 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( layout->StartRow(0, column_set_id); - views::Label* heading = new views::Label(UTF16ToWide( - prompt.GetHeading(extension->name()))); + views::Label* heading = new views::Label( + prompt.GetHeading(extension->name())); heading->SetFont(heading->font().DeriveFont(kHeadingFontSizeDelta, gfx::Font::BOLD)); heading->SetMultiLine(true); @@ -199,8 +199,7 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( layout->AddView(rating); prompt.AppendRatingStars(AddResourceIcon, rating); - views::Label* rating_count = new views::Label( - UTF16ToWide(prompt.GetRatingCount())); + views::Label* rating_count = new views::Label(prompt.GetRatingCount()); rating_count->SetFont( rating_count->font().DeriveFont(kRatingFontSizeDelta)); // Add some space between the stars and the rating count. @@ -208,15 +207,14 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( rating->AddChildView(rating_count); layout->StartRow(0, column_set_id); - views::Label* user_count = new views::Label( - UTF16ToWide(prompt.GetUserCount())); + views::Label* user_count = new views::Label(prompt.GetUserCount()); user_count->SetColor(SK_ColorGRAY); user_count->SetFont(user_count->font().DeriveFont(kRatingFontSizeDelta)); layout->AddView(user_count); layout->StartRow(0, column_set_id); - views::Link* store_link = new views::Link(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_STORE_LINK))); + views::Link* store_link = new views::Link( + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_STORE_LINK)); store_link->SetFont(store_link->font().DeriveFont(kRatingFontSizeDelta)); store_link->set_listener(this); layout->AddView(store_link); @@ -233,8 +231,8 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( } layout->StartRow(0, column_set_id); - views::Label* permissions_header = new views::Label(UTF16ToWide( - prompt.GetPermissionsHeader())); + views::Label* permissions_header = new views::Label( + prompt.GetPermissionsHeader()); permissions_header->SetMultiLine(true); permissions_header->SetHorizontalAlignment(views::Label::ALIGN_LEFT); permissions_header->SizeToFit(left_column_width); @@ -244,7 +242,7 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->StartRow(0, column_set_id); views::Label* permission_label = new views::Label( - UTF16ToWide(prompt.GetPermission(i))); + prompt.GetPermission(i)); permission_label->SetMultiLine(true); permission_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); permission_label->SizeToFit(left_column_width); diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 31d4cc4..358b384 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" #include <algorithm> +#include <string> #include "base/i18n/rtl.h" #include "base/message_loop.h" @@ -76,7 +77,7 @@ void ShowExtensionInstalledBubble( ExtensionInstalledBubble::Show(extension, browser, icon); } -} // namespace browser +} // namespace browser // InstalledBubbleContent is the content view which is placed in the // ExtensionInstalledBubble. It displays the install icon and explanatory @@ -108,9 +109,9 @@ class InstalledBubbleContent : public views::View, string16 extension_name = UTF8ToUTF16(extension->name()); base::i18n::AdjustStringForLocaleDirection(&extension_name); - heading_ = new views::Label(UTF16ToWide( + heading_ = new views::Label( l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, - extension_name))); + extension_name)); heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); heading_->SetMultiLine(true); heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -118,8 +119,8 @@ class InstalledBubbleContent : public views::View, switch (type_) { case ExtensionInstalledBubble::PAGE_ACTION: { - info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO))); + info_ = new views::Label(l10n_util::GetStringUTF16( + IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); info_->SetFont(font); info_->SetMultiLine(true); info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -127,9 +128,9 @@ class InstalledBubbleContent : public views::View, break; } case ExtensionInstalledBubble::OMNIBOX_KEYWORD: { - info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( + info_ = new views::Label(l10n_util::GetStringFUTF16( IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, - UTF8ToUTF16(extension->omnibox_keyword())))); + UTF8ToUTF16(extension->omnibox_keyword()))); info_->SetFont(font); info_->SetMultiLine(true); info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -137,8 +138,8 @@ class InstalledBubbleContent : public views::View, break; } case ExtensionInstalledBubble::APP: { - views::Link* link = new views::Link(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO))); + views::Link* link = new views::Link( + l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO)); link->set_listener(this); manage_ = link; manage_->SetFont(font); @@ -152,8 +153,8 @@ class InstalledBubbleContent : public views::View, } if (type_ != ExtensionInstalledBubble::APP) { - manage_ = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); + manage_ = new views::Label( + 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/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index 6c1be1d..e8dd48c 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -149,9 +149,9 @@ ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView( icon_->SetImage(*icon); AddChildView(icon_); - heading_ = new views::Label(UTF16ToWide( + heading_ = new views::Label( l10n_util::GetStringFUTF16(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, - UTF8ToUTF16(extension->name())))); + UTF8ToUTF16(extension->name()))); heading_->SetMultiLine(true); AddChildView(heading_); } diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc index 1aa049d..a0a78cf 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc @@ -152,8 +152,8 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, message_text, std::wstring(), kMessageWidth); - message_box_view_->SetCheckBoxLabel(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT))); + message_box_view_->SetCheckBoxLabel( + l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); HWND root_hwnd; if (tab_contents_) { diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index aba1533..9152f28 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -167,7 +167,7 @@ string16 FindBarView::GetFindSelectedText() const { } string16 FindBarView::GetMatchCountText() const { - return WideToUTF16Hack(match_count_text_->GetText()); + return match_count_text_->GetText(); } void FindBarView::UpdateForResult(const FindNotificationDetails& result, @@ -184,17 +184,17 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, } if (!find_text.empty() && have_valid_range) { - match_count_text_->SetText(UTF16ToWide( + match_count_text_->SetText( l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT, base::IntToString16(result.active_match_ordinal()), - base::IntToString16(result.number_of_matches())))); + base::IntToString16(result.number_of_matches()))); UpdateMatchCountAppearance(result.number_of_matches() == 0 && result.final_update()); } else { // If there was no text entered, we don't show anything in the result count // area. - match_count_text_->SetText(std::wstring()); + match_count_text_->SetText(string16()); UpdateMatchCountAppearance(false); } @@ -207,7 +207,7 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, } void FindBarView::ClearMatchCount() { - match_count_text_->SetText(L""); + match_count_text_->SetText(string16()); UpdateMatchCountAppearance(false); Layout(); SchedulePaint(); diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index 14428d5..fa1695f 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -109,25 +109,23 @@ FirstRunBubbleView::FirstRunBubbleView(FirstRunBubble* bubble_window, const gfx::Font& font = ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); - label1_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_TITLE))); + label1_ = new views::Label(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_TITLE)); label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(label1_); gfx::Size ps = GetPreferredSize(); - label2_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT))); + label2_ = new views::Label(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT)); label2_->SetMultiLine(true); label2_->SetFont(font); label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); label2_->SizeToFit(ps.width() - kBubblePadding * 2); AddChildView(label2_); - std::wstring question_str = UTF16ToWide(l10n_util::GetStringFUTF16( + string16 question_str = l10n_util::GetStringFUTF16( IDS_FR_BUBBLE_QUESTION, - GetDefaultSearchEngineName(profile))); + GetDefaultSearchEngineName(profile)); label3_ = new views::Label(question_str); label3_->SetMultiLine(true); label3_->SetFont(font); @@ -275,14 +273,14 @@ FirstRunOEMBubbleView::FirstRunOEMBubbleView(FirstRunBubble* bubble_window, const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); label1_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_1))); + l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_1)); label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); label1_->SetColor(SK_ColorRED); label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(label1_); label2_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_2))); + l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_2)); label2_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(label2_); @@ -290,7 +288,7 @@ FirstRunOEMBubbleView::FirstRunOEMBubbleView(FirstRunBubble* bubble_window, gfx::Size ps = GetPreferredSize(); label3_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_SUBTEXT))); + l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_SUBTEXT)); label3_->SetMultiLine(true); label3_->SetFont(font); label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -421,9 +419,9 @@ FirstRunMinimalBubbleView::FirstRunMinimalBubbleView( const gfx::Font& font = ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); - label1_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( + label1_ = new views::Label(l10n_util::GetStringFUTF16( IDS_FR_SE_BUBBLE_TITLE, - GetDefaultSearchEngineName(profile_)))); + GetDefaultSearchEngineName(profile_))); label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(label1_); @@ -431,7 +429,7 @@ FirstRunMinimalBubbleView::FirstRunMinimalBubbleView( gfx::Size ps = GetPreferredSize(); label2_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT))); + l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT)); label2_->SetMultiLine(true); label2_->SetFont(font); label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc index f3a9005..1ab3f42 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.cc +++ b/chrome/browser/ui/views/first_run_search_engine_view.cc @@ -325,8 +325,8 @@ void FirstRunSearchEngineView::SetupControls() { int label_width = GetPreferredSize().width() - 2 * views::kPanelHorizMargin; // Add title and text asking the user to choose a search engine: - title_label_ = new Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_FR_SEARCH_MAIN_LABEL))); + title_label_ = new Label(l10n_util::GetStringUTF16( + IDS_FR_SEARCH_MAIN_LABEL)); title_label_->SetColor(SK_ColorBLACK); title_label_->SetFont(title_label_->font().DeriveFont(3, gfx::Font::BOLD)); title_label_->SetMultiLine(true); @@ -334,9 +334,9 @@ void FirstRunSearchEngineView::SetupControls() { title_label_->SizeToFit(label_width); AddChildView(title_label_); - text_label_ = new Label(UTF16ToWide(l10n_util::GetStringFUTF16( + text_label_ = new Label(l10n_util::GetStringFUTF16( IDS_FR_SEARCH_TEXT, - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); text_label_->SetColor(SK_ColorBLACK); text_label_->SetFont(text_label_->font().DeriveFont(1, gfx::Font::NORMAL)); text_label_->SetMultiLine(true); diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc index 06051ddc6..239dbf4 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc @@ -47,11 +47,10 @@ FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView( link_.set_parent_owned(false); #if !defined(OS_CHROMEOS) link_.SetText( - UTF16ToWide(l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE, - WideToUTF16(accelerator)))); + l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE, + WideToUTF16(accelerator))); #else - link_.SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE))); + link_.SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); #endif link_.set_listener(bubble); link_.SetFont(ResourceBundle::GetSharedInstance().GetFont( diff --git a/chrome/browser/ui/views/global_error_bubble_view.cc b/chrome/browser/ui/views/global_error_bubble_view.cc index ff9be84..234181f 100644 --- a/chrome/browser/ui/views/global_error_bubble_view.cc +++ b/chrome/browser/ui/views/global_error_bubble_view.cc @@ -31,7 +31,7 @@ const int kTitleHorizontalPadding = 3; // The vertical offset of the wrench bubble from the wrench menu button. const int kWrenchBubblePointOffsetY = 6; -} // namespace +} // namespace GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser, GlobalError* error) @@ -43,15 +43,13 @@ GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser, image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); string16 title_string(error_->GetBubbleViewTitle()); - scoped_ptr<views::Label> title_label( - new views::Label(UTF16ToWideHack(title_string))); + scoped_ptr<views::Label> title_label(new views::Label(title_string)); title_label->SetMultiLine(true); title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); title_label->SetFont(title_label->font().DeriveFont(1)); string16 message_string(error_->GetBubbleViewMessage()); - scoped_ptr<views::Label> message_label( - new views::Label(UTF16ToWideHack(message_string))); + scoped_ptr<views::Label> message_label(new views::Label(message_string)); message_label->SetMultiLine(true); message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index be07001..c1a6e71 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -453,7 +453,7 @@ void HungRendererDialogView::Init() { frozen_icon_view_->SetImage(frozen_icon_); info_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER))); + l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER)); info_label_->SetMultiLine(true); info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc index 1c6382f..f8f68df 100644 --- a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc +++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc @@ -41,7 +41,7 @@ ImportLockDialogView::ImportLockDialogView(ImporterHost* importer_host) : description_label_(NULL), importer_host_(importer_host) { description_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT))); + l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); description_label_->SetMultiLine(true); description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(description_label_); diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc index 62a4625..9767b99 100644 --- a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc +++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc @@ -30,16 +30,16 @@ ImportProgressDialogView::ImportProgressDialogView( state_passwords_(new views::CheckmarkThrobber), state_history_(new views::CheckmarkThrobber), state_cookies_(new views::CheckmarkThrobber), - label_bookmarks_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS)))), - label_searches_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_SEARCH)))), - label_passwords_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS)))), - label_history_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_HISTORY)))), - label_cookies_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_COOKIES)))), + label_bookmarks_(new views::Label( + l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS))), + label_searches_(new views::Label( + l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_SEARCH))), + label_passwords_(new views::Label( + l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS))), + label_history_(new views::Label( + l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_HISTORY))), + label_cookies_(new views::Label( + l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_COOKIES))), parent_window_(parent_window), items_(items), importer_host_(importer_host), @@ -288,7 +288,7 @@ void ShowImportProgressDialog(HWND parent_window, const SourceProfile& source_profile, Profile* target_profile, bool first_run) { - DCHECK(items != 0); + DCHECK_NE(items, 0u); ImportProgressDialogView* progress_view = new ImportProgressDialogView( parent_window, items, diff --git a/chrome/browser/ui/views/indexed_db_info_view.cc b/chrome/browser/ui/views/indexed_db_info_view.cc index a617c63..1cc7f31 100644 --- a/chrome/browser/ui/views/indexed_db_info_view.cc +++ b/chrome/browser/ui/views/indexed_db_info_view.cc @@ -75,15 +75,15 @@ void IndexedDBInfoView::Init() { kIndexedDBInfoViewBorderSize, border_color); set_border(border); - views::Label* origin_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL))); + views::Label* origin_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL)); origin_value_field_ = new views::Textfield; - views::Label* size_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL))); + views::Label* size_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)); size_value_field_ = new views::Textfield; - views::Label* last_modified_label = new views::Label(UTF16ToWide( + views::Label* last_modified_label = new views::Label( l10n_util::GetStringUTF16( - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL))); + IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)); last_modified_value_field_ = new views::Textfield; using views::GridLayout; diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index 6d8209c..5dcb4df 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -4,6 +4,10 @@ #include "chrome/browser/ui/views/infobars/infobar_view.h" +#if defined(OS_WIN) +#include <shellapi.h> +#endif + #include <algorithm> #include "base/memory/scoped_ptr.h" @@ -33,8 +37,6 @@ #include "views/window/non_client_view.h" #if defined(OS_WIN) -#include <shellapi.h> - #include "base/win/win_util.h" #include "base/win/windows_version.h" #include "ui/base/win/hwnd_util.h" @@ -76,7 +78,7 @@ InfoBarView::~InfoBarView() { // static views::Label* InfoBarView::CreateLabel(const string16& text) { - views::Label* label = new views::Label(UTF16ToWideHack(text), + views::Label* label = new views::Label(text, ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); label->SetColor(SK_ColorBLACK); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -88,7 +90,7 @@ views::Link* InfoBarView::CreateLink(const string16& text, views::LinkListener* listener, const SkColor& background_color) { views::Link* link = new views::Link; - link->SetText(UTF16ToWideHack(text)); + link->SetText(text); link->SetFont( ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); diff --git a/chrome/browser/ui/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc index 673dfe9..0bc6869 100644 --- a/chrome/browser/ui/views/instant_confirm_view.cc +++ b/chrome/browser/ui/views/instant_confirm_view.cc @@ -22,12 +22,12 @@ InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) { views::Label* description_label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_MESSAGE))); + 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( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE))); + l10n_util::GetStringUTF16(IDS_LEARN_MORE)); learn_more_link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); learn_more_link->set_listener(this); diff --git a/chrome/browser/ui/views/local_storage_info_view.cc b/chrome/browser/ui/views/local_storage_info_view.cc index 8bbc580..21327f4 100644 --- a/chrome/browser/ui/views/local_storage_info_view.cc +++ b/chrome/browser/ui/views/local_storage_info_view.cc @@ -76,15 +76,15 @@ void LocalStorageInfoView::Init() { kLocalStorageInfoViewBorderSize, border_color); set_border(border); - views::Label* origin_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL))); + views::Label* origin_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL)); origin_value_field_ = new views::Textfield; - views::Label* size_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL))); + views::Label* size_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)); size_value_field_ = new views::Textfield; - views::Label* last_modified_label = new views::Label(UTF16ToWide( + views::Label* last_modified_label = new views::Label( l10n_util::GetStringUTF16( - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL))); + IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)); last_modified_value_field_ = new views::Textfield; using views::GridLayout; diff --git a/chrome/browser/ui/views/local_storage_set_item_info_view.cc b/chrome/browser/ui/views/local_storage_set_item_info_view.cc index 30bdbe5..93a1c713 100644 --- a/chrome/browser/ui/views/local_storage_set_item_info_view.cc +++ b/chrome/browser/ui/views/local_storage_set_item_info_view.cc @@ -74,14 +74,14 @@ void LocalStorageSetItemInfoView::Init() { // TODO(jorlow): These strings are not quite right, but we're post-freeze. // http://crbug.com/68688 - views::Label* host_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL))); + views::Label* host_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL)); host_value_field_ = new views::Textfield; - views::Label* key_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_KEY_LABEL))); + views::Label* key_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_KEY_LABEL)); key_value_field_ = new views::Textfield; - views::Label* value_label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_VALUE_LABEL))); + views::Label* value_label = new views::Label( + l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_VALUE_LABEL)); value_value_field_ = new views::Textfield; using views::GridLayout; diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index e7f426c..d8e3e38 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -39,7 +40,7 @@ void IconLabelBubbleView::SetFont(const gfx::Font& font) { label_->SetFont(font); } -void IconLabelBubbleView::SetLabel(const std::wstring& label) { +void IconLabelBubbleView::SetLabel(const string16& label) { label_->SetText(label); } diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h index b8cd71c..38458f5 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h @@ -8,6 +8,7 @@ #include <string> +#include "base/string16.h" #include "ui/gfx/size.h" #include "views/painter.h" #include "views/view.h" @@ -34,7 +35,7 @@ class IconLabelBubbleView : public views::View { virtual ~IconLabelBubbleView(); void SetFont(const gfx::Font& font); - void SetLabel(const std::wstring& label); + void SetLabel(const string16& label); void SetImage(const SkBitmap& bitmap); void set_is_extension_icon(bool is_extension_icon) { is_extension_icon_ = is_extension_icon; 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 6a588d8..699abe8 100644 --- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc +++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" +#include <vector> + #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -65,12 +67,11 @@ void KeywordHintView::SetKeyword(const string16& keyword) { &is_extension_keyword); int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; - const std::wstring keyword_hint = - UTF16ToWide(l10n_util::GetStringFUTF16( - message_id, - string16(), - short_name, - &content_param_offsets)); + const string16 keyword_hint = l10n_util::GetStringFUTF16( + message_id, + string16(), + 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/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 9eba4ae..5f8fdcb 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -8,6 +8,9 @@ #include <gtk/gtk.h> #endif +#include <algorithm> +#include <map> + #include "base/command_line.h" #include "base/stl_util.h" #include "base/utf_string_conversions.h" @@ -432,7 +435,7 @@ void LocationBarView::SetInstantSuggestion(const string16& text, suggested_text_view_->SetColor( GetColor(ToolbarModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); - suggested_text_view_->SetText(UTF16ToWide(text)); + suggested_text_view_->SetText(text); if (views::Widget::IsPureViews()) NOTIMPLEMENTED(); #if !defined(USE_AURA) @@ -440,8 +443,8 @@ void LocationBarView::SetInstantSuggestion(const string16& text, suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); #endif AddChildView(suggested_text_view_); - } else if (suggested_text_view_->GetText() != UTF16ToWide(text)) { - suggested_text_view_->SetText(UTF16ToWide(text)); + } else if (suggested_text_view_->GetText() != text) { + suggested_text_view_->SetText(text); } if (animate_to_complete && !location_entry_->IsImeComposing()) suggested_text_view_->StartAnimation(); @@ -510,7 +513,7 @@ void LocationBarView::Layout() { entry_width -= (kEdgeThickness + kEdgeEditPadding); } else if (model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { ev_bubble_view_->SetVisible(true); - ev_bubble_view_->SetLabel(UTF16ToWideHack(model_->GetEVCertName())); + ev_bubble_view_->SetLabel(model_->GetEVCertName()); ev_bubble_width = ev_bubble_view_->GetPreferredSize().width(); // We'll adjust this width and take it out of |entry_width| below. } else { 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 7b575e8..e323f87 100644 --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc @@ -66,12 +66,11 @@ void SelectedKeywordView::SetKeyword(const string16& keyword) { &is_extension_keyword); int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT; - full_label_.SetText(UTF16ToWide( - l10n_util::GetStringFUTF16(message_id, short_name))); + full_label_.SetText( + l10n_util::GetStringFUTF16(message_id, short_name)); const std::wstring min_string( location_bar_util::CalculateMinString(UTF16ToWide(short_name))); partial_label_.SetText(min_string.empty() ? full_label_.GetText() : - UTF16ToWide(l10n_util::GetStringFUTF16(message_id, - WideToUTF16(min_string)))); + l10n_util::GetStringFUTF16(message_id, WideToUTF16(min_string))); } diff --git a/chrome/browser/ui/views/login_view.cc b/chrome/browser/ui/views/login_view.cc index 4338e85..04ba4ec 100644 --- a/chrome/browser/ui/views/login_view.cc +++ b/chrome/browser/ui/views/login_view.cc @@ -28,10 +28,10 @@ using views::GridLayout; LoginView::LoginView(const std::wstring& explanation, LoginModel* model) : username_field_(new views::Textfield), password_field_(new views::Textfield(views::Textfield::STYLE_PASSWORD)), - username_label_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD)))), - password_label_(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD)))), + username_label_(new views::Label( + l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD))), + password_label_(new views::Label( + l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), message_label_(new views::Label(explanation)), login_model_(model) { message_label_->SetMultiLine(true); diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 11123063..f496458 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/notifications/balloon_view.h" +#include <algorithm> #include <vector> #include "base/message_loop.h" @@ -287,7 +288,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, balloon->notification().display_source()); - source_label_ = new views::Label(UTF16ToWide(source_label_text)); + source_label_ = new views::Label(source_label_text); AddChildView(source_label_); options_menu_button_ = new views::MenuButton(NULL, L"", this, false); AddChildView(options_menu_button_); diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index 14124c1..352b5a3 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/page_info_bubble_view.h" +#include <algorithm> + #include "base/utf_string_conversions.h" #include "chrome/browser/certificate_viewer.h" #include "chrome/browser/google/google_util.h" @@ -222,7 +224,7 @@ void PageInfoBubbleView::LayoutSections() { if (!only_internal_section) { layout->StartRow(0, 1); help_center_link_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK))); + l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK)); help_center_link_->set_listener(this); layout->AddView(help_center_link_); } @@ -362,7 +364,7 @@ Section::Section(PageInfoBubbleView* owner, // Can't make this a text field to enable copying until multiline support is // added to text fields. - description_label_ = new views::Label(UTF16ToWideHack(info_.description)); + description_label_ = new views::Label(info_.description); description_label_->set_background( views::Background::CreateSolidBackground(SK_ColorWHITE)); description_label_->SetMultiLine(true); @@ -374,7 +376,7 @@ Section::Section(PageInfoBubbleView* owner, if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) { link_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); + l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON)); link_->set_listener(this); AddChildView(link_); } @@ -502,5 +504,4 @@ void ShowPageInfoBubble(BrowserView* browser_view, page_info_bubble, page_info_bubble); page_info_bubble->set_bubble(bubble); } - } diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc index 9ed5e67..e5ae538 100644 --- a/chrome/browser/ui/views/sad_tab_view.cc +++ b/chrome/browser/ui/views/sad_tab_view.cc @@ -101,16 +101,16 @@ void SadTabView::ViewHierarchyChanged(bool is_add, layout->StartRowWithPadding(0, column_set_id, 1, kPadding); layout->AddView(image); - views::Label* title = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - (kind_ == CRASHED) ? IDS_SAD_TAB_TITLE : IDS_KILLED_TAB_TITLE))); + views::Label* title = new views::Label(l10n_util::GetStringUTF16( + (kind_ == CRASHED) ? IDS_SAD_TAB_TITLE : IDS_KILLED_TAB_TITLE)); const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); title->SetFont(base_font.DeriveFont(kTitleFontSizeDelta, gfx::Font::BOLD)); title->SetColor(kTextColor); layout->StartRowWithPadding(0, column_set_id, 0, kPadding); layout->AddView(title); - message_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - (kind_ == CRASHED) ? IDS_SAD_TAB_MESSAGE : IDS_KILLED_TAB_MESSAGE))); + message_ = new views::Label(l10n_util::GetStringUTF16( + (kind_ == CRASHED) ? IDS_SAD_TAB_MESSAGE : IDS_KILLED_TAB_MESSAGE)); message_->SetFont(base_font.DeriveFont(kMessageFontSizeDelta)); message_->SetColor(kTextColor); message_->SetMultiLine(true); @@ -118,8 +118,8 @@ void SadTabView::ViewHierarchyChanged(bool is_add, layout->AddView(message_); if (tab_contents_) { - std::wstring help_link(UTF16ToWide(l10n_util::GetStringUTF16( - (kind_ == CRASHED) ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE))); + string16 help_link(l10n_util::GetStringUTF16( + (kind_ == CRASHED) ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE)); help_link_ = new views::Link(help_link); help_link_->SetFont(base_font.DeriveFont(kMessageFontSizeDelta)); help_link_->SetNormalColor(kTextColor); @@ -130,11 +130,10 @@ void SadTabView::ViewHierarchyChanged(bool is_add, string16 help_text(l10n_util::GetStringFUTF16(IDS_SAD_TAB_HELP_MESSAGE, string16(), &offset)); views::Label* help_prefix = - new views::Label(UTF16ToWide(help_text.substr(0, offset))); + new views::Label(help_text.substr(0, offset)); help_prefix->SetFont(base_font.DeriveFont(kMessageFontSizeDelta)); help_prefix->SetColor(kTextColor); - views::Label* help_suffix = - new views::Label(UTF16ToWide(help_text.substr(offset))); + views::Label* help_suffix = new views::Label(help_text.substr(offset)); help_suffix->SetFont(base_font.DeriveFont(kMessageFontSizeDelta)); help_suffix->SetColor(kTextColor); @@ -155,8 +154,8 @@ void SadTabView::ViewHierarchyChanged(bool is_add, layout->StartRowWithPadding(0, column_set_id, 0, kPadding); layout->AddView(help_link_); - feedback_link_ = new views::Link(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_KILLED_TAB_FEEDBACK_LINK))); + feedback_link_ = new views::Link( + l10n_util::GetStringUTF16(IDS_KILLED_TAB_FEEDBACK_LINK)); feedback_link_->SetFont(base_font.DeriveFont(kMessageFontSizeDelta)); feedback_link_->SetNormalColor(kTextColor); feedback_link_->set_listener(this); diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index 9bbe01f..8904605 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc @@ -467,8 +467,8 @@ void TaskManagerView::Init() { false, false, false)); kill_button_->SetAccessibleKeyboardShortcut(L"E"); kill_button_->set_prefix_type(views::TextButtonBase::PREFIX_SHOW); - about_memory_link_ = new views::Link(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK))); + about_memory_link_ = new views::Link( + l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); about_memory_link_->set_listener(this); // Makes sure our state is consistent. diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index decc136..05c162a 100644 --- a/chrome/browser/ui/views/uninstall_view.cc +++ b/chrome/browser/ui/views/uninstall_view.cc @@ -47,8 +47,8 @@ void UninstallView::SetupControls() { column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); layout->StartRow(0, column_set_id); - confirm_label_ = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_UNINSTALL_VERIFY))); + confirm_label_ = new views::Label( + l10n_util::GetStringUTF16(IDS_UNINSTALL_VERIFY)); confirm_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(confirm_label_); diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index 3c3c20c..5d546d96 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -4,7 +4,9 @@ #include "chrome/browser/ui/views/wrench_menu.h" +#include <algorithm> #include <cmath> +#include <set> #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" @@ -396,7 +398,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView, NULL, IDS_ACCNAME_ZOOM_MINUS2); zoom_label_ = new Label( - UTF16ToWide(l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100))); + l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100)); zoom_label_->SetColor(MenuConfig::instance().text_color); zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT); MenuButtonBackground* center_bg = @@ -502,9 +504,8 @@ class WrenchMenu::ZoomView : public WrenchMenuView, zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement); increment_button_->SetEnabled(enable_increment); decrement_button_->SetEnabled(enable_decrement); - zoom_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16Int( - IDS_ZOOM_PERCENT, - zoom))); + zoom_label_->SetText( + l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, zoom)); zoom_label_width_ = MaxWidthForZoomLabel(); } |