Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Unified Diff: ui/views/controls/link.cc

Issue 17756003: Colors in views::StyledLabel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/styled_label.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/link.cc
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index fcb73f10f1cbdd9066b94bfcb3b6b871d7efcb95..b82cd51533fbdb1d624e746f6ed4103501493a4a 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -34,6 +34,14 @@ Link::Link(const string16& title) : Label(title) {
Link::~Link() {
}
+SkColor Link::GetDefaultEnabledColor() {
+#if defined(OS_WIN)
+ return color_utils::GetSysSkColor(COLOR_HOTLIGHT);
+#else
+ return SkColorSetRGB(0, 51, 153);
+#endif
+}
+
void Link::OnEnabledChanged() {
RecalculateFont();
View::OnEnabledChanged();
@@ -164,31 +172,18 @@ void Link::SetUnderline(bool underline) {
}
void Link::Init() {
- static bool initialized = false;
- static SkColor kDefaultEnabledColor;
- static SkColor kDefaultDisabledColor;
- static SkColor kDefaultPressedColor;
- if (!initialized) {
-#if defined(OS_WIN)
- kDefaultEnabledColor = color_utils::GetSysSkColor(COLOR_HOTLIGHT);
- kDefaultDisabledColor = color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
- kDefaultPressedColor = SkColorSetRGB(200, 0, 0);
-#else
- // TODO(beng): source from theme provider.
- kDefaultEnabledColor = SkColorSetRGB(0, 51, 153);
- kDefaultDisabledColor = SK_ColorBLACK;
- kDefaultPressedColor = SK_ColorRED;
-#endif
-
- initialized = true;
- }
-
listener_ = NULL;
pressed_ = false;
underline_ = true;
- SetEnabledColor(kDefaultEnabledColor);
- SetDisabledColor(kDefaultDisabledColor);
- SetPressedColor(kDefaultPressedColor);
+ SetEnabledColor(GetDefaultEnabledColor());
+#if defined(OS_WIN)
+ SetDisabledColor(color_utils::GetSysSkColor(COLOR_WINDOWTEXT));
+ SetPressedColor(SkColorSetRGB(200, 0, 0));
+#else
+ // TODO(beng): source from theme provider.
+ SetDisabledColor(SK_ColorBLACK);
+ SetPressedColor(SK_ColorRED);
+#endif
RecalculateFont();
set_focusable(true);
}
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/styled_label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698