diff options
43 files changed, 136 insertions, 137 deletions
diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc index 22551b5..1a5f23b 100644 --- a/chrome/browser/chromeos/login/captcha_view.cc +++ b/chrome/browser/chromeos/login/captcha_view.cc @@ -52,7 +52,7 @@ class CaptchaField : public TextfieldWithMargin { class WideTextButton : public views::TextButton { public: - WideTextButton(views::ButtonListener* listener, const std::wstring& text) + WideTextButton(views::ButtonListener* listener, const string16& text) : TextButton(listener, text) { SetFont(font().DeriveFont(kFontSizeCorrectionDelta)); } @@ -197,8 +197,7 @@ void CaptchaView::Init() { if (is_standalone_) { layout->StartRow(0, column_view_set_id); - ok_button_ = new WideTextButton( - this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); + ok_button_ = new WideTextButton(this, l10n_util::GetStringUTF16(IDS_OK)); ok_button_->set_alignment(views::TextButton::ALIGN_CENTER); ok_button_->set_focusable(true); static_cast<views::TextButtonBorder*>(ok_button_->border())-> diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index b80512c..3424473 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -348,10 +348,10 @@ void EulaView::Init() { layout->AddView(system_security_settings_link_); - back_button_ = new login::WideButton(this, std::wstring()); + back_button_ = new login::WideButton(this, string16()); layout->AddView(back_button_); - continue_button_ = new login::WideButton(this, std::wstring()); + continue_button_ = new login::WideButton(this, string16()); layout->AddView(continue_button_); layout->AddPaddingRow(0, kPadding); diff --git a/chrome/browser/chromeos/login/guest_user_view.cc b/chrome/browser/chromeos/login/guest_user_view.cc index 7182085..743dcfc 100644 --- a/chrome/browser/chromeos/login/guest_user_view.cc +++ b/chrome/browser/chromeos/login/guest_user_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,7 @@ class UserEntryButton : public login::WideButton { public: UserEntryButton(views::ButtonListener* button_listener, UserController* user_controller, - const std::wstring& label) + const string16& label) : WideButton(button_listener, label), user_controller_(user_controller) {} @@ -67,7 +67,7 @@ void GuestUserView::RecreateFields() { submit_button_ = new UserEntryButton( this, user_controller_, - UTF16ToWide(l10n_util::GetStringUTF16(IDS_ENTER_GUEST_SESSION_BUTTON))); + l10n_util::GetStringUTF16(IDS_ENTER_GUEST_SESSION_BUTTON)); AddChildView(submit_button_); Layout(); SchedulePaint(); diff --git a/chrome/browser/chromeos/login/helper.h b/chrome/browser/chromeos/login/helper.h index 202f01e..3e2d4cf 100644 --- a/chrome/browser/chromeos/login/helper.h +++ b/chrome/browser/chromeos/login/helper.h @@ -151,7 +151,7 @@ const int kButtonMinWidth = 90; class WideButton : public views::NativeTextButton { public: - WideButton(views::ButtonListener* listener, const std::wstring& text) + WideButton(views::ButtonListener* listener, const string16& text) : NativeTextButton(listener, text) { CorrectNativeButtonFontSize(this); } diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc index 6150647..5f32c68 100644 --- a/chrome/browser/chromeos/login/network_selection_view.cc +++ b/chrome/browser/chromeos/login/network_selection_view.cc @@ -476,8 +476,7 @@ void NetworkSelectionView::RecreateNativeControls() { delete continue_button_; continue_button_ = new login::WideButton( actor_, - UTF16ToWide( - l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON))); + l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); continue_button_->SetEnabled(is_continue_enabled); } diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc index 0830eed..640e13a 100644 --- a/chrome/browser/chromeos/login/new_user_view.cc +++ b/chrome/browser/chromeos/login/new_user_view.cc @@ -242,7 +242,7 @@ void NewUserView::RecreatePeculiarControls() { // There is no way to get native button preferred size after the button was // sized so delete and recreate the button on text update. delete sign_in_button_; - sign_in_button_ = new login::WideButton(this, std::wstring()); + sign_in_button_ = new login::WideButton(this, string16()); UpdateSignInButtonState(); if (!CrosLibrary::Get()->EnsureLoaded()) diff --git a/chrome/browser/chromeos/login/shutdown_button.cc b/chrome/browser/chromeos/login/shutdown_button.cc index 8cd5b6b..3b9e6cb 100644 --- a/chrome/browser/chromeos/login/shutdown_button.cc +++ b/chrome/browser/chromeos/login/shutdown_button.cc @@ -64,7 +64,7 @@ class HoverBackground : public views::Background { namespace chromeos { ShutdownButton::ShutdownButton() - : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, std::wstring())) { + : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, string16())) { } void ShutdownButton::Init() { diff --git a/chrome/browser/chromeos/login/user_image_view.cc b/chrome/browser/chromeos/login/user_image_view.cc index 9bfda9d..5b1adfe 100644 --- a/chrome/browser/chromeos/login/user_image_view.cc +++ b/chrome/browser/chromeos/login/user_image_view.cc @@ -94,8 +94,7 @@ void UserImageView::Init() { splitter_ = CreateSplitter(kSplitterColor); - ok_button_ = new login::WideButton( - this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); + ok_button_ = new login::WideButton(this, l10n_util::GetStringUTF16(IDS_OK)); ok_button_->set_focusable(true); ok_button_->SetEnabled(false); diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc index 9133b3e..b17e282 100644 --- a/chrome/browser/chromeos/login/user_view.cc +++ b/chrome/browser/chromeos/login/user_view.cc @@ -118,7 +118,7 @@ class RemoveButton : public views::TextButton { const SkBitmap& icon, const string16& text, const gfx::Point& top_right) - : views::TextButton(listener, std::wstring()), + : views::TextButton(listener, string16()), icon_(icon), text_(text), top_right_(top_right), diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index 8639965..3cc24a2 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -171,9 +171,9 @@ void NetworkConfigView::ViewHierarchyChanged( } void NetworkConfigView::CreateAdvancedButton() { - advanced_button_ = new views::NativeTextButton(this, UTF16ToWide( + advanced_button_ = new views::NativeTextButton(this, l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ADVANCED_BUTTON))); + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ADVANCED_BUTTON)); // Wrap the advanced button in a grid layout in order to left-align it. advanced_button_container_ = new views::View(); diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index d417c99..f8c0646 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -103,13 +103,11 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate) AddChildView(icon_); cancel_ = new views::NativeTextButton( - this, - UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL))); + this, l10n_util::GetStringUTF16(IDS_CANCEL)); AddChildView(cancel_); try_again_ = new views::NativeTextButton( - this, - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN))); + this, l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN)); AddChildView(try_again_); mic_settings_ = new views::Link( diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc index 4626f00..684ae7a 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc @@ -141,13 +141,13 @@ TEST_F(AccessibilityEventRouterViewsTest, MAYBE_TestFocusNotification) { // Create a contents view with 3 buttons. views::View* contents = new views::View(); views::NativeTextButton* button1 = new views::NativeTextButton( - NULL, ASCIIToWide(kButton1ASCII)); + NULL, ASCIIToUTF16(kButton1ASCII)); contents->AddChildView(button1); views::NativeTextButton* button2 = new views::NativeTextButton( - NULL, ASCIIToWide(kButton2ASCII)); + NULL, ASCIIToUTF16(kButton2ASCII)); contents->AddChildView(button2); views::NativeTextButton* button3 = new views::NativeTextButton( - NULL, ASCIIToWide(kButton3ASCII)); + NULL, ASCIIToUTF16(kButton3ASCII)); contents->AddChildView(button3); // Put the view in a window. 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 07b3786..10c36d1 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -190,8 +190,8 @@ class AutocompletePopupContentsView::InstantOptInView // native buttons don't draw in layered windows. // 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))); + views::TextButton* button = new views::TextButton( + this, l10n_util::GetStringUTF16(id)); button->set_border(new OptInButtonBorder()); button->set_tag(id); button->SetFont(font); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 0db33c9..3fc1553 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -133,7 +133,7 @@ class BookmarkButton : public views::TextButton { BookmarkButton(views::ButtonListener* listener, const GURL& url, - const std::wstring& title, + const string16& title, Profile* profile) : TextButton(listener, title), url_(url), @@ -1247,9 +1247,8 @@ MenuButton* BookmarkBarView::CreateOverflowButton() { } views::TextButton* BookmarkBarView::CreateSyncErrorButton() { - views::TextButton* sync_error_button = - new views::TextButton(this, UTF16ToWide( - l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR))); + views::TextButton* sync_error_button = new views::TextButton( + this, 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 @@ -1265,8 +1264,8 @@ views::TextButton* BookmarkBarView::CreateSyncErrorButton() { views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { if (node->is_url()) { - BookmarkButton* button = new BookmarkButton(this, node->url(), - UTF16ToWide(node->GetTitle()), browser_->profile()); + BookmarkButton* button = new BookmarkButton( + this, node->url(), node->GetTitle(), browser_->profile()); ConfigureButton(node, button); return button; } else { diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index d20f96f..1b6ddfb 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -181,11 +181,10 @@ void BookmarkBubbleView::Init() { remove_link_->SetBackgroundColor(Bubble::kBackgroundColor); edit_button_ = new views::NativeTextButton( - this, - UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS))); + this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS)); close_button_ = new views::NativeTextButton( - this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); + this, l10n_util::GetStringUTF16(IDS_DONE)); close_button_->SetIsDefault(true); views::Label* combobox_label = new views::Label( diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index a725f57..00843db 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -336,8 +336,7 @@ void ContentSettingBubbleContents::InitControlLayout() { manage_link_->set_listener(this); layout->AddView(manage_link_); - close_button_ = - new views::NativeTextButton(this, - UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); + close_button_ = new views::NativeTextButton( + this, l10n_util::GetStringUTF16(IDS_DONE)); layout->AddView(close_button_); } diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 88670ea..69e2ee5 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc @@ -215,12 +215,12 @@ DownloadItemView::DownloadItemView(DownloadItem* download, body_state_ = DANGEROUS; drop_down_state_ = DANGEROUS; save_button_ = new views::NativeTextButton(this, - UTF16ToWide(l10n_util::GetStringUTF16( + l10n_util::GetStringUTF16( ChromeDownloadManagerDelegate::IsExtensionDownload(download) ? - IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_CONFIRM_DOWNLOAD))); + IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_CONFIRM_DOWNLOAD)); save_button_->set_ignore_minimum_size(true); discard_button_ = new views::NativeTextButton( - this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD))); + this, l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD)); discard_button_->set_ignore_minimum_size(true); AddChildView(save_button_); AddChildView(discard_button_); diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc index 67c0795..ba7358c 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc @@ -112,8 +112,8 @@ FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView( AddChildView(&instruction_label_); AddChildView(&link_); - accept_button_ = new views::NativeTextButton(this, - UTF16ToWideHack(bubble->GetAllowButtonText())); + accept_button_ = new views::NativeTextButton( + this, bubble->GetAllowButtonText()); accept_button_->set_focusable(false); AddChildView(accept_button_); diff --git a/chrome/browser/ui/views/global_error_bubble_view.cc b/chrome/browser/ui/views/global_error_bubble_view.cc index 76a6501..4db3ffe 100644 --- a/chrome/browser/ui/views/global_error_bubble_view.cc +++ b/chrome/browser/ui/views/global_error_bubble_view.cc @@ -56,15 +56,14 @@ GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser, bool accept_default = error_->IsAcceptButtonDefault(); string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); scoped_ptr<views::TextButton> accept_button( - new views::NativeTextButton(this, UTF16ToWideHack(accept_string))); + new views::NativeTextButton(this, accept_string)); accept_button->SetIsDefault(accept_default); accept_button->set_tag(TAG_ACCEPT_BUTTON); string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); scoped_ptr<views::TextButton> cancel_button; if (!cancel_string.empty()) { - cancel_button.reset( - new views::NativeTextButton(this, UTF16ToWideHack(cancel_string))); + cancel_button.reset(new views::NativeTextButton(this, cancel_string)); cancel_button->SetIsDefault(!accept_default); cancel_button->set_tag(TAG_CANCEL_BUTTON); } diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index 1df535d..86610e5 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -120,8 +120,7 @@ views::TextButton* InfoBarView::CreateTextButton( views::ButtonListener* listener, const string16& text, bool needs_elevation) { - views::TextButton* text_button = - new views::TextButton(listener, UTF16ToWideHack(text)); + views::TextButton* text_button = new views::TextButton(listener, text); text_button->set_border(new InfoBarButtonBorder); text_button->set_animate_on_state_change(false); text_button->SetEnabledColor(SK_ColorBLACK); 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 723c05c..82f1119 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -1104,7 +1104,7 @@ void LocationBarView::WriteDragDataForView(views::View* sender, DCHECK(tab_contents); drag_utils::SetURLAndDragImage( tab_contents->tab_contents()->GetURL(), - UTF16ToWideHack(tab_contents->tab_contents()->GetTitle()), + tab_contents->tab_contents()->GetTitle(), tab_contents->favicon_tab_helper()->GetFavicon(), data); } diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index 8748d9c..c173284 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -281,8 +281,8 @@ class WrenchMenuView : public ScheduleAllView, public views::ButtonListener { int index, MenuButtonBackground** background, int acc_string_id) { - TextButton* button = - new TextButton(this, UTF16ToWide(l10n_util::GetStringUTF16(string_id))); + TextButton* button = new TextButton(this, + l10n_util::GetStringUTF16(string_id)); button->SetAccessibleName( GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id)); button->set_focusable(true); diff --git a/ui/aura_shell/examples/widgets.cc b/ui/aura_shell/examples/widgets.cc index 8b032c3..faaf4a3 100644 --- a/ui/aura_shell/examples/widgets.cc +++ b/ui/aura_shell/examples/widgets.cc @@ -52,8 +52,9 @@ class WidgetsWindow : public views::WidgetDelegateView { }; WidgetsWindow::WidgetsWindow() - : button_(new views::NativeTextButton(NULL, L"Button")), - disabled_button_(new views::NativeTextButton(NULL, L"Disabled button")), + : button_(new views::NativeTextButton(NULL, ASCIIToUTF16("Button"))), + disabled_button_( + new views::NativeTextButton(NULL, ASCIIToUTF16("Disabled button"))), checkbox_(new views::Checkbox(ASCIIToUTF16("Checkbox"))), checkbox_disabled_(new views::Checkbox( ASCIIToUTF16("Checkbox disabled"))), diff --git a/ui/aura_shell/examples/window_type_launcher.cc b/ui/aura_shell/examples/window_type_launcher.cc index 63c0278..fdbdb12 100644 --- a/ui/aura_shell/examples/window_type_launcher.cc +++ b/ui/aura_shell/examples/window_type_launcher.cc @@ -33,17 +33,19 @@ void InitWindowTypeLauncher() { } WindowTypeLauncher::WindowTypeLauncher() - : ALLOW_THIS_IN_INITIALIZER_LIST( - create_button_(new views::NativeTextButton(this, L"Create Window"))), - ALLOW_THIS_IN_INITIALIZER_LIST( - create_nonresizable_button_(new views::NativeTextButton( - this, L"Create Non-Resizable Window"))), + : ALLOW_THIS_IN_INITIALIZER_LIST(create_button_( + new views::NativeTextButton(this, ASCIIToUTF16("Create Window")))), + ALLOW_THIS_IN_INITIALIZER_LIST(create_nonresizable_button_( + new views::NativeTextButton( + this, ASCIIToUTF16("Create Non-Resizable Window")))), ALLOW_THIS_IN_INITIALIZER_LIST(bubble_button_( - new views::NativeTextButton(this, L"Create Pointy Bubble"))), + new views::NativeTextButton( + this, ASCIIToUTF16("Create Pointy Bubble")))), ALLOW_THIS_IN_INITIALIZER_LIST(lock_button_( - new views::NativeTextButton(this, L"Lock Screen"))), + new views::NativeTextButton(this, ASCIIToUTF16("Lock Screen")))), ALLOW_THIS_IN_INITIALIZER_LIST(widgets_button_( - new views::NativeTextButton(this, L"Show Example Widgets"))) { + new views::NativeTextButton( + this, ASCIIToUTF16("Show Example Widgets")))) { AddChildView(create_button_); AddChildView(create_nonresizable_button_); AddChildView(bubble_button_); diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 4a9e74c..50af173 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -49,7 +49,7 @@ MenuButton::MenuButton(ButtonListener* listener, const string16& text, ViewMenuDelegate* menu_delegate, bool show_menu_marker) - : TextButton(listener, UTF16ToWideHack(text)), + : TextButton(listener, text), menu_visible_(false), menu_offset_(kDefaultMenuOffsetX, kDefaultMenuOffsetY), menu_delegate_(menu_delegate), diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 1d56f1d..755196a 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -7,7 +7,6 @@ #include <algorithm> #include "base/logging.h" -#include "base/utf_string_conversions.h" #include "grit/ui_resources.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/resource/resource_bundle.h" @@ -650,9 +649,8 @@ gfx::NativeTheme::State TextButtonBase::GetForegroundThemeState( // //////////////////////////////////////////////////////////////////////////////// -TextButton::TextButton(ButtonListener* listener, - const std::wstring& text) - : TextButtonBase(listener, WideToUTF16Hack(text)), +TextButton::TextButton(ButtonListener* listener, const string16& text) + : TextButtonBase(listener, text), icon_placement_(ICON_ON_LEFT), has_hover_icon_(false), has_pushed_icon_(false), @@ -793,12 +791,12 @@ const SkBitmap& TextButton::GetImageToPaint() const { //////////////////////////////////////////////////////////////////////////////// NativeTextButton::NativeTextButton(ButtonListener* listener) - : TextButton(listener, std::wstring()) { + : TextButton(listener, string16()) { Init(); } NativeTextButton::NativeTextButton(ButtonListener* listener, - const std::wstring& text) + const string16& text) : TextButton(listener, text) { Init(); } diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h index 031b59a..5cd79d3 100644 --- a/views/controls/button/text_button.h +++ b/views/controls/button/text_button.h @@ -318,7 +318,7 @@ class VIEWS_EXPORT TextButton : public TextButtonBase { // The button's class name. static const char kViewClassName[]; - TextButton(ButtonListener* listener, const std::wstring& text); + TextButton(ButtonListener* listener, const string16& text); virtual ~TextButton(); void set_icon_text_spacing(int icon_text_spacing) { @@ -404,7 +404,7 @@ class VIEWS_EXPORT NativeTextButton : public TextButton { static const char kViewClassName[]; NativeTextButton(ButtonListener* listener); - NativeTextButton(ButtonListener* listener, const std::wstring& text); + NativeTextButton(ButtonListener* listener, const string16& text); // Overridden from TextButton: virtual gfx::Size GetMinimumSize() OVERRIDE; diff --git a/views/drag_utils.cc b/views/drag_utils.cc index 5c17cd1..7d417c2 100644 --- a/views/drag_utils.cc +++ b/views/drag_utils.cc @@ -28,16 +28,16 @@ static const int kFileDragImageMaxWidth = 200; static const SkColor kFileDragImageTextColor = SK_ColorBLACK; void SetURLAndDragImage(const GURL& url, - const std::wstring& title, + const string16& title, const SkBitmap& icon, OSExchangeData* data) { DCHECK(url.is_valid() && data); - data->SetURL(url, WideToUTF16(title)); + data->SetURL(url, title); // Create a button to render the drag image for us. views::TextButton button(NULL, - title.empty() ? UTF8ToWide(url.spec()) : title); + title.empty() ? UTF8ToUTF16(url.spec()) : title); button.set_max_width(kLinkDragImageMaxWidth); if (icon.isNull()) { button.SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( diff --git a/views/drag_utils.h b/views/drag_utils.h index 24c30c1..dab3e17 100644 --- a/views/drag_utils.h +++ b/views/drag_utils.h @@ -9,6 +9,7 @@ #include <string> #include "base/file_path.h" +#include "base/string16.h" #include "views/views_export.h" class GURL; @@ -30,7 +31,7 @@ namespace drag_utils { // Sets url and title on data as well as setting a suitable image for dragging. // The image looks like that of the bookmark buttons. VIEWS_EXPORT void SetURLAndDragImage(const GURL& url, - const std::wstring& title, + const string16& title, const SkBitmap& icon, OSExchangeData* data); diff --git a/views/examples/bubble_example.cc b/views/examples/bubble_example.cc index 4a98ff7..94e2605 100644 --- a/views/examples/bubble_example.cc +++ b/views/examples/bubble_example.cc @@ -72,11 +72,10 @@ BubbleExample::~BubbleExample() {} void BubbleExample::CreateExampleView(views::View* container) { container->SetLayoutManager( new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 1)); - round_ = new views::TextButton(this, UTF16ToWideHack(kRoundConfig.label)); - arrow_ = new views::TextButton(this, UTF16ToWideHack(kArrowConfig.label)); - fade_in_ = new views::TextButton(this, UTF16ToWideHack(kFadeInConfig.label)); - fade_out_ = new views::TextButton(this, - UTF16ToWideHack(kFadeOutConfig.label)); + round_ = new views::TextButton(this, kRoundConfig.label); + arrow_ = new views::TextButton(this, kArrowConfig.label); + fade_in_ = new views::TextButton(this, kFadeInConfig.label); + fade_out_ = new views::TextButton(this, kFadeOutConfig.label); container->AddChildView(round_); container->AddChildView(arrow_); container->AddChildView(fade_in_); diff --git a/views/examples/button_example.cc b/views/examples/button_example.cc index 71f11f6..eff17d9 100644 --- a/views/examples/button_example.cc +++ b/views/examples/button_example.cc @@ -27,7 +27,7 @@ ButtonExample::~ButtonExample() { } void ButtonExample::CreateExampleView(views::View* container) { - views::TextButton* tb = new views::TextButton(this, L"Button"); + views::TextButton* tb = new views::TextButton(this, ASCIIToUTF16("Button")); button_ = tb; container->SetLayoutManager(new views::FillLayout); container->AddChildView(button_); diff --git a/views/examples/message_box_example.cc b/views/examples/message_box_example.cc index 6d7d8f53..8858f10 100644 --- a/views/examples/message_box_example.cc +++ b/views/examples/message_box_example.cc @@ -23,8 +23,8 @@ void MessageBoxExample::CreateExampleView(views::View* container) { 0, ASCIIToUTF16("Message Box Message"), ASCIIToUTF16("Default Prompt")); - status_ = new views::TextButton(this, L"Show Status"); - toggle_ = new views::TextButton(this, L"Toggle Checkbox"); + status_ = new views::TextButton(this, ASCIIToUTF16("Show Status")); + toggle_ = new views::TextButton(this, ASCIIToUTF16("Toggle Checkbox")); views::GridLayout* layout = new views::GridLayout(container); container->SetLayoutManager(layout); diff --git a/views/examples/native_widget_views_example.cc b/views/examples/native_widget_views_example.cc index e46a5532..4652b26 100644 --- a/views/examples/native_widget_views_example.cc +++ b/views/examples/native_widget_views_example.cc @@ -4,6 +4,7 @@ #include "views/examples/native_widget_views_example.h" +#include "base/utf_string_conversions.h" #include "ui/gfx/canvas.h" #include "views/controls/button/text_button.h" #include "views/examples/example_base.h" @@ -23,7 +24,7 @@ class TestContentView : public views::View, TestContentView() : click_count_(0), ALLOW_THIS_IN_INITIALIZER_LIST( - button_(new views::TextButton(this, L"Click me!"))) { + button_(new views::TextButton(this, ASCIIToUTF16("Click me!")))) { AddChildView(button_); } virtual ~TestContentView() { diff --git a/views/examples/radio_button_example.cc b/views/examples/radio_button_example.cc index 2367197..b7d4a87 100644 --- a/views/examples/radio_button_example.cc +++ b/views/examples/radio_button_example.cc @@ -20,8 +20,8 @@ RadioButtonExample::~RadioButtonExample() { } void RadioButtonExample::CreateExampleView(views::View* container) { - select_ = new views::TextButton(this, L"Select"); - status_ = new views::TextButton(this, L"Show Status"); + select_ = new views::TextButton(this, ASCIIToUTF16("Select")); + status_ = new views::TextButton(this, ASCIIToUTF16("Show Status")); int group = 1; for (size_t i = 0; i < arraysize(radio_buttons_); ++i) { diff --git a/views/examples/scroll_view_example.cc b/views/examples/scroll_view_example.cc index be7aced..7ed2ece 100644 --- a/views/examples/scroll_view_example.cc +++ b/views/examples/scroll_view_example.cc @@ -18,7 +18,7 @@ class ScrollViewExample::ScrollableView : public views::View { public: ScrollableView() { SetColor(SK_ColorRED, SK_ColorCYAN); - AddChildView(new views::TextButton(NULL, L"Button")); + AddChildView(new views::TextButton(NULL, ASCIIToUTF16("Button"))); AddChildView(new views::RadioButton(ASCIIToUTF16("Radio Button"), 0)); } @@ -55,11 +55,11 @@ ScrollViewExample::~ScrollViewExample() { } void ScrollViewExample::CreateExampleView(views::View* container) { - wide_ = new views::TextButton(this, L"Wide"); - tall_ = new views::TextButton(this, L"Tall"); - big_square_ = new views::TextButton(this, L"Big Square"); - small_square_ = new views::TextButton(this, L"Small Square"); - scroll_to_ = new views::TextButton(this, L"Scroll to"); + wide_ = new views::TextButton(this, ASCIIToUTF16("Wide")); + tall_ = new views::TextButton(this, ASCIIToUTF16("Tall")); + big_square_ = new views::TextButton(this, ASCIIToUTF16("Big Square")); + small_square_ = new views::TextButton(this, ASCIIToUTF16("Small Square")); + scroll_to_ = new views::TextButton(this, ASCIIToUTF16("Scroll to")); scrollable_ = new ScrollableView(); scroll_view_ = new views::ScrollView(); scroll_view_->SetContents(scrollable_); diff --git a/views/examples/tabbed_pane_example.cc b/views/examples/tabbed_pane_example.cc index 4b6c54c..18933f7 100644 --- a/views/examples/tabbed_pane_example.cc +++ b/views/examples/tabbed_pane_example.cc @@ -20,10 +20,10 @@ TabbedPaneExample::~TabbedPaneExample() { void TabbedPaneExample::CreateExampleView(views::View* container) { tabbed_pane_ = new views::TabbedPane(); tabbed_pane_->set_listener(this); - add_ = new views::TextButton(this, L"Add"); - add_at_ = new views::TextButton(this, L"Add At 1"); - remove_at_ = new views::TextButton(this, L"Remove At 1"); - select_at_ = new views::TextButton(this, L"Select At 1"); + add_ = new views::TextButton(this, ASCIIToUTF16("Add")); + add_at_ = new views::TextButton(this, ASCIIToUTF16("Add At 1")); + remove_at_ = new views::TextButton(this, ASCIIToUTF16("Remove At 1")); + select_at_ = new views::TextButton(this, ASCIIToUTF16("Select At 1")); views::GridLayout* layout = new views::GridLayout(container); container->SetLayoutManager(layout); @@ -59,8 +59,8 @@ void TabbedPaneExample::ButtonPressed(views::Button* sender, if (sender == add_) { AddButton("Added"); } else if (sender == add_at_) { - const std::wstring label = L"Added at 1"; - tabbed_pane_->AddTabAtIndex(1, WideToUTF16Hack(label), + const string16 label = ASCIIToUTF16("Added at 1"); + tabbed_pane_->AddTabAtIndex(1, label, new views::TextButton(NULL, label), true); } else if (sender == remove_at_) { if (tabbed_pane_->GetTabCount() > 1) @@ -84,7 +84,7 @@ void TabbedPaneExample::PrintStatus() { } void TabbedPaneExample::AddButton(const std::string& label) { - views::TextButton* button = new views::TextButton(NULL, ASCIIToWide(label)); + views::TextButton* button = new views::TextButton(NULL, ASCIIToUTF16(label)); tabbed_pane_->AddTab(ASCIIToUTF16(label), button); } diff --git a/views/examples/textfield_example.cc b/views/examples/textfield_example.cc index e5e035c..3423d46 100644 --- a/views/examples/textfield_example.cc +++ b/views/examples/textfield_example.cc @@ -25,11 +25,11 @@ void TextfieldExample::CreateExampleView(views::View* container) { name_ = new views::Textfield(); password_ = new views::Textfield(views::Textfield::STYLE_PASSWORD); password_->set_text_to_display_when_empty(ASCIIToUTF16("password")); - show_password_ = new views::TextButton(this, L"Show password"); - clear_all_ = new views::TextButton(this, L"Clear All"); - append_ = new views::TextButton(this, L"Append"); - set_ = new views::TextButton(this, L"Set"); - set_style_ = new views::TextButton(this, L"Set Styles"); + show_password_ = new views::TextButton(this, ASCIIToUTF16("Show password")); + clear_all_ = new views::TextButton(this, ASCIIToUTF16("Clear All")); + append_ = new views::TextButton(this, ASCIIToUTF16("Append")); + set_ = new views::TextButton(this, ASCIIToUTF16("Set")); + set_style_ = new views::TextButton(this, ASCIIToUTF16("Set Styles")); name_->SetController(this); password_->SetController(this); diff --git a/views/examples/widget_example.cc b/views/examples/widget_example.cc index eba7bae..ed93ced 100644 --- a/views/examples/widget_example.cc +++ b/views/examples/widget_example.cc @@ -4,6 +4,7 @@ #include "views/examples/widget_example.h" +#include "base/utf_string_conversions.h" #include "views/controls/button/text_button.h" #include "views/layout/box_layout.h" #include "views/layout/layout_manager.h" @@ -50,35 +51,36 @@ WidgetExample::~WidgetExample() { void WidgetExample::CreateExampleView(views::View* container) { container->SetLayoutManager( new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 2)); - BuildButton(container, L"Create a popup widget", POPUP); - BuildButton(container, L"Create a transparent popup widget", + BuildButton(container, "Create a popup widget", POPUP); + BuildButton(container, "Create a transparent popup widget", TRANSPARENT_POPUP); #if defined(OS_LINUX) views::View* vert_container = new views::View(); container->AddChildView(vert_container); vert_container->SetLayoutManager( new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 20)); - BuildButton(vert_container, L"Create a child widget", CHILD); - BuildButton(vert_container, L"Create a transparent child widget", + BuildButton(vert_container, "Create a child widget", CHILD); + BuildButton(vert_container, "Create a transparent child widget", TRANSPARENT_CHILD); #endif } void WidgetExample::BuildButton(views::View* container, - const std::wstring& label, + const std::string& label, int tag) { - views::TextButton* button = new views::TextButton(this, label); + views::TextButton* button = new views::TextButton(this, ASCIIToUTF16(label)); button->set_tag(tag); container->AddChildView(button); } void WidgetExample::InitWidget(views::Widget* widget, bool transparent) { // Add view/native buttons to close the popup widget. - views::TextButton* close_button = new views::TextButton(this, L"Close"); + views::TextButton* close_button = new views::TextButton( + this, ASCIIToUTF16("Close")); close_button->set_tag(CLOSE_WIDGET); // TODO(oshima): support transparent native view. - views::NativeTextButton* native_button = - new views::NativeTextButton(this, L"Native Close"); + views::NativeTextButton* native_button = new views::NativeTextButton( + this, ASCIIToUTF16("Native Close")); native_button->set_tag(CLOSE_WIDGET); views::View* button_container = new views::View(); diff --git a/views/examples/widget_example.h b/views/examples/widget_example.h index 6dbf450..60ec575 100644 --- a/views/examples/widget_example.h +++ b/views/examples/widget_example.h @@ -34,7 +34,7 @@ class WidgetExample : public ExampleBase, public views::ButtonListener { CLOSE_WIDGET, }; - void BuildButton(views::View* container, const std::wstring& label, int tag); + void BuildButton(views::View* container, const std::string& label, int tag); void InitWidget(views::Widget* widget, bool transparent); diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index c60b8ee..162468d 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -549,7 +549,8 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; - NativeTextButton* button = new NativeTextButton(NULL, L"Click me"); + NativeTextButton* button = new NativeTextButton(NULL, + ASCIIToUTF16("Click me")); button->SetBounds(label_x, y + 10, 80, 30); button->set_id(kFruitButtonID); left_container_->AddChildView(button); @@ -644,19 +645,19 @@ void FocusTraversalTest::InitContentView() { y = 250; int width = 60; - button = new NativeTextButton(NULL, L"OK"); + button = new NativeTextButton(NULL, ASCIIToUTF16("OK")); button->set_id(kOKButtonID); button->SetIsDefault(true); content_view_->AddChildView(button); button->SetBounds(150, y, width, 30); - button = new NativeTextButton(NULL, L"Cancel"); + button = new NativeTextButton(NULL, ASCIIToUTF16("Cancel")); button->set_id(kCancelButtonID); content_view_->AddChildView(button); button->SetBounds(220, y, width, 30); - button = new NativeTextButton(NULL, L"Help"); + button = new NativeTextButton(NULL, ASCIIToUTF16("Help")); button->set_id(kHelpButtonID); content_view_->AddChildView(button); button->SetBounds(290, y, width, 30); @@ -706,7 +707,7 @@ void FocusTraversalTest::InitContentView() { text_field->SetBounds(10, 10, 100, 20); text_field->set_id(kSearchTextfieldID); - button = new NativeTextButton(NULL, L"Search"); + button = new NativeTextButton(NULL, ASCIIToUTF16("Search")); contents->AddChildView(button); button->SetBounds(112, 5, 60, 30); button->set_id(kSearchButtonID); @@ -729,11 +730,11 @@ void FocusTraversalTest::InitContentView() { contents->set_focusable(true); contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE)); contents->set_id(kThumbnailContainerID); - button = new NativeTextButton(NULL, L"Star"); + button = new NativeTextButton(NULL, ASCIIToUTF16("Star")); contents->AddChildView(button); button->SetBounds(5, 5, 50, 30); button->set_id(kThumbnailStarID); - button = new NativeTextButton(NULL, L"SuperStar"); + button = new NativeTextButton(NULL, ASCIIToUTF16("SuperStar")); contents->AddChildView(button); button->SetBounds(60, 5, 100, 30); button->set_id(kThumbnailSuperStarID); @@ -868,7 +869,7 @@ TEST_F(FocusManagerTest, FocusChangeListener) { class TestNativeButton : public NativeTextButton { public: - explicit TestNativeButton(const std::wstring& text) + explicit TestNativeButton(const string16& text) : NativeTextButton(NULL, text) { }; virtual gfx::NativeView TestGetNativeControlView() { @@ -962,7 +963,8 @@ TEST_F(FocusManagerTest, FocusStoreRestore) { // Simulate an activate, otherwise the deactivate isn't going to do anything. SimulateActivateWindow(); - NativeTextButton* button = new NativeTextButton(NULL, L"Press me"); + NativeTextButton* button = new NativeTextButton(NULL, + ASCIIToUTF16("Press me")); View* view = new View(); view->set_focusable(true); @@ -1043,7 +1045,8 @@ TEST_F(FocusManagerTest, ContainsView) { scoped_ptr<View> detached_view(new View()); TabbedPane* tabbed_pane = new TabbedPane(); TabbedPane* nested_tabbed_pane = new TabbedPane(); - NativeTextButton* tab_button = new NativeTextButton(NULL, L"tab button"); + NativeTextButton* tab_button = new NativeTextButton( + NULL, ASCIIToUTF16("tab button")); content_view_->AddChildView(view); content_view_->AddChildView(tabbed_pane); @@ -1678,7 +1681,7 @@ class FocusManagerDtorTest : public FocusManagerTest { class NativeButtonDtorTracked : public NativeTextButton { public: - NativeButtonDtorTracked(const std::wstring& text, + NativeButtonDtorTracked(const string16& text, DtorTrackVector* dtor_tracker) : NativeTextButton(NULL, text), dtor_tracker_(dtor_tracker) { @@ -1736,8 +1739,8 @@ TEST_F(FocusManagerDtorTest, FocusManagerDestructedLast) { TabbedPane* tabbed_pane = new TabbedPane(); content_view_->AddChildView(tabbed_pane); - NativeButtonDtorTracked* button = new NativeButtonDtorTracked(L"button", - &dtor_tracker_); + NativeButtonDtorTracked* button = new NativeButtonDtorTracked( + ASCIIToUTF16("button"), &dtor_tracker_); tabbed_pane->AddTab(ASCIIToUTF16("Awesome tab"), button); // Close the window. diff --git a/views/touchui/touch_selection_controller_impl.cc b/views/touchui/touch_selection_controller_impl.cc index 16e51e8..6ce527e 100644 --- a/views/touchui/touch_selection_controller_impl.cc +++ b/views/touchui/touch_selection_controller_impl.cc @@ -299,8 +299,8 @@ class TouchSelectionControllerImpl::TouchContextMenuView for (size_t i = 0; i < arraysize(kContextMenuCommands); i++) { int command_id = kContextMenuCommands[i]; if (controller_->IsCommandIdEnabled(command_id)) { - TextButton* button = new TextButton(this, - UTF16ToWide(l10n_util::GetStringUTF16(command_id))); + TextButton* button = new TextButton( + this, l10n_util::GetStringUTF16(command_id)); button->set_focusable(true); button->set_request_focus_on_press(false); button->set_prefix_type(TextButton::PREFIX_HIDE); diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 759d182..ba6579d 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1223,8 +1223,8 @@ class TestDialog : public DialogDelegate, public ButtonListener { virtual View* GetContentsView() OVERRIDE { if (!contents_) { contents_ = new View; - button1_ = new NativeTextButton(this, L"Button1"); - button2_ = new NativeTextButton(this, L"Button2"); + button1_ = new NativeTextButton(this, ASCIIToUTF16("Button1")); + button2_ = new NativeTextButton(this, ASCIIToUTF16("Button2")); checkbox_ = new Checkbox(ASCIIToUTF16("My checkbox")); button_drop_ = new ButtonDropDown(this, mock_menu_model_); contents_->AddChildView(button1_); @@ -1468,7 +1468,7 @@ TEST_F(ViewTest, ChangeVisibility) { scoped_ptr<Widget> window(CreateWidget()); window->Init(NULL, gfx::Rect(0, 0, 500, 300)); View* root_view = window->GetRootView(); - NativeTextButton* native = new NativeTextButton(NULL, L"Native"); + NativeTextButton* native = new NativeTextButton(NULL, ASCIIToUTF16("Native")); root_view->SetContentsView(native); native->SetVisible(true); diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 4c571c2..9a75fe2 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -70,7 +70,7 @@ class DialogButton : public NativeTextButton { DialogButton(ButtonListener* listener, Widget* owner, MessageBoxFlags::DialogButton type, - const std::wstring& title, + const string16& title, bool is_default) : NativeTextButton(listener, title), owner_(owner), @@ -135,9 +135,10 @@ void DialogClientView::ShowDialogButtons() { label = l10n_util::GetStringUTF16(IDS_APP_OK); bool is_default_button = (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0; - ok_button_ = new DialogButton(this, GetWidget(), + ok_button_ = new DialogButton(this, + GetWidget(), MessageBoxFlags::DIALOGBUTTON_OK, - UTF16ToWideHack(label), + label, is_default_button); ok_button_->SetGroup(kButtonGroup); if (is_default_button) @@ -160,9 +161,10 @@ void DialogClientView::ShowDialogButtons() { bool is_default_button = (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_CANCEL) != 0; - cancel_button_ = new DialogButton(this, GetWidget(), + cancel_button_ = new DialogButton(this, + GetWidget(), MessageBoxFlags::DIALOGBUTTON_CANCEL, - UTF16ToWideHack(label), + label, is_default_button); cancel_button_->SetGroup(kButtonGroup); cancel_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE, |