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

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: for review 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
58 } // namespace 62 } // namespace
59 63
60 namespace gfx { 64 namespace gfx {
61 65
62 // static 66 // static
63 const NativeTheme* NativeTheme::instance() { 67 const NativeTheme* NativeTheme::instance() {
64 return NativeThemeWin::instance(); 68 return NativeThemeWin::instance();
65 } 69 }
66 70
67 // static 71 // static
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 break; 1679 break;
1676 } 1680 }
1677 break; 1681 break;
1678 default: 1682 default:
1679 NOTREACHED() << "Invalid part: " << part; 1683 NOTREACHED() << "Invalid part: " << part;
1680 break; 1684 break;
1681 } 1685 }
1682 return state_id; 1686 return state_id;
1683 } 1687 }
1684 1688
1689 SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const {
1690 switch (color_id) {
1691 case kDialogBackgroundColor:
1692 // TODO(benrg): Should this use the new Windows theme functions? The old
1693 // code in DialogClientView::OnPaint used GetSysColor(COLOR_3DFACE).
1694 return WinColorToSkColor(GetSysColor(COLOR_3DFACE));
1695 default:
1696 NOTREACHED() << "Invalid color_id: " << color_id;
1697 break;
1698 }
1699 return SkColorSetRGB(255, 0, 0); // warning red
1700 }
1701
1685 } // namespace gfx 1702 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698