diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:29:32 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:29:32 +0000 |
commit | 2e1c2685a12d6c38089b07c3f6359e036736cabf (patch) | |
tree | bb5e3a3a1f28ca19f23f19874a206004f2fe6cec | |
parent | 355e36f7b919a9dd3cfc1244cf91a497e301ffcd (diff) | |
download | chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.zip chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.tar.gz chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.tar.bz2 |
views: Change Checkbox API to string16.
BUG=68267
R=sky@chromium.org
Review URL: http://codereview.chromium.org/8245006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105088 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/eula_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/wifi_config_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/views/create_application_shortcut_view.cc | 18 | ||||
-rw-r--r-- | chrome/browser/ui/views/create_application_shortcut_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/uninstall_view.cc | 6 | ||||
-rw-r--r-- | ui/aura_shell/examples/widgets.cc | 11 | ||||
-rw-r--r-- | views/controls/button/checkbox.cc | 5 | ||||
-rw-r--r-- | views/controls/button/checkbox.h | 5 | ||||
-rw-r--r-- | views/controls/button/radio_button.cc | 3 | ||||
-rw-r--r-- | views/controls/message_box_view.cc | 2 | ||||
-rw-r--r-- | views/examples/native_theme_checkbox_example.cc | 5 | ||||
-rw-r--r-- | views/examples/table2_example.cc | 12 | ||||
-rw-r--r-- | views/examples/table_example.cc | 12 | ||||
-rw-r--r-- | views/examples/text_example.cc | 8 | ||||
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 12 | ||||
-rw-r--r-- | views/view_unittest.cc | 2 |
16 files changed, 62 insertions, 51 deletions
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index 970752e..d3b3f50 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -307,7 +307,7 @@ void EulaView::Init() { layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); layout->StartRow(0, SINGLE_CONTROL_WITH_SHIFT_ROW); - usage_statistics_checkbox_ = new views::Checkbox(L""); + usage_statistics_checkbox_ = new views::Checkbox(string16()); usage_statistics_checkbox_->SetMultiLine(true); usage_statistics_checkbox_->SetChecked( actor_->screen()->IsUsageStatsEnabled()); diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index 5fdb77c..8e76db7 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -923,8 +923,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { if (show_8021x) { layout->StartRow(0, column_view_set_id); save_credentials_checkbox_ = new views::Checkbox( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS))); + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); layout->SkipColumns(1); layout->AddView(save_credentials_checkbox_); } @@ -936,8 +936,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { !wifi->RequiresUserProfile())) { layout->StartRow(0, column_view_set_id); share_network_checkbox_ = new views::Checkbox( - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK))); + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK)); layout->SkipColumns(1); layout->AddView(share_network_checkbox_); } diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 4f42a13..7c30b4b 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -252,27 +252,27 @@ void CreateApplicationShortcutView::InitControls() { l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); create_shortcuts_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); - desktop_check_box_ = AddCheckbox(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX)), + desktop_check_box_ = AddCheckbox( + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateOnDesktop)); menu_check_box_ = NULL; quick_launch_check_box_ = NULL; #if defined(OS_WIN) - menu_check_box_ = AddCheckbox(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX)), + menu_check_box_ = AddCheckbox( + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu)); quick_launch_check_box_ = AddCheckbox( (base::win::GetVersion() >= base::win::VERSION_WIN7) ? - UTF16ToWide(l10n_util::GetStringUTF16(IDS_PIN_TO_TASKBAR_CHKBOX)) : - UTF16ToWide(l10n_util::GetStringUTF16( - IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX)), + l10n_util::GetStringUTF16(IDS_PIN_TO_TASKBAR_CHKBOX) : + l10n_util::GetStringUTF16( + IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInQuickLaunchBar)); #elif defined(OS_POSIX) menu_check_box_ = AddCheckbox( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_MENU_CHKBOX)), + l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_MENU_CHKBOX), profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu)); #endif @@ -387,7 +387,7 @@ views::View* CreateApplicationShortcutView::GetContentsView() { } views::Checkbox* CreateApplicationShortcutView::AddCheckbox( - const std::wstring& text, bool checked) { + const string16& text, bool checked) { views::Checkbox* checkbox = new views::Checkbox(text); checkbox->SetChecked(checked); checkbox->set_listener(this); diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h index 8e7eb77..c5d1e64 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.h +++ b/chrome/browser/ui/views/create_application_shortcut_view.h @@ -60,7 +60,7 @@ class CreateApplicationShortcutView : public views::DialogDelegateView, protected: // Adds a new check-box as a child to the view. - views::Checkbox* AddCheckbox(const std::wstring& text, bool checked); + views::Checkbox* AddCheckbox(const string16& text, bool checked); // Profile in which the shortcuts will be created. Profile* profile_; diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index 05c162a..3de2a97 100644 --- a/chrome/browser/ui/views/uninstall_view.cc +++ b/chrome/browser/ui/views/uninstall_view.cc @@ -62,7 +62,7 @@ void UninstallView::SetupControls() { GridLayout::USE_PREF, 0, 0); layout->StartRow(0, column_set_id); delete_profile_ = new views::Checkbox( - UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE))); + l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)); layout->AddView(delete_profile_); // Set default browser combo box @@ -83,8 +83,8 @@ void UninstallView::SetupControls() { column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); layout->StartRow(0, column_set_id); - change_default_browser_ = new views::Checkbox(UTF16ToWide( - l10n_util::GetStringUTF16(IDS_UNINSTALL_SET_DEFAULT_BROWSER))); + change_default_browser_ = new views::Checkbox( + l10n_util::GetStringUTF16(IDS_UNINSTALL_SET_DEFAULT_BROWSER)); change_default_browser_->set_listener(this); layout->AddView(change_default_browser_); browsers_combo_ = new views::Combobox(this); diff --git a/ui/aura_shell/examples/widgets.cc b/ui/aura_shell/examples/widgets.cc index f6c74a9..8b032c3 100644 --- a/ui/aura_shell/examples/widgets.cc +++ b/ui/aura_shell/examples/widgets.cc @@ -54,11 +54,12 @@ class WidgetsWindow : public views::WidgetDelegateView { WidgetsWindow::WidgetsWindow() : button_(new views::NativeTextButton(NULL, L"Button")), disabled_button_(new views::NativeTextButton(NULL, L"Disabled button")), - checkbox_(new views::Checkbox(L"Checkbox")), - checkbox_disabled_(new views::Checkbox(L"Checkbox disabled")), - checkbox_checked_(new views::Checkbox(L"Checkbox checked")), - checkbox_checked_disabled_( - new views::Checkbox(L"Checkbox checked disabled")), + checkbox_(new views::Checkbox(ASCIIToUTF16("Checkbox"))), + checkbox_disabled_(new views::Checkbox( + ASCIIToUTF16("Checkbox disabled"))), + checkbox_checked_(new views::Checkbox(ASCIIToUTF16("Checkbox checked"))), + checkbox_checked_disabled_(new views::Checkbox( + ASCIIToUTF16("Checkbox checked disabled"))), radio_button_(new views::RadioButton(ASCIIToUTF16("Radio button"), 0)), radio_button_disabled_(new views::RadioButton( ASCIIToUTF16("Radio button disabled"), 0)), diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 252fdc8..6eb683d 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -5,6 +5,7 @@ #include "views/controls/button/checkbox.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "views/controls/label.h" @@ -19,8 +20,8 @@ static const int kCheckboxLabelSpacing = 4; //////////////////////////////////////////////////////////////////////////////// // Checkbox, public: -Checkbox::Checkbox(const std::wstring& label) - : TextButtonBase(NULL, label), +Checkbox::Checkbox(const string16& label) + : TextButtonBase(NULL, UTF16ToWideHack(label)), checked_(false) { set_border(new TextButtonNativeThemeBorder(this)); set_focusable(true); diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index 2916c54..723f1ea 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -8,6 +8,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/string16.h" #include "views/controls/button/text_button.h" namespace views { @@ -16,10 +18,9 @@ namespace views { // platform specific objects to replicate the native platforms looks and feel. class VIEWS_EXPORT Checkbox : public TextButtonBase { public: - // The button's class name. static const char kViewClassName[]; - explicit Checkbox(const std::wstring& label); + explicit Checkbox(const string16& label); virtual ~Checkbox(); // Sets a listener for this checkbox. Checkboxes aren't required to have them diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc index ebf16cd..170d010 100644 --- a/views/controls/button/radio_button.cc +++ b/views/controls/button/radio_button.cc @@ -5,7 +5,6 @@ #include "views/controls/button/radio_button.h" #include "base/logging.h" -#include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" #include "views/widget/widget.h" @@ -15,7 +14,7 @@ namespace views { const char RadioButton::kViewClassName[] = "views/RadioButton"; RadioButton::RadioButton(const string16& label, int group_id) - : Checkbox(UTF16ToWideHack(label)) { + : Checkbox(label) { SetGroup(group_id); set_focusable(true); } diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index 5862460..b64952f 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -71,7 +71,7 @@ void MessageBoxView::SetIcon(const SkBitmap& icon) { void MessageBoxView::SetCheckBoxLabel(const string16& label) { if (!checkbox_) - checkbox_ = new Checkbox(UTF16ToWideHack(label)); + checkbox_ = new Checkbox(label); else checkbox_->SetText(UTF16ToWideHack(label)); ResetLayoutManager(); diff --git a/views/examples/native_theme_checkbox_example.cc b/views/examples/native_theme_checkbox_example.cc index ac09a2d..253cd9d 100644 --- a/views/examples/native_theme_checkbox_example.cc +++ b/views/examples/native_theme_checkbox_example.cc @@ -5,6 +5,7 @@ #include "views/examples/native_theme_checkbox_example.h" #include "base/stringprintf.h" +#include "base/utf_string_conversions.h" #include "views/controls/button/checkbox.h" #include "views/controls/button/radio_button.h" #include "views/layout/fill_layout.h" @@ -20,7 +21,7 @@ NativeThemeCheckboxExample::~NativeThemeCheckboxExample() { } void NativeThemeCheckboxExample::CreateExampleView(views::View* container) { - button_ = new views::Checkbox(L"Checkbox"); + button_ = new views::Checkbox(ASCIIToUTF16("Checkbox")); button_->set_listener(this); container->SetLayoutManager(new views::FillLayout); container->AddChildView(button_); @@ -28,7 +29,7 @@ void NativeThemeCheckboxExample::CreateExampleView(views::View* container) { void NativeThemeCheckboxExample::ButtonPressed(views::Button* sender, const views::Event& event) { - PrintStatus(base::StringPrintf("Pressed! count:%d", ++count_).c_str()); + PrintStatus(base::StringPrintf("Pressed! count: %d", ++count_).c_str()); } } // namespace examples diff --git a/views/examples/table2_example.cc b/views/examples/table2_example.cc index 028895b..393fb7f 100644 --- a/views/examples/table2_example.cc +++ b/views/examples/table2_example.cc @@ -20,16 +20,20 @@ Table2Example::~Table2Example() { } void Table2Example::CreateExampleView(views::View* container) { - column1_visible_checkbox_ = new views::Checkbox(L"Fruit column visible"); + column1_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Fruit column visible")); column1_visible_checkbox_->SetChecked(true); column1_visible_checkbox_->set_listener(this); - column2_visible_checkbox_ = new views::Checkbox(L"Color column visible"); + column2_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Color column visible")); column2_visible_checkbox_->SetChecked(true); column2_visible_checkbox_->set_listener(this); - column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); + column3_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Origin column visible")); column3_visible_checkbox_->SetChecked(true); column3_visible_checkbox_->set_listener(this); - column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); + column4_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Price column visible")); column4_visible_checkbox_->SetChecked(true); column4_visible_checkbox_->set_listener(this); diff --git a/views/examples/table_example.cc b/views/examples/table_example.cc index e568514e..f2287dc 100644 --- a/views/examples/table_example.cc +++ b/views/examples/table_example.cc @@ -21,16 +21,20 @@ TableExample::~TableExample() { } void TableExample::CreateExampleView(views::View* container) { - column1_visible_checkbox_ = new views::Checkbox(L"Fruit column visible"); + column1_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Fruit column visible")); column1_visible_checkbox_->SetChecked(true); column1_visible_checkbox_->set_listener(this); - column2_visible_checkbox_ = new views::Checkbox(L"Color column visible"); + column2_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Color column visible")); column2_visible_checkbox_->SetChecked(true); column2_visible_checkbox_->set_listener(this); - column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); + column3_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Origin column visible")); column3_visible_checkbox_->SetChecked(true); column3_visible_checkbox_->set_listener(this); - column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); + column4_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Price column visible")); column4_visible_checkbox_->SetChecked(true); column4_visible_checkbox_->set_listener(this); diff --git a/views/examples/text_example.cc b/views/examples/text_example.cc index cf484e8..e48fdc0 100644 --- a/views/examples/text_example.cc +++ b/views/examples/text_example.cc @@ -9,11 +9,11 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia.h" -#include "views/controls/label.h" #include "views/controls/button/checkbox.h" +#include "views/controls/label.h" #include "views/examples/example_combobox_model.h" -#include "views/view.h" #include "views/layout/grid_layout.h" +#include "views/view.h" namespace { @@ -193,10 +193,10 @@ void TextExample::CreateExampleView(views::View* container) { arraysize(kTextExamples)); layout->StartRow(0, 0); - multiline_checkbox_ = new views::Checkbox(L"Multiline"); + multiline_checkbox_ = new views::Checkbox(ASCIIToUTF16("Multiline")); multiline_checkbox_->set_listener(this); layout->AddView(multiline_checkbox_); - break_checkbox_ = new views::Checkbox(L"Character Break"); + break_checkbox_ = new views::Checkbox(ASCIIToUTF16("Character Break")); break_checkbox_->set_listener(this); layout->AddView(break_checkbox_); diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 5dd31c1..c60b8ee 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -476,7 +476,7 @@ void FocusTraversalTest::InitContentView() { content_view_->set_background( Background::CreateSolidBackground(SK_ColorWHITE)); - Checkbox* cb = new Checkbox(L"This is a checkbox"); + Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox")); content_view_->AddChildView(cb); // In this fast paced world, who really has time for non hard-coded layout? cb->SetBounds(10, 10, 200, 20); @@ -555,7 +555,7 @@ void FocusTraversalTest::InitContentView() { left_container_->AddChildView(button); y += 40; - cb = new Checkbox(L"This is another check box"); + cb = new Checkbox(ASCIIToUTF16("This is another check box")); cb->SetBounds(label_x + label_width + 5, y, 180, 20); cb->set_id(kFruitCheckBoxID); left_container_->AddChildView(cb); @@ -666,17 +666,17 @@ void FocusTraversalTest::InitContentView() { // Left bottom box with style checkboxes. View* contents = new View(); contents->set_background(Background::CreateSolidBackground(SK_ColorWHITE)); - cb = new Checkbox(L"Bold"); + cb = new Checkbox(ASCIIToUTF16("Bold")); contents->AddChildView(cb); cb->SetBounds(10, 10, 50, 20); cb->set_id(kBoldCheckBoxID); - cb = new Checkbox(L"Italic"); + cb = new Checkbox(ASCIIToUTF16("Italic")); contents->AddChildView(cb); cb->SetBounds(70, 10, 50, 20); cb->set_id(kItalicCheckBoxID); - cb = new Checkbox(L"Underlined"); + cb = new Checkbox(ASCIIToUTF16("Underlined")); contents->AddChildView(cb); cb->SetBounds(130, 10, 70, 20); cb->set_id(kUnderlinedCheckBoxID); @@ -878,7 +878,7 @@ class TestNativeButton : public NativeTextButton { class TestCheckbox : public Checkbox { public: - explicit TestCheckbox(const std::wstring& text) : Checkbox(text) { + explicit TestCheckbox(const string16& text) : Checkbox(text) { }; virtual gfx::NativeView TestGetNativeControlView() { return GetWidget()->GetNativeView(); diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 45290cc..759d182 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1225,7 +1225,7 @@ class TestDialog : public DialogDelegate, public ButtonListener { contents_ = new View; button1_ = new NativeTextButton(this, L"Button1"); button2_ = new NativeTextButton(this, L"Button2"); - checkbox_ = new Checkbox(L"My checkbox"); + checkbox_ = new Checkbox(ASCIIToUTF16("My checkbox")); button_drop_ = new ButtonDropDown(this, mock_menu_model_); contents_->AddChildView(button1_); contents_->AddChildView(button2_); |