summaryrefslogtreecommitdiffstats
path: root/ui/native_theme
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 01:19:47 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 01:19:47 +0000
commita33a118d016349a315d17fb33a144bb8ab2694e8 (patch)
tree3394da0e791a4172f9faff2879350b68dd795bb6 /ui/native_theme
parent3594b0d8935f3625ac4b151c5af33b9196ac47d2 (diff)
downloadchromium_src-a33a118d016349a315d17fb33a144bb8ab2694e8.zip
chromium_src-a33a118d016349a315d17fb33a144bb8ab2694e8.tar.gz
chromium_src-a33a118d016349a315d17fb33a144bb8ab2694e8.tar.bz2
Get views implementation of table and tree to use the right system colors.
BUG=170368 170370 TEST=none R=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/11967049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/native_theme')
-rw-r--r--ui/native_theme/native_theme.h16
-rw-r--r--ui/native_theme/native_theme_aura.cc49
-rw-r--r--ui/native_theme/native_theme_win.cc58
3 files changed, 114 insertions, 9 deletions
diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h
index 021cf3c..0c5499e 100644
--- a/ui/native_theme/native_theme.h
+++ b/ui/native_theme/native_theme.h
@@ -250,6 +250,22 @@ class NATIVE_THEME_EXPORT NativeTheme {
kColorId_TextfieldSelectionColor,
kColorId_TextfieldSelectionBackgroundFocused,
kColorId_TextfieldSelectionBackgroundUnfocused,
+ // Tree
+ kColorId_TreeBackground,
+ kColorId_TreeText,
+ kColorId_TreeSelectedText,
+ kColorId_TreeSelectedTextUnfocused,
+ kColorId_TreeSelectionBackgroundFocused,
+ kColorId_TreeSelectionBackgroundUnfocused,
+ kColorId_TreeArrow,
+ // Table
+ kColorId_TableBackground,
+ kColorId_TableText,
+ kColorId_TableSelectedText,
+ kColorId_TableSelectedTextUnfocused,
+ kColorId_TableSelectionBackgroundFocused,
+ kColorId_TableSelectionBackgroundUnfocused,
+ kColorId_TableGroupingIndicatorColor,
// TODO(benrg): move other hardcoded colors here.
};
diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc
index ca1e3c2..6382593 100644
--- a/ui/native_theme/native_theme_aura.cc
+++ b/ui/native_theme/native_theme_aura.cc
@@ -53,6 +53,18 @@ const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY;
const SkColor kTextfieldSelectionColor =
color_utils::AlphaBlend(SK_ColorBLACK,
kTextfieldSelectionBackgroundFocused, 0xdd);
+// Tree
+const SkColor kTreeBackground = SK_ColorWHITE;
+const SkColor kTreeTextColor = SK_ColorBLACK;
+const SkColor kTreeSelectedTextColor = SK_ColorBLACK;
+const SkColor kTreeSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
+const SkColor kTreeArrowColor = SkColorSetRGB(0x7A, 0x7A, 0x7A);
+// Table
+const SkColor kTableBackground = SK_ColorWHITE;
+const SkColor kTableTextColor = SK_ColorBLACK;
+const SkColor kTableSelectedTextColor = SK_ColorBLACK;
+const SkColor kTableSelectionBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
+const SkColor kTableGroupingIndicatorColor = SkColorSetRGB(0xCC, 0xCC, 0xCC);
} // namespace
@@ -80,10 +92,8 @@ NativeThemeAura::~NativeThemeAura() {
SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const {
// This implementation returns hardcoded colors.
SkColor color;
- if (IsNewMenuStyleEnabled() &&
- CommonThemeGetSystemColor(color_id, &color)) {
+ if (IsNewMenuStyleEnabled() && CommonThemeGetSystemColor(color_id, &color))
return color;
- }
switch (color_id) {
// Windows
@@ -146,8 +156,37 @@ SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const {
case kColorId_TextfieldSelectionBackgroundUnfocused:
return kTextfieldSelectionBackgroundUnfocused;
- default:
- NOTREACHED() << "Invalid color_id: " << color_id;
+ // Tree
+ case kColorId_TreeBackground:
+ return kTreeBackground;
+ case kColorId_TreeText:
+ return kTreeTextColor;
+ case kColorId_TreeSelectedText:
+ case kColorId_TreeSelectedTextUnfocused:
+ return kTreeSelectedTextColor;
+ case kColorId_TreeSelectionBackgroundFocused:
+ case kColorId_TreeSelectionBackgroundUnfocused:
+ return kTreeSelectionBackgroundColor;
+ case kColorId_TreeArrow:
+ return kTreeArrowColor;
+
+ // Table
+ case kColorId_TableBackground:
+ return kTableBackground;
+ case kColorId_TableText:
+ return kTableTextColor;
+ case kColorId_TableSelectedText:
+ case kColorId_TableSelectedTextUnfocused:
+ return kTableSelectedTextColor;
+ case kColorId_TableSelectionBackgroundFocused:
+ case kColorId_TableSelectionBackgroundUnfocused:
+ return kTableSelectionBackgroundColor;
+ case kColorId_TableGroupingIndicatorColor:
+ return kTableGroupingIndicatorColor;
+
+ case kColorId_MenuBackgroundColor:
+ case kColorId_MenuBorderColor:
+ NOTREACHED();
break;
}
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index 3869334..3e04dcb 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -28,6 +28,11 @@
#include "ui/gfx/rect.h"
#include "ui/native_theme/common_theme.h"
+// This was removed from Winvers.h but is still used.
+#if !defined(COLOR_MENUHIGHLIGHT)
+#define COLOR_MENUHIGHLIGHT 29
+#endif
+
namespace {
// TODO: Obtain the correct colors using GetSysColor.
@@ -49,6 +54,8 @@ const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(246, 249, 253);
const SkColor kMenuSeparatorColor = SkColorSetARGB(50, 0, 0, 0);
// Textfield:
const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY;
+// Table:
+const SkColor kTreeSelectionBackgroundUnfocused = SkColorSetRGB(240, 240, 240);
// Windows system color IDs cached and updated by the native theme.
const int kSystemColors[] = {
@@ -60,6 +67,8 @@ const int kSystemColors[] = {
COLOR_SCROLLBAR,
COLOR_WINDOW,
COLOR_WINDOWTEXT,
+ COLOR_BTNFACE,
+ COLOR_MENUHIGHLIGHT,
};
void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) {
@@ -117,6 +126,14 @@ RECT InsetRect(const RECT* rect, int size) {
return result.ToRECT();
}
+// Returns true if using a high contrast theme.
+bool UsingHighContrastTheme() {
+ HIGHCONTRAST result;
+ result.cbSize = sizeof(HIGHCONTRAST);
+ return SystemParametersInfo(SPI_GETHIGHCONTRAST, result.cbSize, &result, 0) &&
+ (result.dwFlags & HCF_HIGHCONTRASTON) == HCF_HIGHCONTRASTON;
+}
+
} // namespace
namespace ui {
@@ -448,10 +465,8 @@ void NativeThemeWin::PaintDirect(SkCanvas* canvas,
SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const {
SkColor color;
- if (IsNewMenuStyleEnabled() &&
- CommonThemeGetSystemColor(color_id, &color)) {
+ if (IsNewMenuStyleEnabled() && CommonThemeGetSystemColor(color_id, &color))
return color;
- }
switch (color_id) {
// Windows
@@ -514,8 +529,43 @@ SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const {
case kColorId_TextfieldSelectionBackgroundUnfocused:
return kTextfieldSelectionBackgroundUnfocused;
+ // Tree
+ // NOTE: these aren't right for all themes, but as close as I could get.
+ case kColorId_TreeBackground:
+ return system_colors_[COLOR_WINDOW];
+ case kColorId_TreeText:
+ return system_colors_[COLOR_WINDOWTEXT];
+ case kColorId_TreeSelectedText:
+ return system_colors_[COLOR_HIGHLIGHTTEXT];
+ case kColorId_TreeSelectedTextUnfocused:
+ return system_colors_[COLOR_BTNTEXT];
+ case kColorId_TreeSelectionBackgroundFocused:
+ return system_colors_[COLOR_HIGHLIGHT];
+ case kColorId_TreeSelectionBackgroundUnfocused:
+ return system_colors_[UsingHighContrastTheme() ?
+ COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
+ case kColorId_TreeArrow:
+ return system_colors_[COLOR_WINDOWTEXT];
+
+ // Table
+ case kColorId_TableBackground:
+ return system_colors_[COLOR_WINDOW];
+ case kColorId_TableText:
+ return system_colors_[COLOR_WINDOWTEXT];
+ case kColorId_TableSelectedText:
+ return system_colors_[COLOR_HIGHLIGHTTEXT];
+ case kColorId_TableSelectedTextUnfocused:
+ return system_colors_[COLOR_BTNTEXT];
+ case kColorId_TableSelectionBackgroundFocused:
+ return system_colors_[COLOR_HIGHLIGHT];
+ case kColorId_TableSelectionBackgroundUnfocused:
+ return system_colors_[UsingHighContrastTheme() ?
+ COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
+ case kColorId_TableGroupingIndicatorColor:
+ return system_colors_[COLOR_GRAYTEXT];
+
default:
- NOTREACHED() << "Invalid color_id: " << color_id;
+ NOTREACHED();
break;
}
return kInvalidColorIdColor;