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

Side by Side 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: move bug-check color constant out of header file 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/native_theme_win.h" 5 #include "ui/gfx/native_theme_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #include <vssym32.h> 10 #include <vssym32.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 SkShader::kRepeat_TileMode); 48 SkShader::kRepeat_TileMode);
49 49
50 // Align the pattern with the upper corner of |align_rect|. 50 // Align the pattern with the upper corner of |align_rect|.
51 SkMatrix matrix; 51 SkMatrix matrix;
52 matrix.setTranslate(SkIntToScalar(align_rect.left), 52 matrix.setTranslate(SkIntToScalar(align_rect.left),
53 SkIntToScalar(align_rect.top)); 53 SkIntToScalar(align_rect.top));
54 shader->setLocalMatrix(matrix); 54 shader->setLocalMatrix(matrix);
55 SkSafeUnref(paint->setShader(shader)); 55 SkSafeUnref(paint->setShader(shader));
56 } 56 }
57 57
58 SkColor WinColorToSkColor(COLORREF color) {
59 return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color));
60 }
61
62 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
James Cook 2011/11/19 03:02:46 nit: We usually list constants before functions in
benrg 2011/11/21 18:32:40 Done.
63
58 } // namespace 64 } // namespace
59 65
60 namespace gfx { 66 namespace gfx {
61 67
62 // static 68 // static
63 const NativeTheme* NativeTheme::instance() { 69 const NativeTheme* NativeTheme::instance() {
64 return NativeThemeWin::instance(); 70 return NativeThemeWin::instance();
65 } 71 }
66 72
67 // static 73 // static
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 break; 1681 break;
1676 } 1682 }
1677 break; 1683 break;
1678 default: 1684 default:
1679 NOTREACHED() << "Invalid part: " << part; 1685 NOTREACHED() << "Invalid part: " << part;
1680 break; 1686 break;
1681 } 1687 }
1682 return state_id; 1688 return state_id;
1683 } 1689 }
1684 1690
1691 SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const {
1692 switch (color_id) {
1693 case kDialogBackgroundColorId:
1694 // TODO(benrg): Should this use the new Windows theme functions? The old
1695 // code in DialogClientView::OnPaint used GetSysColor(COLOR_3DFACE).
1696 return WinColorToSkColor(GetSysColor(COLOR_3DFACE));
1697 default:
1698 NOTREACHED() << "Invalid color_id: " << color_id;
1699 break;
1700 }
1701 return kInvalidColorIdColor;
1702 }
1703
1704
1705 }
1706
1685 } // namespace gfx 1707 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698