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

Side by Side Diff: ui/base/native_theme/native_theme_android.cc

Issue 10310136: ui: Move NativeTheme files into ui/base/native_theme/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 8 years, 7 months 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
« no previous file with comments | « ui/base/native_theme/native_theme_android.h ('k') | ui/base/native_theme/native_theme_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_android.h" 5 #include "ui/base/native_theme/native_theme_android.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "grit/gfx_resources.h" 11 #include "grit/gfx_resources.h"
12 #include "third_party/skia/include/effects/SkGradientShader.h" 12 #include "third_party/skia/include/effects/SkGradientShader.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/color_utils.h" 14 #include "ui/gfx/color_utils.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 17
18 namespace gfx { 18 namespace ui {
19 19
20 static const unsigned int kButtonLength = 14; 20 const unsigned int kButtonLength = 14;
21 static const unsigned int kScrollbarWidth = 15; 21 const unsigned int kScrollbarWidth = 15;
22 static const unsigned int kThumbInactiveColor = 0xeaeaea; 22 const unsigned int kThumbInactiveColor = 0xeaeaea;
23 static const unsigned int kTrackColor= 0xd3d3d3; 23 const unsigned int kTrackColor= 0xd3d3d3;
24 24
25 // These are the default dimensions of radio buttons and checkboxes. 25 // These are the default dimensions of radio buttons and checkboxes.
26 static const int kCheckboxAndRadioWidth = 13; 26 const int kCheckboxAndRadioWidth = 13;
27 static const int kCheckboxAndRadioHeight = 13; 27 const int kCheckboxAndRadioHeight = 13;
28 28
29 // These sizes match the sizes in Chromium Win. 29 // These sizes match the sizes in Chromium Win.
30 static const int kSliderThumbWidth = 11; 30 const int kSliderThumbWidth = 11;
31 static const int kSliderThumbHeight = 21; 31 const int kSliderThumbHeight = 21;
32 32
33 static const SkColor kSliderTrackBackgroundColor = 33 const SkColor kSliderTrackBackgroundColor = SkColorSetRGB(0xe3, 0xdd, 0xd8);
34 SkColorSetRGB(0xe3, 0xdd, 0xd8); 34 const SkColor kSliderThumbLightGrey = SkColorSetRGB(0xf4, 0xf2, 0xef);
35 static const SkColor kSliderThumbLightGrey = SkColorSetRGB(0xf4, 0xf2, 0xef); 35 const SkColor kSliderThumbDarkGrey = SkColorSetRGB(0xea, 0xe5, 0xe0);
36 static const SkColor kSliderThumbDarkGrey = SkColorSetRGB(0xea, 0xe5, 0xe0); 36 const SkColor kSliderThumbBorderDarkGrey = SkColorSetRGB(0x9d, 0x96, 0x8e);
37 static const SkColor kSliderThumbBorderDarkGrey =
38 SkColorSetRGB(0x9d, 0x96, 0x8e);
39 37
40 // Get lightness adjusted color. 38 // Get lightness adjusted color.
41 static SkColor BrightenColor(const color_utils::HSL& hsl, 39 SkColor BrightenColor(const color_utils::HSL& hsl,
42 SkAlpha alpha, 40 SkAlpha alpha,
43 double lightness_amount) { 41 double lightness_amount) {
44 color_utils::HSL adjusted = hsl; 42 color_utils::HSL adjusted = hsl;
45 adjusted.l += lightness_amount; 43 adjusted.l += lightness_amount;
46 if (adjusted.l > 1.0) 44 if (adjusted.l > 1.0)
47 adjusted.l = 1.0; 45 adjusted.l = 1.0;
48 if (adjusted.l < 0.0) 46 if (adjusted.l < 0.0)
49 adjusted.l = 0.0; 47 adjusted.l = 0.0;
50 48
51 return color_utils::HSLToSkColor(adjusted, alpha); 49 return color_utils::HSLToSkColor(adjusted, alpha);
52 } 50 }
53 51
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 SkColor NativeThemeAndroid::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const { 792 SkColor NativeThemeAndroid::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const {
795 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.28, 0.5); 793 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.28, 0.5);
796 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5); 794 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5);
797 795
798 if (hsv1[2] + hsv2[2] > 1.0) 796 if (hsv1[2] + hsv2[2] > 1.0)
799 diff = -diff; 797 diff = -diff;
800 798
801 return SaturateAndBrighten(hsv2, -0.2, diff); 799 return SaturateAndBrighten(hsv2, -0.2, diff);
802 } 800 }
803 801
804 } // namespace gfx 802 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/native_theme/native_theme_android.h ('k') | ui/base/native_theme/native_theme_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698