summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 13:32:23 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 13:32:23 +0000
commitc8d71d105c95cd631ebc0d159e31ffc71774d25b (patch)
tree98c587eba7e799c6b530914f4730e58271d5b896 /views
parentcb16e5e394534e72b01fe16986e9dad19ecd0516 (diff)
downloadchromium_src-c8d71d105c95cd631ebc0d159e31ffc71774d25b.zip
chromium_src-c8d71d105c95cd631ebc0d159e31ffc71774d25b.tar.gz
chromium_src-c8d71d105c95cd631ebc0d159e31ffc71774d25b.tar.bz2
views: Change RadioButton API to string16.
BUG=68267 R=sky@chromium.org Review URL: http://codereview.chromium.org/8229017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/button/radio_button.cc11
-rw-r--r--views/controls/button/radio_button.h4
-rw-r--r--views/examples/radio_button_example.cc4
-rw-r--r--views/examples/scroll_view_example.cc3
-rw-r--r--views/focus/focus_manager_unittest.cc8
5 files changed, 15 insertions, 15 deletions
diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc
index ae2376c..ebf16cd 100644
--- a/views/controls/button/radio_button.cc
+++ b/views/controls/button/radio_button.cc
@@ -5,6 +5,7 @@
#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"
@@ -13,14 +14,8 @@ namespace views {
// static
const char RadioButton::kViewClassName[] = "views/RadioButton";
-////////////////////////////////////////////////////////////////////////////////
-//
-// RadioButton
-//
-////////////////////////////////////////////////////////////////////////////////
-
-RadioButton::RadioButton(const std::wstring& label, int group_id)
- : Checkbox(label) {
+RadioButton::RadioButton(const string16& label, int group_id)
+ : Checkbox(UTF16ToWideHack(label)) {
SetGroup(group_id);
set_focusable(true);
}
diff --git a/views/controls/button/radio_button.h b/views/controls/button/radio_button.h
index c9d3711..f3a1195 100644
--- a/views/controls/button/radio_button.h
+++ b/views/controls/button/radio_button.h
@@ -6,6 +6,7 @@
#define VIEWS_CONTROLS_BUTTON_RADIO_BUTTON_H_
#pragma once
+#include "base/string16.h"
#include "views/controls/button/checkbox.h"
namespace views {
@@ -17,7 +18,7 @@ class VIEWS_EXPORT RadioButton : public Checkbox {
// The button's class name.
static const char kViewClassName[];
- RadioButton(const std::wstring& label, int group_id);
+ RadioButton(const string16& label, int group_id);
virtual ~RadioButton();
// Overridden from View:
@@ -36,6 +37,7 @@ class VIEWS_EXPORT RadioButton : public Checkbox {
// Overridden from Checkbox:
virtual void SetChecked(bool checked) OVERRIDE;
+ private:
DISALLOW_COPY_AND_ASSIGN(RadioButton);
};
diff --git a/views/examples/radio_button_example.cc b/views/examples/radio_button_example.cc
index 41bdfb1..ae5aa0e 100644
--- a/views/examples/radio_button_example.cc
+++ b/views/examples/radio_button_example.cc
@@ -5,6 +5,7 @@
#include "views/examples/radio_button_example.h"
#include "base/stringprintf.h"
+#include "base/utf_string_conversions.h"
#include "views/controls/button/text_button.h"
#include "views/layout/grid_layout.h"
#include "views/view.h"
@@ -25,7 +26,8 @@ void RadioButtonExample::CreateExampleView(views::View* container) {
int group = 1;
for (size_t i = 0; i < arraysize(radio_buttons_); ++i) {
radio_buttons_[i] = new views::RadioButton(
- base::StringPrintf( L"Radio %d in group %d", i + 1, group), group);
+ UTF8ToUTF16(base::StringPrintf("Radio %d in group %d", i + 1, group)),
+ group);
radio_buttons_[i]->set_listener(this);
}
diff --git a/views/examples/scroll_view_example.cc b/views/examples/scroll_view_example.cc
index da66359..be7aced 100644
--- a/views/examples/scroll_view_example.cc
+++ b/views/examples/scroll_view_example.cc
@@ -5,6 +5,7 @@
#include "views/examples/scroll_view_example.h"
#include "base/stringprintf.h"
+#include "base/utf_string_conversions.h"
#include "views/controls/button/radio_button.h"
#include "views/layout/grid_layout.h"
#include "views/view.h"
@@ -18,7 +19,7 @@ class ScrollViewExample::ScrollableView : public views::View {
ScrollableView() {
SetColor(SK_ColorRED, SK_ColorCYAN);
AddChildView(new views::TextButton(NULL, L"Button"));
- AddChildView(new views::RadioButton(L"Radio Button", 0));
+ AddChildView(new views::RadioButton(ASCIIToUTF16("Radio Button"), 0));
}
virtual gfx::Size GetPreferredSize() {
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index d3df95d..5dd31c1 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -577,20 +577,20 @@ void FocusTraversalTest::InitContentView() {
y = 10;
int radio_button_height = 18;
int gap_between_radio_buttons = 10;
- RadioButton* radio_button = new RadioButton(L"Asparagus", 1);
+ RadioButton* radio_button = new RadioButton(ASCIIToUTF16("Asparagus"), 1);
radio_button->set_id(kAsparagusButtonID);
right_container_->AddChildView(radio_button);
radio_button->SetBounds(5, y, 70, radio_button_height);
radio_button->SetGroup(1);
y += radio_button_height + gap_between_radio_buttons;
- radio_button = new RadioButton(L"Broccoli", 1);
+ radio_button = new RadioButton(ASCIIToUTF16("Broccoli"), 1);
radio_button->set_id(kBroccoliButtonID);
right_container_->AddChildView(radio_button);
radio_button->SetBounds(5, y, 70, radio_button_height);
radio_button->SetGroup(1);
RadioButton* radio_button_to_check = radio_button;
y += radio_button_height + gap_between_radio_buttons;
- radio_button = new RadioButton(L"Cauliflower", 1);
+ radio_button = new RadioButton(ASCIIToUTF16("Cauliflower"), 1);
radio_button->set_id(kCauliflowerButtonID);
right_container_->AddChildView(radio_button);
radio_button->SetBounds(5, y, 70, radio_button_height);
@@ -887,7 +887,7 @@ class TestCheckbox : public Checkbox {
class TestRadioButton : public RadioButton {
public:
- explicit TestRadioButton(const std::wstring& text)
+ explicit TestRadioButton(const string16& text)
: RadioButton(text, 1) {
}
virtual gfx::NativeView TestGetNativeControlView() {