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

Side by Side Diff: ui/gfx/native_theme_base.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_base.h" 5 #include "ui/gfx/native_theme_base.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "grit/gfx_resources.h" 10 #include "grit/gfx_resources.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 return color_utils::HSLToSkColor(adjusted, alpha); 51 return color_utils::HSLToSkColor(adjusted, alpha);
52 } 52 }
53 53
54 NativeThemeBase::NativeThemeBase() { 54 NativeThemeBase::NativeThemeBase() {
55 } 55 }
56 56
57 NativeThemeBase::~NativeThemeBase() { 57 NativeThemeBase::~NativeThemeBase() {
58 } 58 }
59 59
60 // This implementation returns hardcoded colors. It's used by NativeThemeAura
61 // and NativeThemeChromeos and overridden by NativeThemeGtk.
62 SkColor NativeThemeBase::GetSystemColor(ColorId color_id) const {
63 switch (color_id) {
64 case kDialogBackgroundColor:
65 return SkColorSetRGB(200, 200, 200);
James Cook 2011/11/18 23:22:50 We typically define colors like this as constants
benrg 2011/11/19 00:20:22 Done.
66 default:
67 NOTREACHED() << "Invalid color_id: " << color_id;
68 break;
69 }
70 return SkColorSetRGB(255, 0, 0); // warning red
71 }
72
60 gfx::Size NativeThemeBase::GetPartSize(Part part, 73 gfx::Size NativeThemeBase::GetPartSize(Part part,
61 State state, 74 State state,
62 const ExtraParams& extra) const { 75 const ExtraParams& extra) const {
63 switch (part) { 76 switch (part) {
64 // Please keep these in the order of NativeTheme::Part. 77 // Please keep these in the order of NativeTheme::Part.
65 case kCheckbox: 78 case kCheckbox:
66 return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight); 79 return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight);
67 case kInnerSpinButton: 80 case kInnerSpinButton:
68 return gfx::Size(scrollbar_width_, 0); 81 return gfx::Size(scrollbar_width_, 0);
69 case kMenuList: 82 case kMenuList:
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 998 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
986 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 999 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
987 1000
988 if (hsv1[2] + hsv2[2] > 1.0) 1001 if (hsv1[2] + hsv2[2] > 1.0)
989 diff = -diff; 1002 diff = -diff;
990 1003
991 return SaturateAndBrighten(hsv2, -0.2f, diff); 1004 return SaturateAndBrighten(hsv2, -0.2f, diff);
992 } 1005 }
993 1006
994 } // namespace gfx 1007 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698