Chromium Code Reviews| Index: ui/views/controls/button/custom_button.cc |
| diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc |
| index fc07e0b7b0fa4bf42ef5db8e41cb481045232006..547f949b9a36cc0b2d2871e6c87802c5ae1cadfc 100644 |
| --- a/ui/views/controls/button/custom_button.cc |
| +++ b/ui/views/controls/button/custom_button.cc |
| @@ -80,6 +80,7 @@ const CustomButton* CustomButton::AsCustomButton(const views::View* view) { |
| return AsCustomButton(const_cast<views::View*>(view)); |
| } |
| +// static |
| CustomButton* CustomButton::AsCustomButton(views::View* view) { |
| if (view) { |
| const char* classname = view->GetClassName(); |
| @@ -92,7 +93,26 @@ CustomButton* CustomButton::AsCustomButton(views::View* view) { |
| return static_cast<CustomButton*>(view); |
| } |
| } |
| - return NULL; |
| + return nullptr; |
| +} |
| + |
| +// static |
| +const LabelButton* CustomButton::AsLabelButton(const views::View* view) { |
| + return AsLabelButton(const_cast<views::View*>(view)); |
| +} |
| + |
| +// static |
| +LabelButton* CustomButton::AsLabelButton(views::View* view) { |
| + if (view) { |
| + const char* classname = view->GetClassName(); |
| + if (!strcmp(classname, Checkbox::kViewClassName) || |
|
Elly Fong-Jones
2016/04/05 16:43:25
This seems a little weird... if anyone adds anothe
tapted
2016/04/06 12:08:33
Yeah I agree. However, this is the typical approac
|
| + !strcmp(classname, LabelButton::kViewClassName) || |
| + !strcmp(classname, RadioButton::kViewClassName) || |
| + !strcmp(classname, MenuButton::kViewClassName)) { |
| + return static_cast<LabelButton*>(view); |
| + } |
| + } |
| + return nullptr; |
| } |
| CustomButton::~CustomButton() {} |