button_state_colors_(),
explicitly_set_colors_(),
is_default_(false),
- style_(STYLE_TEXTBUTTON) {
+ style_(STYLE_TEXTBUTTON),
+ border_is_themed_border_(true) {
SetAnimationDuration(kHoverAnimationDurationMs);
SetText(text);
SetFontList(gfx::FontList());
if (style == STYLE_BUTTON)
set_min_size(gfx::Size(70, 33));
- ResetColorsFromNativeTheme();
-
- UpdateThemedBorder(scoped_ptr<Border>(new LabelButtonBorder(style_)));
-
- // Invalidate the layout to pickup the new insets from the border.
- InvalidateLayout();
+ OnNativeThemeChanged(GetNativeTheme());
}
void LabelButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) {
return kViewClassName;
}
+void LabelButton::SetBorder(scoped_ptr<Border> border) {
+ border_is_themed_border_ = false;
+ View::SetBorder(border.Pass());
+}
+
void LabelButton::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
Painter::PaintFocusPainter(this, canvas, focus_painter_.get());
}
void LabelButton::UpdateThemedBorder(scoped_ptr<Border> label_button_border) {
+ // Don't override borders set by others.
+ if (!border_is_themed_border_)
+ return;
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui) {
{
SetBorder(label_button_border.Pass());
}
+
+ border_is_themed_border_ = true;
}
void LabelButton::StateChanged() {
void LabelButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
ResetColorsFromNativeTheme();
+ UpdateThemedBorder(scoped_ptr<Border>(new LabelButtonBorder(style_)));
+ // Invalidate the layout to pickup the new insets from the border.
+ InvalidateLayout();
}
ui::NativeTheme::Part LabelButton::GetThemePart() const {