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

Unified Diff: ui/gfx/native_theme_win.cc

Issue 8597015: Add a new GetSystemColor method to native theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more code motion Created 9 years, 1 month 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/gfx/native_theme_win.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/native_theme_win.cc
diff --git a/ui/gfx/native_theme_win.cc b/ui/gfx/native_theme_win.cc
index 9114e354b1a8d7b3e6933938da3abb8b675b44fd..e0c1d6e765a1e5ce7cce78de714af2505f9663a5 100644
--- a/ui/gfx/native_theme_win.cc
+++ b/ui/gfx/native_theme_win.cc
@@ -27,6 +27,12 @@
namespace {
+const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
+
+SkColor WinColorToSkColor(COLORREF color) {
+ return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color));
+}
+
void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) {
// Create a 2x2 checkerboard pattern using the 3D face and highlight colors.
SkColor face = skia::COLORREFToSkColor(GetSysColor(COLOR_3DFACE));
@@ -315,6 +321,19 @@ void NativeThemeWin::Paint(SkCanvas* canvas,
}
}
+SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const {
+ switch (color_id) {
+ case kColorId_DialogBackground:
+ // TODO(benrg): Should this use the new Windows theme functions? The old
+ // code in DialogClientView::OnPaint used GetSysColor(COLOR_3DFACE).
+ return WinColorToSkColor(GetSysColor(COLOR_3DFACE));
+ default:
+ NOTREACHED() << "Invalid color_id: " << color_id;
+ break;
+ }
+ return kInvalidColorIdColor;
+}
+
HRESULT NativeThemeWin::PaintScrollbarArrow(
HDC hdc,
Part part,
« no previous file with comments | « ui/gfx/native_theme_win.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698