Chromium Code Reviews| Index: ui/views/controls/button/label_button_border.cc |
| diff --git a/ui/views/controls/button/label_button_border.cc b/ui/views/controls/button/label_button_border.cc |
| index 9b7b13afb69827301f0a9148f75507d726546737..116749955ed30c682bcc1506927f6c59a7a4e94f 100644 |
| --- a/ui/views/controls/button/label_button_border.cc |
| +++ b/ui/views/controls/button/label_button_border.cc |
| @@ -30,7 +30,7 @@ const int kTextHoveredImages[] = IMAGE_GRID(IDR_TEXTBUTTON_HOVER); |
| const int kTextPressedImages[] = IMAGE_GRID(IDR_TEXTBUTTON_PRESSED); |
| Button::ButtonState GetButtonState(ui::NativeTheme::State state) { |
| - switch(state) { |
| + switch (state) { |
| case ui::NativeTheme::kDisabled: return Button::STATE_DISABLED; |
| case ui::NativeTheme::kHovered: return Button::STATE_HOVERED; |
| case ui::NativeTheme::kNormal: return Button::STATE_NORMAL; |
| @@ -93,7 +93,6 @@ LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style) |
| LabelButtonBorder::~LabelButtonBorder() {} |
| void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) { |
| - DCHECK(!strcmp(view.GetClassName(), LabelButton::kViewClassName)); |
| const NativeThemeDelegate* native_theme_delegate = |
| static_cast<const LabelButton*>(&view); |
| ui::NativeTheme::Part part = native_theme_delegate->GetThemePart(); |
| @@ -132,12 +131,21 @@ void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) { |
| gfx::Insets LabelButtonBorder::GetInsets() const { |
| // Return the style-specific insets between button contents and edges. |
| - if (style() == Button::STYLE_BUTTON) |
| - return gfx::Insets(9, 13, 9, 13); |
| - if (style() == Button::STYLE_TEXTBUTTON) |
| - return gfx::Insets(5, 6, 5, 6); |
| - if (style() == Button::STYLE_NATIVE_TEXTBUTTON) |
| - return gfx::Insets(5, 12, 5, 12); |
| + switch (style()) { |
| + case Button::STYLE_BUTTON: |
| + return gfx::Insets(9, 13, 9, 13); |
| + case Button::STYLE_BUTTON: |
|
msw
2013/05/18 01:04:56
Remove this duplicated case for STYLE_BUTTON.
tfarina
2013/05/18 02:30:49
Done.
|
| + case Button::STYLE_TEXTBUTTON: |
| + return gfx::Insets(5, 6, 5, 6); |
| + case Button::STYLE_NATIVE_TEXTBUTTON: |
| + return gfx::Insets(5, 12, 5, 12); |
| + case Button::STYLE_CHECKBOX: |
| + case Button::STYLE_RADIO: |
| + return gfx::Insets(5, 12, 5, 12); |
| + default: |
|
msw
2013/05/18 01:04:56
Make this a STYLE_COUNT case, and don't offer a de
tfarina
2013/05/18 02:30:49
Done.
|
| + NOTREACHED(); |
| + return gfx::Insets(); |
| + } |
| NOTREACHED(); |
|
msw
2013/05/18 01:04:56
Can you remove this NOTREACHED and the extra retur
tfarina
2013/05/18 02:30:49
Done.
|
| return gfx::Insets(); |
| } |