| OLD | NEW | 
|---|
| 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_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 { | 17 namespace { | 
| 18 | 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 kDefaultFocusedBorderColor= SkColorSetRGB(0x4D, 0x90, 0xFE); |  | 
| 22 const SkColor kDefaultUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); |  | 
| 23 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |  | 
| 24 |  | 
| 25 // These are the default dimensions of radio buttons and checkboxes. | 19 // These are the default dimensions of radio buttons and checkboxes. | 
| 26 const int kCheckboxAndRadioWidth = 13; | 20 const int kCheckboxAndRadioWidth = 13; | 
| 27 const int kCheckboxAndRadioHeight = 13; | 21 const int kCheckboxAndRadioHeight = 13; | 
| 28 | 22 | 
| 29 // These sizes match the sizes in Chromium Win. | 23 // These sizes match the sizes in Chromium Win. | 
| 30 const int kSliderThumbWidth = 11; | 24 const int kSliderThumbWidth = 11; | 
| 31 const int kSliderThumbHeight = 21; | 25 const int kSliderThumbHeight = 21; | 
| 32 | 26 | 
| 33 const SkColor kSliderTrackBackgroundColor = | 27 const SkColor kSliderTrackBackgroundColor = | 
| 34     SkColorSetRGB(0xe3, 0xdd, 0xd8); | 28     SkColorSetRGB(0xe3, 0xdd, 0xd8); | 
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 201     case kTrackbarTrack: | 195     case kTrackbarTrack: | 
| 202     case kWindowResizeGripper: | 196     case kWindowResizeGripper: | 
| 203       NOTIMPLEMENTED(); | 197       NOTIMPLEMENTED(); | 
| 204       break; | 198       break; | 
| 205     default: | 199     default: | 
| 206       NOTREACHED() << "Unknown theme part: " << part; | 200       NOTREACHED() << "Unknown theme part: " << part; | 
| 207       break; | 201       break; | 
| 208   } | 202   } | 
| 209 } | 203 } | 
| 210 | 204 | 
| 211 SkColor NativeThemeBase::GetSystemColor(ColorId color_id) const { |  | 
| 212   // This implementation returns hardcoded colors. It's used by NativeThemeAura |  | 
| 213   // and NativeThemeChromeos and overridden by NativeThemeGtk. |  | 
| 214   switch (color_id) { |  | 
| 215     case kColorId_DialogBackground: |  | 
| 216       return kDefaultDialogBackgroundColor; |  | 
| 217     case kColorId_FocusedBorderColor: |  | 
| 218       return kDefaultFocusedBorderColor; |  | 
| 219     case kColorId_UnfocusedBorderColor: |  | 
| 220       return kDefaultUnfocusedBorderColor; |  | 
| 221     default: |  | 
| 222       NOTREACHED() << "Invalid color_id: " << color_id; |  | 
| 223       break; |  | 
| 224   } |  | 
| 225   return kInvalidColorIdColor; |  | 
| 226 } |  | 
| 227 |  | 
| 228 NativeThemeBase::NativeThemeBase() { | 205 NativeThemeBase::NativeThemeBase() { | 
| 229 } | 206 } | 
| 230 | 207 | 
| 231 NativeThemeBase::~NativeThemeBase() { | 208 NativeThemeBase::~NativeThemeBase() { | 
| 232 } | 209 } | 
| 233 | 210 | 
| 234 void NativeThemeBase::PaintArrowButton( | 211 void NativeThemeBase::PaintArrowButton( | 
| 235     SkCanvas* canvas, | 212     SkCanvas* canvas, | 
| 236     const gfx::Rect& rect, Part direction, State state) const { | 213     const gfx::Rect& rect, Part direction, State state) const { | 
| 237   int widthMiddle, lengthMiddle; | 214   int widthMiddle, lengthMiddle; | 
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1008   SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); | 985   SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); | 
| 1009   SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); | 986   SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); | 
| 1010 | 987 | 
| 1011   if (hsv1[2] + hsv2[2] > 1.0) | 988   if (hsv1[2] + hsv2[2] > 1.0) | 
| 1012     diff = -diff; | 989     diff = -diff; | 
| 1013 | 990 | 
| 1014   return SaturateAndBrighten(hsv2, -0.2f, diff); | 991   return SaturateAndBrighten(hsv2, -0.2f, diff); | 
| 1015 } | 992 } | 
| 1016 | 993 | 
| 1017 }  // namespace gfx | 994 }  // namespace gfx | 
| OLD | NEW | 
|---|