| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 
|  | 2 // Use of this source code is governed by a BSD-style license that can be | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #include "ui/views/controls/button/label_button_label.h" | 
|  | 6 | 
|  | 7 namespace views { | 
|  | 8 | 
|  | 9 LabelButtonLabel::LabelButtonLabel(const base::string16& text, int text_context) | 
|  | 10     : Label(text, text_context, style::STYLE_PRIMARY) {} | 
|  | 11 | 
|  | 12 LabelButtonLabel::~LabelButtonLabel() {} | 
|  | 13 | 
|  | 14 void LabelButtonLabel::SetDisabledColor(SkColor color) { | 
|  | 15   requested_disabled_color_ = color; | 
|  | 16   disabled_color_set_ = true; | 
|  | 17   if (!enabled()) | 
|  | 18     Label::SetEnabledColor(color); | 
|  | 19 } | 
|  | 20 | 
|  | 21 void LabelButtonLabel::SetEnabledColor(SkColor color) { | 
|  | 22   requested_enabled_color_ = color; | 
|  | 23   enabled_color_set_ = true; | 
|  | 24   if (enabled()) | 
|  | 25     Label::SetEnabledColor(color); | 
|  | 26 } | 
|  | 27 | 
|  | 28 void LabelButtonLabel::OnEnabledChanged() { | 
|  | 29   SetColorForEnableState(); | 
|  | 30   Label::OnEnabledChanged(); | 
|  | 31 } | 
|  | 32 | 
|  | 33 void LabelButtonLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 
|  | 34   SetColorForEnableState(); | 
|  | 35   Label::OnNativeThemeChanged(theme); | 
|  | 36 } | 
|  | 37 | 
|  | 38 void LabelButtonLabel::SetColorForEnableState() { | 
|  | 39   if (enabled() ? enabled_color_set_ : disabled_color_set_) { | 
|  | 40     Label::SetEnabledColor(enabled() ? requested_enabled_color_ | 
|  | 41                                      : requested_disabled_color_); | 
|  | 42   } else { | 
|  | 43     int style = enabled() ? style::STYLE_PRIMARY : style::STYLE_DISABLED; | 
|  | 44     Label::SetEnabledColor( | 
|  | 45         style::GetColor(text_context(), style, GetNativeTheme())); | 
|  | 46   } | 
|  | 47 } | 
|  | 48 | 
|  | 49 }  // namespace views | 
| OLD | NEW | 
|---|