diff options
73 files changed, 475 insertions, 456 deletions
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc index e864b80..a8e5eb1 100644 --- a/chrome/browser/chromeos/frame/bubble_frame_view.cc +++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc @@ -50,8 +50,7 @@ BubbleFrameView::BubbleFrameView(views::Widget* frame, close_button_(NULL), throbber_(NULL) { if (widget_delegate->ShouldShowWindowTitle()) { - title_ = new views::Label( - UTF16ToWideHack(widget_delegate->GetWindowTitle())); + title_ = new views::Label(widget_delegate->GetWindowTitle()); title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, gfx::Font::BOLD)); @@ -82,7 +81,7 @@ BubbleFrameView::~BubbleFrameView() { void BubbleFrameView::StartThrobber() { DCHECK(throbber_ != NULL); if (title_) - title_->SetText(std::wstring()); + title_->SetText(string16()); throbber_->Start(); } @@ -90,8 +89,7 @@ void BubbleFrameView::StopThrobber() { DCHECK(throbber_ != NULL); throbber_->Stop(); if (title_) - title_->SetText( - UTF16ToWideHack(frame_->widget_delegate()->GetWindowTitle())); + title_->SetText(frame_->widget_delegate()->GetWindowTitle()); } gfx::Rect BubbleFrameView::GetBoundsForClientView() const { diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc index a81beff..916776f 100644 --- a/chrome/browser/chromeos/frame/panel_controller.cc +++ b/chrome/browser/chromeos/frame/panel_controller.cc @@ -211,7 +211,7 @@ void PanelController::Init(bool initial_focus, client_event_handler_id_ = g_signal_connect( panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); -#endif // !USE_AURA +#endif // !USE_AURA title_content_ = new TitleContentView(this); title_window_->SetContentsView(title_content_); @@ -222,8 +222,7 @@ void PanelController::Init(bool initial_focus, void PanelController::UpdateTitleBar() { if (!delegate_ || !title_window_) return; - title_content_->title_label()->SetText( - UTF16ToWideHack(delegate_->GetPanelTitle())); + title_content_->title_label()->SetText(delegate_->GetPanelTitle()); title_content_->title_icon()->SetImage(delegate_->GetPanelIcon()); } @@ -440,7 +439,7 @@ PanelController::TitleContentView::TitleContentView( title_icon_ = new views::ImageView(); AddChildView(title_icon_); - title_label_ = new views::Label(std::wstring()); + title_label_ = new views::Label(string16()); title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(title_label_); diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc index 7f247b81..2ea6805 100644 --- a/chrome/browser/chromeos/input_method/candidate_window.cc +++ b/chrome/browser/chromeos/input_method/candidate_window.cc @@ -244,7 +244,7 @@ int ComputeShortcutColumnWidth( // We'll create temporary shortcut labels, and choose the largest width. for (int i = 0; i < lookup_table.page_size; ++i) { shortcut_label->SetText( - CreateShortcutText(i, lookup_table.orientation)); + WideToUTF16Hack(CreateShortcutText(i, lookup_table.orientation))); shortcut_column_width = std::max(shortcut_column_width, wrapped_shortcut_label->GetPreferredSize().width()); @@ -281,7 +281,7 @@ int ComputeCandidateColumnWidth( const size_t index = start_from + i; candidate_label->SetText( - UTF8ToWide(lookup_table.candidates[index])); + UTF8ToUTF16(lookup_table.candidates[index])); candidate_column_width = std::max(candidate_column_width, candidate_label->GetPreferredSize().width()); @@ -308,7 +308,7 @@ int ComputeAnnotationColumnWidth(const InputMethodLookupTable& lookup_table) { const size_t index = start_from + i; annotation_label->SetText( - UTF8ToWide(lookup_table.annotations[index])); + UTF8ToUTF16(lookup_table.annotations[index])); annotation_column_width = std::max(annotation_column_width, annotation_label->GetPreferredSize().width()); @@ -396,7 +396,7 @@ class InformationTextArea : public HidableArea { // Set the displayed text. void SetText(const std::string& utf8_text) { - label_->SetText(UTF8ToWide(utf8_text)); + label_->SetText(UTF8ToUTF16(utf8_text)); } protected: @@ -655,7 +655,6 @@ class InfolistView; // InfolistWindowView is the main container of the infolist window UI. class InfolistWindowView : public views::View { public: - InfolistWindowView( views::Widget* parent_frame, views::Widget* candidate_window_frame); virtual ~InfolistWindowView(); @@ -865,15 +864,15 @@ void CandidateView::Init(int shortcut_column_width, } void CandidateView::SetCandidateText(const std::wstring& text) { - candidate_label_->SetText(text); + candidate_label_->SetText(WideToUTF16Hack(text)); } void CandidateView::SetShortcutText(const std::wstring& text) { - shortcut_label_->SetText(text); + shortcut_label_->SetText(WideToUTF16Hack(text)); } void CandidateView::SetAnnotationText(const std::wstring& text) { - annotation_label_->SetText(text); + annotation_label_->SetText(WideToUTF16Hack(text)); } void CandidateView::SetInfolistIcon(bool enable) { @@ -1417,11 +1416,11 @@ void InfolistView::Init() { void InfolistView::SetTitleText(const std::wstring& text) { - title_label_->SetText(text); + title_label_->SetText(WideToUTF16Hack(text)); } void InfolistView::SetDescriptionText(const std::wstring& text) { - description_label_->SetText(text); + description_label_->SetText(WideToUTF16Hack(text)); } void InfolistView::Select() { @@ -1480,8 +1479,7 @@ void InfolistWindowView::Init() { caption_label->SetFont(caption_label->font().DeriveFont(kFontSizeDelta - 2)); caption_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); caption_label->SetText( - UTF16ToWide( - l10n_util::GetStringUTF16(IDS_INPUT_METHOD_INFOLIST_WINDOW_TITLE))); + l10n_util::GetStringUTF16(IDS_INPUT_METHOD_INFOLIST_WINDOW_TITLE)); views::View* wrapped_caption_label = WrapWithPadding(caption_label, gfx::Insets(2, 2, 2, 2)); wrapped_caption_label->set_background( diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index e63e6e5..ab7f42e 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -316,12 +316,12 @@ void BackgroundView::OnLocaleChanged() { void BackgroundView::OnOSVersionLabelTextUpdated( const std::string& os_version_label_text) { - os_version_label_->SetText(UTF8ToWide(os_version_label_text)); + os_version_label_->SetText(UTF8ToUTF16(os_version_label_text)); } void BackgroundView::OnBootTimesLabelTextUpdated( const std::string& boot_times_label_text) { - boot_times_label_->SetText(UTF8ToWide(boot_times_label_text)); + boot_times_label_->SetText(UTF8ToUTF16(boot_times_label_text)); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc index 20f24cf..22551b5 100644 --- a/chrome/browser/chromeos/login/captcha_view.cc +++ b/chrome/browser/chromeos/login/captcha_view.cc @@ -170,7 +170,7 @@ void CaptchaView::Init() { views::GridLayout::USE_PREF, 0, 0); layout->StartRow(0, column_view_set_id); Label* label = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS))); + l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS)); label->SetMultiLine(true); layout->AddView(label); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); @@ -189,8 +189,8 @@ void CaptchaView::Init() { layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->StartRow(0, column_view_set_id); - label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP))); + label = new views::Label( + l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP)); label->SetMultiLine(true); layout->AddView(label); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index 08ab4f2..d2a17d2 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -138,16 +138,16 @@ void TpmInfoView::Init() { column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); layout->StartRow(0, 0); - views::Label* label = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION))); + views::Label* label = new views::Label( + l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION)); label->SetMultiLine(true); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(label); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->StartRow(0, 0); - label = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY))); + label = new views::Label(l10n_util::GetStringUTF16( + IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY)); label->SetMultiLine(true); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(label); @@ -161,7 +161,7 @@ void TpmInfoView::Init() { gfx::Font password_font = rb.GetFont(ResourceBundle::MediumFont).DeriveFont(0, gfx::Font::BOLD); // Password will be set later. - password_label_ = new views::Label(L"", password_font); + password_label_ = new views::Label(string16(), password_font); password_label_->SetVisible(false); layout->AddView(password_label_); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); @@ -185,13 +185,13 @@ void TpmInfoView::Init() { throbber_->Start(); layout->AddView(throbber_); busy_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_TPM_BUSY))); + l10n_util::GetStringUTF16(IDS_EULA_TPM_BUSY)); layout->AddView(busy_label_); layout->AddPaddingRow(0, views::kRelatedControlHorizontalSpacing); } void TpmInfoView::ShowTpmPassword(const std::string& tpm_password) { - password_label_->SetText(ASCIIToWide(tpm_password)); + password_label_->SetText(ASCIIToUTF16(tpm_password)); password_label_->SetVisible(true); busy_label_->SetVisible(false); throbber_->Stop(); @@ -291,7 +291,7 @@ void EulaView::Init() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); gfx::Font label_font = rb.GetFont(ResourceBundle::MediumFont).DeriveFont(0, gfx::Font::NORMAL); - google_eula_label_ = new views::Label(std::wstring(), label_font); + google_eula_label_ = new views::Label(string16(), label_font); layout->AddView(google_eula_label_, 1, 1, views::GridLayout::LEADING, views::GridLayout::FILL); @@ -320,7 +320,7 @@ void EulaView::Init() { layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); layout->StartRow(0, SINGLE_CONTROL_ROW); - oem_eula_label_ = new views::Label(std::wstring(), label_font); + oem_eula_label_ = new views::Label(string16(), label_font); layout->AddView(oem_eula_label_, 1, 1, views::GridLayout::LEADING, views::GridLayout::FILL); @@ -383,10 +383,9 @@ void EulaView::UpdateLocalizedStrings() { // Load other labels from resources. usage_statistics_checkbox_->SetText( UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_CHECKBOX_ENABLE_LOGGING))); - learn_more_link_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE))); + learn_more_link_->SetText(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); system_security_settings_link_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING))); + l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING)); continue_button_->SetText(UTF16ToWide( l10n_util::GetStringUTF16(IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON))); back_button_->SetText( @@ -461,7 +460,7 @@ static bool PublishTitleIfReady(const TabContents* contents, TabContents* tab_contents = eula_view->dom_contents()->tab_contents(); if (contents != tab_contents) return false; - eula_label->SetText(UTF16ToWide(tab_contents->GetTitle())); + eula_label->SetText(tab_contents->GetTitle()); return true; } diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index 0092df2..28ed959 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -7,6 +7,7 @@ #include <vector> #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/helper.h" #include "grit/generated_resources.h" #include "grit/theme_resources_standard.h" @@ -62,7 +63,7 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type, icon_->SetImage(*image); layout->AddView(icon_); - text_ = new views::Label(text); + text_ = new views::Label(WideToUTF16Hack(text)); text_->SetMultiLine(true); text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); text_->SizeToFit(kMaxLabelWidth); @@ -79,7 +80,7 @@ MessageBubble::MessageBubble(views::Widget::InitParams::Type type, for (size_t i = 0; i < links.size(); ++i) { layout->StartRowWithPadding(0, 1, 0, kBorderSize); - views::Link* help_link_ = new views::Link(links[i]); + views::Link* help_link_ = new views::Link(WideToUTF16Hack(links[i])); help_links_.push_back(help_link_); help_link_->set_listener(this); help_link_->SetNormalColor(login::kLinkColor); diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc index 805faf5..e3eb0c5 100644 --- a/chrome/browser/chromeos/login/network_selection_view.cc +++ b/chrome/browser/chromeos/login/network_selection_view.cc @@ -343,26 +343,26 @@ void NetworkSelectionView::UpdateLocalizedStringsAndFonts() { UTF16ToWide(actor_->keyboard_switch_menu()->GetCurrentKeyboardName())); welcome_label_->SetFont(welcome_label_font); welcome_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE))); + l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); select_language_label_->SetFont(select_label_font); select_language_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT))); + l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT)); languages_menubutton_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT)); select_keyboard_label_->SetFont(select_label_font); select_keyboard_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT))); + l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT)); keyboards_menubutton_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT)); select_network_label_->SetFont(select_label_font); select_network_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT))); + l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT)); SetMenuButtonFont(network_dropdown_, base_font); network_dropdown_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT)); proxy_settings_link_->SetFont(base_font); - proxy_settings_link_->SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON))); + proxy_settings_link_->SetText( + l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); connecting_network_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); RecreateNativeControls(); UpdateConnectingNetworkLabel(); @@ -472,8 +472,8 @@ void NetworkSelectionView::RecreateNativeControls() { } void NetworkSelectionView::UpdateConnectingNetworkLabel() { - connecting_network_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16( - IDS_NETWORK_SELECTION_CONNECTING, network_id_))); + connecting_network_label_->SetText(l10n_util::GetStringFUTF16( + IDS_NETWORK_SELECTION_CONNECTING, network_id_)); } } // namespace chromeos diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc index 588d32e..3859978 100644 --- a/chrome/browser/chromeos/login/new_user_view.cc +++ b/chrome/browser/chromeos/login/new_user_view.cc @@ -289,11 +289,10 @@ void NewUserView::UpdateLocalizedStringsAndFonts() { const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); title_label_->SetFont(title_font); - title_label_->SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_LOGIN_TITLE))); + title_label_->SetText( + l10n_util::GetStringUTF16(IDS_LOGIN_TITLE)); title_hint_label_->SetFont(title_hint_font); - title_hint_label_->SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_LOGIN_TITLE_HINT))); + title_hint_label_->SetText(l10n_util::GetStringUTF16(IDS_LOGIN_TITLE_HINT)); SetAndCorrectTextfieldFont(username_field_, base_font); username_field_->set_text_to_display_when_empty( l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME)); @@ -304,13 +303,13 @@ void NewUserView::UpdateLocalizedStringsAndFonts() { l10n_util::GetStringUTF16(IDS_LOGIN_BUTTON))); if (need_guest_link_) { guest_link_->SetFont(base_font); - guest_link_->SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON))); + guest_link_->SetText( + l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)); } if (need_create_account_) { create_account_link_->SetFont(base_font); create_account_link_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON))); + l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON)); } delegate_->ClearErrors(); languages_menubutton_->SetText( @@ -427,7 +426,7 @@ void NewUserView::Layout() { y += setViewBounds(password_field_, x, y, width, true) + kRowPad; int sign_in_button_width = sign_in_button_->GetPreferredSize().width(); - setViewBounds(sign_in_button_, x, y, sign_in_button_width,true); + setViewBounds(sign_in_button_, x, y, sign_in_button_width, true); SchedulePaint(); } @@ -571,7 +570,7 @@ bool NewUserView::NavigateAway() { } void NewUserView::InitLink(views::Link** link) { - *link = new views::Link(std::wstring()); + *link = new views::Link(string16()); (*link)->set_listener(this); (*link)->SetNormalColor(login::kLinkColor); (*link)->SetHighlightedColor(login::kLinkColor); diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc index 131c3c2..c85c73e 100644 --- a/chrome/browser/chromeos/login/password_changed_view.cc +++ b/chrome/browser/chromeos/login/password_changed_view.cc @@ -97,12 +97,12 @@ void PasswordChangedView::Init() { title_label_ = new Label(); title_label_->SetFont(title_font); title_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE))); + l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE)); title_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); description_label_ = new Label(); description_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC))); + l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC)); description_label_->SetMultiLine(true); description_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); diff --git a/chrome/browser/chromeos/login/take_photo_view.cc b/chrome/browser/chromeos/login/take_photo_view.cc index 91674f2..1046472 100644 --- a/chrome/browser/chromeos/login/take_photo_view.cc +++ b/chrome/browser/chromeos/login/take_photo_view.cc @@ -108,7 +108,7 @@ class CameraImageView : public views::ImageView { void SetMessage(const std::wstring& message) { DCHECK(message_); - message_->SetText(message); + message_->SetText(WideToUTF16Hack(message)); message_->SetVisible(!message.empty()); Layout(); } @@ -161,7 +161,7 @@ TakePhotoView::~TakePhotoView() { void TakePhotoView::Init() { if (show_title_) { title_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_USER_IMAGE_SCREEN_TITLE))); + l10n_util::GetStringUTF16(IDS_USER_IMAGE_SCREEN_TITLE)); title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); title_label_->SetMultiLine(true); CorrectLabelFontSize(title_label_); diff --git a/chrome/browser/chromeos/login/update_view.cc b/chrome/browser/chromeos/login/update_view.cc index 3755e42..1834be5 100644 --- a/chrome/browser/chromeos/login/update_view.cc +++ b/chrome/browser/chromeos/login/update_view.cc @@ -101,7 +101,7 @@ void UpdateView::Init() { InitLabel(&escape_to_skip_label_); escape_to_skip_label_->SetColor(kSkipLabelColor); escape_to_skip_label_->SetText( - L"Press ESCAPE to skip (Non-official builds only)"); + ASCIIToUTF16("Press ESCAPE to skip (Non-official builds only)")); #endif UpdateLocalizedStrings(); @@ -113,17 +113,17 @@ void UpdateView::Reset() { } void UpdateView::UpdateLocalizedStrings() { - installing_updates_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16( + installing_updates_label_->SetText(l10n_util::GetStringFUTF16( IDS_INSTALLING_UPDATE, - l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)))); + l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))); preparing_updates_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE))); + l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE)); reboot_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC))); + l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)); manual_reboot_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED))); + l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)); checking_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES))); + l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)); } void UpdateView::AddProgress(int ticks) { @@ -260,7 +260,7 @@ void UpdateView::UpdateVisibility() { NOTREACHED(); } const std::string text = - label_spoken ? WideToUTF8(label_spoken->GetText()) : std::string(); + label_spoken ? UTF16ToUTF8(label_spoken->GetText()) : std::string(); WizardAccessibilityHelper::GetInstance()->MaybeSpeak(text.c_str(), false, true); } diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc index 069cdc9..6ce5661 100644 --- a/chrome/browser/chromeos/login/user_controller.cc +++ b/chrome/browser/chromeos/login/user_controller.cc @@ -459,16 +459,16 @@ void UserController::CreateBorderWindow(int index, } Widget* UserController::CreateLabelWidget(int index, WmIpcWindowType type) { - std::wstring text; + string16 text; if (is_guest_) { - text = std::wstring(); + text = string16(); } else if (is_new_user_) { // Add user should have label only in activated state. // When new user is the only, label is not needed. if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0) - text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER)); + text = l10n_util::GetStringUTF16(IDS_ADD_USER); } else { - text = UTF8ToWide(user_.GetDisplayName()); + text = UTF8ToUTF16(user_.GetDisplayName()); } views::Label* label = NULL; @@ -476,11 +476,12 @@ Widget* UserController::CreateLabelWidget(int index, WmIpcWindowType type) { if (is_new_user_) { label = new views::Label(text); } else if (type == WM_IPC_WINDOW_LOGIN_LABEL) { - label = UsernameView::CreateShapedUsernameView(text, false); + label = UsernameView::CreateShapedUsernameView(UTF16ToWide(text), false); } else { DCHECK(type == WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL); // TODO(altimofeev): switch to the rounded username view. - label = UsernameView::CreateShapedUsernameView(text, true); + label = UsernameView::CreateShapedUsernameView( + UTF16ToWideHack(text), true); } const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? diff --git a/chrome/browser/chromeos/login/user_image_view.cc b/chrome/browser/chromeos/login/user_image_view.cc index 43df7ba..9bfda9d 100644 --- a/chrome/browser/chromeos/login/user_image_view.cc +++ b/chrome/browser/chromeos/login/user_image_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/login/user_image_view.h" +#include <string> + #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/login/default_images_view.h" @@ -47,7 +49,7 @@ const int kSplitterHeight = 1; enum ColumnSets { kTitleRow, // Column set for screen title. kImagesRow, // Column set for image from camera and snapshot button. - kSplitterRow, // Place for the splitter. + kSplitterRow, // Place for the splitter. kButtonsRow, // Column set for OK button. }; @@ -80,8 +82,8 @@ void UserImageView::Init() { &BorderDefinition::kScreenBorder); set_background(views::Background::CreateBackgroundPainter(true, painter)); - title_label_ = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT))); + title_label_ = new views::Label( + l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT)); title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); title_label_->SetMultiLine(true); CorrectLabelFontSize(title_label_); diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc index 8cca3fe..7805502 100644 --- a/chrome/browser/chromeos/login/user_view.cc +++ b/chrome/browser/chromeos/login/user_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/login/user_view.h" +#include <algorithm> + #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/rounded_rect_painter.h" @@ -72,12 +74,12 @@ class SignoutView : public views::View { const gfx::Font& font = rb.GetFont(ResourceBundle::SmallFont); active_user_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_ACTIVE_USER))); + l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_ACTIVE_USER)); active_user_label_->SetFont(font); active_user_label_->SetColor(kTextColor); signout_link_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT))); + l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT)); signout_link_->set_listener(link_listener); signout_link_->SetFont(font); signout_link_->SetColor(kTextColor); diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc index 34f657e..316b245 100644 --- a/chrome/browser/chromeos/login/username_view.cc +++ b/chrome/browser/chromeos/login/username_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/login/username_view.h" +#include <algorithm> + #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/rounded_view.h" @@ -25,14 +27,11 @@ namespace { const SkColor kLabelBackgoundColor = 0x55000000; // Holds margin to height ratio. const double kMarginRatio = 1.0 / 3.0; -// Holds the frame width for the small shaped username view. -const SkScalar kSmallShapeFrameWidth = SkIntToScalar(1); - } // namespace UsernameView::UsernameView(const std::wstring& username, bool use_small_shape) : views::Label(username.empty() - ? UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST)) : username), + ? l10n_util::GetStringUTF16(IDS_GUEST) : WideToUTF16Hack(username)), use_small_shape_(use_small_shape), is_guest_(username.empty()) { } @@ -70,7 +69,7 @@ void UsernameView::PaintUsername(const gfx::Rect& bounds) { gfx::Canvas::TEXT_VALIGN_MIDDLE | gfx::Canvas::NO_ELLIPSIS; int text_height, text_width; - gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(GetText()), font(), + gfx::CanvasSkia::SizeStringInt(GetText(), font(), &text_width, &text_height, flags); text_width += margin_width_; @@ -115,7 +114,7 @@ void UsernameView::PaintUsername(const gfx::Rect& bounds) { // Note, direct call of the DrawStringInt method produces the green dots // along the text perimeter (when the label is place on the white background). SkColor kInvisibleHaloColor = 0x00000000; - canvas.DrawStringWithHalo(WideToUTF16Hack(GetText()), font(), GetColor(), + canvas.DrawStringWithHalo(GetText(), font(), GetColor(), kInvisibleHaloColor, bounds.x() + margin_width_, bounds.y(), bounds.width() - 2 * margin_width_, bounds.height(), flags); @@ -144,7 +143,7 @@ void UsernameView::PaintUsername(const gfx::Rect& bounds) { void UsernameView::OnLocaleChanged() { if (is_guest_) { - SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST))); + SetText(l10n_util::GetStringUTF16(IDS_GUEST)); } // Repaint because the font may have changed. text_image_.reset(); diff --git a/chrome/browser/chromeos/login/web_page_view.cc b/chrome/browser/chromeos/login/web_page_view.cc index 59073ab..9f8e79d 100644 --- a/chrome/browser/chromeos/login/web_page_view.cc +++ b/chrome/browser/chromeos/login/web_page_view.cc @@ -117,11 +117,11 @@ void WebPageView::Init() { connecting_label_ = new views::Label(); connecting_label_->SetText( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING))); + l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING)); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); connecting_label_->SetVisible(false); - AddChildView(connecting_label_ ); + AddChildView(connecting_label_); start_timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kStartDelayMs), diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc index c0df06f..4d77e76 100644 --- a/chrome/browser/chromeos/options/vpn_config_view.cc +++ b/chrome/browser/chromeos/options/vpn_config_view.cc @@ -87,6 +87,7 @@ class ServerCACertComboboxModel : public ui::ComboboxModel { int cert_index = combo_index - 1; return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index); } + private: CertLibrary* cert_library_; DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel); @@ -115,6 +116,7 @@ class UserCertComboboxModel : public ui::ComboboxModel { IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); return cert_library_->GetUserCertificates().GetDisplayStringAt(combo_index); } + private: CertLibrary* cert_library_; DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel); @@ -344,7 +346,7 @@ const std::string VPNConfigView::GetServerCACertNssNickname() const { return std::string(); } else { DCHECK(cert_library_); - DCHECK(cert_library_->GetCACertificates().Size() > 0); + DCHECK_GT(cert_library_->GetCACertificates().Size(), 0); int cert_index = selected - 1; return cert_library_->GetCACertificates().GetNicknameAt(cert_index); } @@ -391,8 +393,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Server label and input. layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME))); if (!vpn) { server_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); server_textfield_->SetController(this); @@ -400,7 +402,7 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { server_text_ = NULL; } else { server_hostname_ = vpn->server_hostname(); - server_text_ = new views::Label(UTF8ToWide(server_hostname_)); + server_text_ = new views::Label(UTF8ToUTF16(server_hostname_)); server_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(server_text_); server_textfield_ = NULL; @@ -409,15 +411,15 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Service label and name or input. layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); if (!vpn) { service_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); service_textfield_->SetController(this); layout->AddView(service_textfield_); service_text_ = NULL; } else { - service_text_ = new views::Label(ASCIIToWide(vpn->name())); + service_text_ = new views::Label(ASCIIToUTF16(vpn->name())); service_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(service_text_); service_textfield_ = NULL; @@ -426,8 +428,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Provider type label and select. layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); if (!vpn) { provider_type_combobox_ = new views::Combobox(new ProviderTypeComboboxModel()); @@ -436,7 +438,7 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { provider_type_text_label_ = NULL; } else { provider_type_text_label_ = - new views::Label(UTF16ToWide(ProviderTypeToString(provider_type_))); + new views::Label(ProviderTypeToString(provider_type_)); provider_type_text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(provider_type_text_label_); provider_type_combobox_ = NULL; @@ -445,9 +447,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // PSK passphrase label, input and visible button. layout->StartRow(0, column_view_set_id); - psk_passphrase_label_ = new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE))); + psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); layout->AddView(psk_passphrase_label_); psk_passphrase_textfield_ = new views::Textfield( views::Textfield::STYLE_PASSWORD); @@ -460,8 +461,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Server CA certificate layout->StartRow(0, column_view_set_id); server_ca_cert_label_ = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA))); + new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); layout->AddView(server_ca_cert_label_); ServerCACertComboboxModel* server_ca_cert_model = new ServerCACertComboboxModel(cert_library_); @@ -471,8 +472,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // User certificate label and input. layout->StartRow(0, column_view_set_id); - user_cert_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT))); + user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT)); layout->AddView(user_cert_label_); UserCertComboboxModel* user_cert_model = new UserCertComboboxModel(cert_library_); @@ -483,8 +484,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Username label and input. layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME))); username_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); username_textfield_->SetController(this); if (vpn && !vpn->username().empty()) @@ -494,9 +495,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // User passphrase label, input and visble button. layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide( - l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); user_passphrase_textfield_ = new views::Textfield( views::Textfield::STYLE_PASSWORD); user_passphrase_textfield_->SetController(this); @@ -507,8 +507,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // OTP label and input. layout->StartRow(0, column_view_set_id); - otp_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP))); + otp_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP)); layout->AddView(otp_label_); otp_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); otp_textfield_->SetController(this); @@ -523,8 +523,8 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { // Group Name label and input. if (show_group_name) { layout->StartRow(0, column_view_set_id); - group_name_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME))); + group_name_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME)); layout->AddView(group_name_label_); group_name_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); @@ -639,7 +639,6 @@ void VPNConfigView::UpdateControls() { group_name_label_->SetEnabled(enable_group_name); if (group_name_textfield_) group_name_textfield_->SetEnabled(enable_group_name); - } void VPNConfigView::UpdateErrorLabel() { @@ -669,7 +668,7 @@ void VPNConfigView::UpdateErrorLabel() { } } if (!error_msg.empty()) { - error_label_->SetText(UTF8ToWide(error_msg)); + error_label_->SetText(UTF8ToUTF16(error_msg)); error_label_->SetVisible(true); } else { error_label_->SetVisible(false); diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index ba6e5b7..5fdb77c 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -98,17 +98,18 @@ class EAPMethodComboboxModel : public ui::ComboboxModel { NOTREACHED(); return string16(); } + private: DISALLOW_COPY_AND_ASSIGN(EAPMethodComboboxModel); }; enum Phase2AuthComboboxIndex { - PHASE_2_AUTH_INDEX_AUTO = 0, // LEAP, EAP-TLS have only this auth. + PHASE_2_AUTH_INDEX_AUTO = 0, // LEAP, EAP-TLS have only this auth. PHASE_2_AUTH_INDEX_MD5 = 1, - PHASE_2_AUTH_INDEX_MSCHAPV2 = 2, // PEAP has up to this auth. + PHASE_2_AUTH_INDEX_MSCHAPV2 = 2, // PEAP has up to this auth. PHASE_2_AUTH_INDEX_MSCHAP = 3, PHASE_2_AUTH_INDEX_PAP = 4, - PHASE_2_AUTH_INDEX_CHAP = 5, // EAP-TTLS has up to this auth. + PHASE_2_AUTH_INDEX_CHAP = 5, // EAP-TTLS has up to this auth. PHASE_2_AUTH_INDEX_COUNT = 6 }; @@ -153,6 +154,7 @@ class Phase2AuthComboboxModel : public ui::ComboboxModel { NOTREACHED(); return string16(); } + private: views::Combobox* eap_method_combobox_; DISALLOW_COPY_AND_ASSIGN(Phase2AuthComboboxModel); @@ -203,6 +205,7 @@ class ServerCACertComboboxModel : public ui::ComboboxModel { int cert_index = combo_index - 1; return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index); } + private: CertLibrary* cert_library_; DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel); @@ -232,6 +235,7 @@ class UserCertComboboxModel : public ui::ComboboxModel { IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); return cert_library_->GetUserCertificates().GetDisplayStringAt(combo_index); } + private: CertLibrary* cert_library_; DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel); @@ -471,7 +475,7 @@ void WifiConfigView::UpdateErrorLabel() { } } if (!error_msg.empty()) { - error_label_->SetText(UTF8ToWide(error_msg)); + error_label_->SetText(UTF8ToUTF16(error_msg)); error_label_->SetVisible(true); } else { error_label_->SetVisible(false); @@ -757,8 +761,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // SSID input layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); if (!wifi) { ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); ssid_textfield_->SetController(this); @@ -766,7 +770,7 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); layout->AddView(ssid_textfield_); } else { - views::Label* label = new views::Label(UTF8ToWide(wifi->name())); + views::Label* label = new views::Label(UTF8ToUTF16(wifi->name())); label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); layout->AddView(label); } @@ -775,8 +779,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // Security select if (!wifi && !show_8021x) { layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))); security_combobox_ = new views::Combobox(new SecurityComboboxModel()); security_combobox_->set_listener(this); layout->AddView(security_combobox_); @@ -792,8 +796,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // EAP method layout->StartRow(0, column_view_set_id); - layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD)))); + layout->AddView(new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); eap_method_combobox_->set_listener(this); layout->AddView(eap_method_combobox_); @@ -801,9 +805,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // Phase 2 authentication layout->StartRow(0, column_view_set_id); - phase_2_auth_label_ = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH))); + phase_2_auth_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH)); layout->AddView(phase_2_auth_label_); phase_2_auth_combobox_ = new views::Combobox( new Phase2AuthComboboxModel(eap_method_combobox_)); @@ -815,9 +818,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // Server CA certificate layout->StartRow(0, column_view_set_id); - server_ca_cert_label_ = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA))); + server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); layout->AddView(server_ca_cert_label_); server_ca_cert_combobox_ = new ComboboxWithWidth( new ServerCACertComboboxModel(cert_library_), @@ -830,9 +832,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // User certificate layout->StartRow(0, column_view_set_id); - user_cert_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT))); + user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)); layout->AddView(user_cert_label_); user_cert_combobox_ = new views::Combobox( new UserCertComboboxModel(cert_library_)); @@ -844,8 +845,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // Identity layout->StartRow(0, column_view_set_id); - identity_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))); + identity_label_ = new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)); layout->AddView(identity_label_); identity_textfield_ = new views::Textfield( views::Textfield::STYLE_DEFAULT); @@ -860,7 +861,7 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { layout->StartRow(0, column_view_set_id); int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; passphrase_label_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(label_text_id))); + l10n_util::GetStringUTF16(label_text_id)); layout->AddView(passphrase_label_); passphrase_textfield_ = new views::Textfield( views::Textfield::STYLE_PASSWORD); @@ -904,8 +905,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { // Anonymous identity layout->StartRow(0, column_view_set_id); identity_anonymous_label_ = - new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS))); + new views::Label(l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); layout->AddView(identity_anonymous_label_); identity_anonymous_textfield_ = new views::Textfield( views::Textfield::STYLE_DEFAULT); diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index 293d850..f502c8b 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -83,13 +83,13 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate) const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); heading_ = new views::Label( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING))); + l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)); heading_->set_border(views::Border::CreateEmptyBorder( kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0)); heading_->SetFont(font); heading_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); - heading_->SetText(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING))); + heading_->SetText( + l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)); AddChildView(heading_); message_ = new views::Label(); @@ -113,7 +113,7 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate) AddChildView(try_again_); mic_settings_ = new views::Link( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS))); + l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS)); mic_settings_->set_listener(this); AddChildView(mic_settings_); } @@ -131,7 +131,7 @@ void ContentView::UpdateLayout(SpeechInputBubbleBase::DisplayMode mode, heading_->SetVisible(mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING); if (is_message) { - message_->SetText(UTF16ToWideHack(message_text)); + message_->SetText(message_text); } else { SetImage(image); } 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 b76a1e1..f0922fc 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -277,7 +277,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_); @@ -690,8 +690,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 a36802a..339b2db 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, @@ -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. @@ -699,11 +697,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 2bb2467..dba4612 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 35bb187..3ee4c06 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..456cc79 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -314,7 +314,7 @@ void BookmarkEditorView::Init() { title_label_ = new views::Label( UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL))); - title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText())); + title_tf_.SetAccessibleName(title_label_->GetText()); if (show_tree_) { tree_view_ = new views::TreeView(); @@ -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 6800649..803b998 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(); 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/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 9c6c252..596df6a 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/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 4cadace..eb947a8 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,31 +28,31 @@ 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_)); - ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL)); - cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL)); + 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_)); - ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL)); - cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16( - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL)); + product_name_); + ok_button_text_ = l10n_util::GetStringUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL); + cancel_button_text_ = l10n_util::GetStringUTF16( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); } // There are two lines of text: the bold warning label and the text @@ -100,10 +100,10 @@ gfx::Size DownloadInProgressDialogView::GetPreferredSize() { std::wstring DownloadInProgressDialogView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) - return ok_button_text_; + return UTF16ToWideHack(ok_button_text_); DCHECK_EQ(MessageBoxFlags::DIALOGBUTTON_CANCEL, button); - return cancel_button_text_; + return UTF16ToWideHack(cancel_button_text_); } int DownloadInProgressDialogView::GetDefaultDialogButton() const { diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view.h b/chrome/browser/ui/views/download/download_in_progress_dialog_view.h index c65d06a..6b40442 100644 --- a/chrome/browser/ui/views/download/download_in_progress_dialog_view.h +++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view.h @@ -47,8 +47,8 @@ class DownloadInProgressDialogView : public views::DialogDelegateView { views::Label* warning_; views::Label* explanation_; - std::wstring ok_button_text_; - std::wstring cancel_button_text_; + string16 ok_button_text_; + string16 cancel_button_text_; string16 product_name_; diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 33951dd..6ca864e 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 45a27f6..5c7d13b 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 0e196e3..8d48d45 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 b542612..96a0548 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc @@ -154,8 +154,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..b391010 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -421,9 +421,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_); 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 2716050..7bdbb52 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/importer/import_progress_dialog_view.cc b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc index e4ff5a1..30bf7fb 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), @@ -289,7 +289,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 66fefaa..b497124 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" @@ -440,7 +443,7 @@ 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)) { + } else if (suggested_text_view_->GetText() != text) { suggested_text_view_->SetText(UTF16ToWide(text)); } if (animate_to_complete && !location_entry_->IsImeComposing()) @@ -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 62f3f31..1caca16 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" @@ -285,7 +286,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/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index c83440e..5c78d68 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(); } diff --git a/views/controls/label.cc b/views/controls/label.cc index e61c6e1..867b24f 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -4,8 +4,10 @@ #include "views/controls/label.h" +#include <algorithm> #include <cmath> #include <limits> +#include <vector> #include "base/i18n/rtl.h" #include "base/logging.h" @@ -33,14 +35,14 @@ const char Label::kViewClassName[] = "views/Label"; const int Label::kFocusBorderPadding = 1; Label::Label() { - Init(std::wstring(), GetDefaultFont()); + Init(string16(), GetDefaultFont()); } -Label::Label(const std::wstring& text) { +Label::Label(const string16& text) { Init(text, GetDefaultFont()); } -Label::Label(const std::wstring& text, const gfx::Font& font) { +Label::Label(const string16& text, const gfx::Font& font) { Init(text, font); } @@ -54,16 +56,16 @@ void Label::SetFont(const gfx::Font& font) { SchedulePaint(); } -void Label::SetText(const std::wstring& text) { - text_ = WideToUTF16Hack(text); +void Label::SetText(const string16& text) { + text_ = text; url_set_ = false; text_size_valid_ = false; PreferredSizeChanged(); SchedulePaint(); } -const std::wstring Label::GetText() const { - return url_set_ ? UTF8ToWide(url_.spec()) : UTF16ToWideHack(text_); +const string16 Label::GetText() const { + return url_set_ ? UTF8ToUTF16(url_.spec()) : text_; } void Label::SetURL(const GURL& url) { @@ -259,10 +261,10 @@ void Label::GetAccessibleState(ui::AccessibleViewState* state) { } void Label::PaintText(gfx::Canvas* canvas, - const std::wstring& text, + const string16& text, const gfx::Rect& text_bounds, int flags) { - canvas->DrawStringInt(WideToUTF16Hack(text), font_, color_, + canvas->DrawStringInt(text, font_, color_, text_bounds.x(), text_bounds.y(), text_bounds.width(), text_bounds.height(), flags); @@ -303,7 +305,7 @@ void Label::OnBoundsChanged(const gfx::Rect& previous_bounds) { void Label::OnPaint(gfx::Canvas* canvas) { OnPaintBackground(canvas); - std::wstring paint_text; + string16 paint_text; gfx::Rect text_bounds; int flags = 0; CalculateDrawStringParams(&paint_text, &text_bounds, &flags); @@ -323,7 +325,7 @@ gfx::Font Label::GetDefaultFont() { return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); } -void Label::Init(const std::wstring& text, const gfx::Font& font) { +void Label::Init(const string16& text, const gfx::Font& font) { static bool initialized = false; if (!initialized) { #if defined(OS_WIN) @@ -432,7 +434,7 @@ gfx::Rect Label::GetAvailableRect() const { return bounds; } -void Label::CalculateDrawStringParams(std::wstring* paint_text, +void Label::CalculateDrawStringParams(string16* paint_text, gfx::Rect* text_bounds, int* flags) const { DCHECK(paint_text && text_bounds && flags); @@ -440,8 +442,8 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text, if (url_set_) { // TODO(jungshik) : Figure out how to get 'intl.accept_languages' // preference and use it when calling ElideUrl. - *paint_text = UTF16ToWideHack( - ui::ElideUrl(url_, font_, GetAvailableRect().width(), std::string())); + *paint_text = ui::ElideUrl(url_, font_, GetAvailableRect().width(), + std::string()); // An URLs is always treated as an LTR text and therefore we should // explicitly mark it as such if the locale is RTL so that URLs containing @@ -452,13 +454,13 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text, // characters. We use the locale settings because an URL is always treated // as an LTR string, even if its containing view does not use an RTL UI // layout. - *paint_text = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( - WideToUTF16(*paint_text))); + *paint_text = base::i18n::GetDisplayStringInLTRDirectionality( + *paint_text); } else if (elide_in_middle_) { - *paint_text = UTF16ToWideHack(ui::ElideText(text_, - font_, GetAvailableRect().width(), true)); + *paint_text = ui::ElideText(text_, font_, GetAvailableRect().width(), + true); } else { - *paint_text = UTF16ToWideHack(text_); + *paint_text = text_; } *text_bounds = GetTextBounds(); diff --git a/views/controls/label.h b/views/controls/label.h index 617d08f..74cf667 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -9,6 +9,7 @@ #include <string> #include "base/gtest_prod_util.h" +#include "base/string16.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/font.h" @@ -52,21 +53,21 @@ class VIEWS_EXPORT Label : public View { static const int kFocusBorderPadding; Label(); - explicit Label(const std::wstring& text); - Label(const std::wstring& text, const gfx::Font& font); + explicit Label(const string16& text); + Label(const string16& text, const gfx::Font& font); virtual ~Label(); // Set the font. virtual void SetFont(const gfx::Font& font); // Set the label text. - void SetText(const std::wstring& text); + void SetText(const string16& text); // Return the font used by this label. gfx::Font font() const { return font_; } // Return the label text. - const std::wstring GetText() const; + const string16 GetText() const; // Set URL Value - text_ is set to spec(). void SetURL(const GURL& url); @@ -182,7 +183,7 @@ class VIEWS_EXPORT Label : public View { // Called by Paint to paint the text. Override this to change how // text is painted. virtual void PaintText(gfx::Canvas* canvas, - const std::wstring& text, + const string16& text, const gfx::Rect& text_bounds, int flags); @@ -208,7 +209,7 @@ class VIEWS_EXPORT Label : public View { static gfx::Font GetDefaultFont(); - void Init(const std::wstring& text, const gfx::Font& font); + void Init(const string16& text, const gfx::Font& font); // If the mouse is over the text, SetContainsMouse(true) is invoked, otherwise // SetContainsMouse(false) is invoked. @@ -227,7 +228,7 @@ class VIEWS_EXPORT Label : public View { gfx::Rect GetAvailableRect() const; // Returns parameters to be used for the DrawString call. - void CalculateDrawStringParams(std::wstring* paint_text, + void CalculateDrawStringParams(string16* paint_text, gfx::Rect* text_bounds, int* flags) const; diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc index db3d491..68fc296 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -41,7 +41,7 @@ TEST(LabelTest, FontPropertyArial) { TEST(LabelTest, TextProperty) { Label label; - std::wstring test_text(L"A random string."); + string16 test_text(ASCIIToUTF16("A random string.")); label.SetText(test_text); EXPECT_EQ(test_text, label.GetText()); } @@ -52,7 +52,7 @@ TEST(LabelTest, UrlProperty) { GURL url(my_url); label.SetURL(url); EXPECT_EQ(my_url, label.GetURL().spec()); - EXPECT_EQ(UTF8ToWide(my_url), label.GetText()); + EXPECT_EQ(UTF8ToUTF16(my_url), label.GetText()); } TEST(LabelTest, ColorProperty) { @@ -111,7 +111,7 @@ TEST(LabelTest, MultiLineProperty) { TEST(LabelTest, TooltipProperty) { Label label; string16 test_text(ASCIIToUTF16("My cool string.")); - label.SetText(UTF16ToWideHack(test_text)); + label.SetText(test_text); string16 tooltip; EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); @@ -158,7 +158,7 @@ TEST(LabelTest, TooltipProperty) { TEST(LabelTest, Accessibility) { Label label; string16 test_text(ASCIIToUTF16("My special text.")); - label.SetText(UTF16ToWideHack(test_text)); + label.SetText(test_text); ui::AccessibleViewState state; label.GetAccessibleState(&state); @@ -169,7 +169,7 @@ TEST(LabelTest, Accessibility) { TEST(LabelTest, SingleLineSizing) { Label label; - std::wstring test_text(L"A not so random string in one line."); + string16 test_text(ASCIIToUTF16("A not so random string in one line.")); label.SetText(test_text); // GetPreferredSize @@ -196,7 +196,8 @@ TEST(LabelTest, SingleLineSizing) { TEST(LabelTest, MultiLineSizing) { Label label; label.set_focusable(false); - std::wstring test_text(L"A random string\nwith multiple lines\nand returns!"); + string16 test_text( + ASCIIToUTF16("A random string\nwith multiple lines\nand returns!")); label.SetText(test_text); label.SetMultiLine(true); @@ -284,7 +285,7 @@ TEST(LabelTest, DrawSingleLineString) { // align right really means align left. label.set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT); - std::wstring test_text(L"Here's a string with no returns."); + string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); label.SetText(test_text); gfx::Size required_size(label.GetPreferredSize()); gfx::Size extra(22, 8); @@ -294,7 +295,7 @@ TEST(LabelTest, DrawSingleLineString) { required_size.height() + extra.height()); // Do some basic verifications for all three alignments. - std::wstring paint_text; + string16 paint_text; gfx::Rect text_bounds; int flags; @@ -402,7 +403,7 @@ TEST(LabelTest, DrawMultiLineString) { // align right really means align left. label.set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT); - std::wstring test_text(L"Another string\nwith returns\n\n!"); + string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); label.SetText(test_text); label.SetMultiLine(true); label.SizeToFit(0); @@ -413,7 +414,7 @@ TEST(LabelTest, DrawMultiLineString) { label.height() + extra.height()); // Do some basic verifications for all three alignments. - std::wstring paint_text; + string16 paint_text; gfx::Rect text_bounds; int flags; label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); @@ -542,7 +543,7 @@ TEST(LabelTest, DrawSingleLineStringInRTL) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); - std::wstring test_text(L"Here's a string with no returns."); + string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); label.SetText(test_text); gfx::Size required_size(label.GetPreferredSize()); gfx::Size extra(22, 8); @@ -552,7 +553,7 @@ TEST(LabelTest, DrawSingleLineStringInRTL) { required_size.height() + extra.height()); // Do some basic verifications for all three alignments. - std::wstring paint_text; + string16 paint_text; gfx::Rect text_bounds; int flags; @@ -664,7 +665,7 @@ TEST(LabelTest, DrawMultiLineStringInRTL) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); - std::wstring test_text(L"Another string\nwith returns\n\n!"); + string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); label.SetText(test_text); label.SetMultiLine(true); label.SizeToFit(0); @@ -675,7 +676,7 @@ TEST(LabelTest, DrawMultiLineStringInRTL) { label.height() + extra.height()); // Do some basic verifications for all three alignments. - std::wstring paint_text; + string16 paint_text; gfx::Rect text_bounds; int flags; label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); diff --git a/views/controls/link.cc b/views/controls/link.cc index b6874b9..99753d0 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -11,6 +11,7 @@ #endif #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/color_utils.h" @@ -65,16 +66,18 @@ namespace views { const char Link::kViewClassName[] = "views/Link"; -Link::Link() : Label(L""), - listener_(NULL), - highlighted_(false) { +Link::Link() + : Label(string16()), + listener_(NULL), + highlighted_(false) { Init(); set_focusable(true); } -Link::Link(const std::wstring& title) : Label(title), - listener_(NULL), - highlighted_(false) { +Link::Link(const string16& title) + : Label(title), + listener_(NULL), + highlighted_(false) { Init(); set_focusable(true); } diff --git a/views/controls/link.h b/views/controls/link.h index 2392bee..cfded7b 100644 --- a/views/controls/link.h +++ b/views/controls/link.h @@ -25,7 +25,7 @@ class LinkListener; class VIEWS_EXPORT Link : public Label { public: Link(); - explicit Link(const std::wstring& title); + explicit Link(const string16& title); virtual ~Link(); const LinkListener* listener() { return listener_; } diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index cd51b67..a11edbd 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -32,7 +32,7 @@ MessageBoxView::MessageBoxView(int dialog_flags, const std::wstring& message, const std::wstring& default_prompt, int message_width) - : message_label_(new Label(message)), + : message_label_(new Label(WideToUTF16Hack(message))), prompt_field_(NULL), icon_(NULL), checkbox_(NULL), @@ -43,7 +43,7 @@ MessageBoxView::MessageBoxView(int dialog_flags, MessageBoxView::MessageBoxView(int dialog_flags, const std::wstring& message, const std::wstring& default_prompt) - : message_label_(new Label(message)), + : message_label_(new Label(WideToUTF16Hack(message))), prompt_field_(NULL), icon_(NULL), checkbox_(NULL), @@ -119,7 +119,7 @@ bool MessageBoxView::AcceleratorPressed( return false; ui::ScopedClipboardWriter scw(clipboard); - scw.WriteText(WideToUTF16Hack(message_label_->GetText())); + scw.WriteText(message_label_->GetText()); return true; } @@ -135,7 +135,7 @@ void MessageBoxView::Init(int dialog_flags, // with strong directionality. base::i18n::TextDirection direction = base::i18n::GetFirstStrongCharacterDirection( - WideToUTF16(message_label_->GetText())); + message_label_->GetText()); Label::Alignment alignment; if (direction == base::i18n::RIGHT_TO_LEFT) alignment = Label::ALIGN_RIGHT; diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc index 3287cbf..6656558 100644 --- a/views/examples/examples_main.cc +++ b/views/examples/examples_main.cc @@ -103,7 +103,7 @@ void ExamplesMain::Init() { examples_.push_back(new WidgetExample(this)); examples_.push_back(new MenuExample(this)); - for(std::vector<ExampleBase*>::const_iterator i(examples_.begin()); + for (std::vector<ExampleBase*>::const_iterator i(examples_.begin()); i != examples_.end(); ++i) AddExample(*i); @@ -111,7 +111,7 @@ void ExamplesMain::Init() { } void ExamplesMain::SetStatus(const std::string& status) { - status_label_->SetText(UTF8ToWide(status)); + status_label_->SetText(UTF8ToUTF16(status)); } void ExamplesMain::AddExample(ExampleBase* example) { diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 4f8ca5c..d3df95d 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -497,7 +497,7 @@ void FocusTraversalTest::InitContentView() { int y = 10; int gap_between_labels = 10; - Label* label = new Label(L"Apple:"); + Label* label = new Label(ASCIIToUTF16("Apple:")); label->set_id(kAppleLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); @@ -510,7 +510,7 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; - label = new Label(L"Orange:"); + label = new Label(ASCIIToUTF16("Orange:")); label->set_id(kOrangeLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); @@ -523,7 +523,7 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; - label = new Label(L"Banana:"); + label = new Label(ASCIIToUTF16("Banana:")); label->set_id(kBananaLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); @@ -536,7 +536,7 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; - label = new Label(L"Kiwi:"); + label = new Label(ASCIIToUTF16("Kiwi:")); label->set_id(kKiwiLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); @@ -616,11 +616,11 @@ void FocusTraversalTest::InitContentView() { Background::CreateSolidBackground(200, 200, 200)); scroll_view->SetContents(scroll_content); - static const wchar_t* const kTitles[] = { - L"Rosetta", L"Stupeur et tremblement", L"The diner game", - L"Ridicule", L"Le placard", L"Les Visiteurs", L"Amelie", - L"Joyeux Noel", L"Camping", L"Brice de Nice", - L"Taxi", L"Asterix" + static const char* const kTitles[] = { + "Rosetta", "Stupeur et tremblement", "The diner game", + "Ridicule", "Le placard", "Les Visiteurs", "Amelie", + "Joyeux Noel", "Camping", "Brice de Nice", + "Taxi", "Asterix" }; static const int kIDs[] = { @@ -634,7 +634,7 @@ void FocusTraversalTest::InitContentView() { y = 5; for (size_t i = 0; i < arraysize(kTitles); ++i) { - Link* link = new Link(kTitles[i]); + Link* link = new Link(ASCIIToUTF16(kTitles[i])); link->SetHorizontalAlignment(Label::ALIGN_LEFT); link->set_id(kIDs[i]); scroll_content->AddChildView(link); @@ -681,7 +681,7 @@ void FocusTraversalTest::InitContentView() { cb->SetBounds(130, 10, 70, 20); cb->set_id(kUnderlinedCheckBoxID); - Link* link = new Link(L"Help"); + Link* link = new Link(ASCIIToUTF16("Help")); contents->AddChildView(link); link->SetBounds(10, 35, 70, 10); link->set_id(kStyleHelpLinkID); @@ -711,7 +711,7 @@ void FocusTraversalTest::InitContentView() { button->SetBounds(112, 5, 60, 30); button->set_id(kSearchButtonID); - link = new Link(L"Help"); + link = new Link(ASCIIToUTF16("Help")); link->SetHorizontalAlignment(Label::ALIGN_LEFT); link->set_id(kHelpLinkID); contents->AddChildView(link); @@ -1283,7 +1283,6 @@ TEST_F(FocusTraversalTest, PaneTraversal) { EXPECT_EQ(kRightTraversalIDs[j], focused_view->id()); } } - } // Counts accelerator calls. @@ -1451,7 +1450,7 @@ TEST_F(FocusManagerTest, CallsSelfDeletingAcceleratorTarget) { class MessageTrackingView : public View { public: MessageTrackingView() : accelerator_pressed_(false) { - } + } virtual bool OnKeyPressed(const KeyEvent& e) { keys_pressed_.push_back(e.key_code()); @@ -1664,7 +1663,7 @@ class FocusManagerDtorTest : public FocusManagerTest { class TestFocusManagerFactory : public FocusManagerFactory { public: - TestFocusManagerFactory(DtorTrackVector* dtor_tracker) + explicit TestFocusManagerFactory(DtorTrackVector* dtor_tracker) : dtor_tracker_(dtor_tracker) { } @@ -1693,7 +1692,7 @@ class FocusManagerDtorTest : public FocusManagerTest { class WindowDtorTracked : public Widget { public: - WindowDtorTracked(DtorTrackVector* dtor_tracker) + explicit WindowDtorTracked(DtorTrackVector* dtor_tracker) : dtor_tracker_(dtor_tracker) { } diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc index 759f939..01433d1 100644 --- a/views/widget/tooltip_manager_views.cc +++ b/views/widget/tooltip_manager_views.cc @@ -185,7 +185,7 @@ void TooltipManagerViews::Update() { string16 tooltip_text(tooltip_text_); TrimTooltipToFit(&tooltip_text, &max_width, &line_count, curr_mouse_pos_.x(), curr_mouse_pos_.y()); - tooltip_label_.SetText(UTF16ToWideHack(tooltip_text)); + tooltip_label_.SetText(tooltip_text); SetTooltipBounds(curr_mouse_pos_, max_width, tooltip_label_.GetPreferredSize().height()); |