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

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: more code motion -- not sure what to do Created 9 years 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"
11 #include "third_party/skia/include/effects/SkGradientShader.h" 11 #include "third_party/skia/include/effects/SkGradientShader.h"
12 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/gfx/color_utils.h" 13 #include "ui/gfx/color_utils.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 16
17 namespace {
18
19 // Hardcoded colors for use when there is no system theme (Aura, ChromeOS).
20 const SkColor kDefaultDialogBackgroundColor = SkColorSetRGB(200, 200, 200);
21 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
22
23 } // namespace
24
17 namespace gfx { 25 namespace gfx {
18 26
19 unsigned int NativeThemeBase::button_length_ = 14; 27 unsigned int NativeThemeBase::button_length_ = 14;
20 #if defined(TOUCH_UI) 28 #if defined(TOUCH_UI)
21 unsigned int NativeThemeBase::scrollbar_width_ = 0; 29 unsigned int NativeThemeBase::scrollbar_width_ = 0;
22 #else 30 #else
23 unsigned int NativeThemeBase::scrollbar_width_ = 15; 31 unsigned int NativeThemeBase::scrollbar_width_ = 15;
24 #endif 32 #endif
25 33
26 // These are the default dimensions of radio buttons and checkboxes. 34 // These are the default dimensions of radio buttons and checkboxes.
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 // default GTK themes. 992 // default GTK themes.
985 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 993 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); 994 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
987 995
988 if (hsv1[2] + hsv2[2] > 1.0) 996 if (hsv1[2] + hsv2[2] > 1.0)
989 diff = -diff; 997 diff = -diff;
990 998
991 return SaturateAndBrighten(hsv2, -0.2f, diff); 999 return SaturateAndBrighten(hsv2, -0.2f, diff);
992 } 1000 }
993 1001
1002 SkColor NativeThemeBase::GetSystemColor(ColorId color_id) const {
1003 // This implementation returns hardcoded colors. It's used by NativeThemeAura
1004 // and NativeThemeChromeos and overridden by NativeThemeGtk.
1005 switch (color_id) {
1006 case kColorId_DialogBackground:
1007 return kDefaultDialogBackgroundColor;
1008 default:
1009 NOTREACHED() << "Invalid color_id: " << color_id;
1010 break;
1011 }
1012 return kInvalidColorIdColor;
1013 }
1014
994 } // namespace gfx 1015 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698