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/native_theme/common_theme.h" | 5 #include "ui/native_theme/common_theme.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
13 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
14 #include "ui/gfx/color_utils.h" | 14 #include "ui/gfx/color_utils.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
17 #include "ui/gfx/skia_util.h" | 17 #include "ui/gfx/skia_util.h" |
18 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 SkColor GetAuraColor(NativeTheme::ColorId color_id, | 22 SkColor GetAuraColor(NativeTheme::ColorId color_id, |
23 const NativeTheme* base_theme) { | 23 const NativeTheme* base_theme) { |
24 // Second wave of MD colors (colors that only appear in secondary UI). | 24 // Second wave of MD colors (colors that only appear in secondary UI). |
25 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 25 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
26 static const SkColor kPrimaryTextColor = SkColorSetRGB(0x33, 0x33, 0x33); | 26 static const SkColor kPrimaryTextColor = SkColorSetRGB(0x33, 0x33, 0x33); |
27 | 27 |
28 if (color_id == NativeTheme::kColorId_LabelEnabledColor) | 28 switch (color_id) { |
29 return kPrimaryTextColor; | 29 // Labels |
30 if (color_id == NativeTheme::kColorId_UnfocusedBorderColor) | 30 case NativeTheme::kColorId_LabelEnabledColor: |
31 return SkColorSetA(SK_ColorBLACK, 0x24); | 31 return kPrimaryTextColor; |
| 32 |
| 33 // FocusableBorder |
| 34 case NativeTheme::kColorId_UnfocusedBorderColor: |
| 35 return SkColorSetA(SK_ColorBLACK, 0x24); |
| 36 |
| 37 // Textfields |
| 38 case NativeTheme::kColorId_TextfieldDefaultColor: |
| 39 return kPrimaryTextColor; |
| 40 case NativeTheme::kColorId_TextfieldDefaultBackground: |
| 41 return base_theme->GetSystemColor( |
| 42 NativeTheme::kColorId_DialogBackground); |
| 43 case NativeTheme::kColorId_TextfieldReadOnlyColor: |
| 44 return SkColorSetA(kPrimaryTextColor, 0x61); |
| 45 |
| 46 default: |
| 47 break; |
| 48 } |
32 } | 49 } |
33 | 50 |
34 // MD colors. | 51 // MD colors. |
35 if (ui::MaterialDesignController::IsModeMaterial()) { | 52 if (ui::MaterialDesignController::IsModeMaterial()) { |
36 // Dialogs: | 53 // Dialogs: |
37 static const SkColor kDialogBackgroundColorMd = SK_ColorWHITE; | 54 static const SkColor kDialogBackgroundColorMd = SK_ColorWHITE; |
38 // Buttons: | 55 // Buttons: |
39 static const SkColor kButtonEnabledColorMd = gfx::kChromeIconGrey; | 56 static const SkColor kButtonEnabledColorMd = gfx::kChromeIconGrey; |
40 // MenuItem: | 57 // MenuItem: |
41 static const SkColor kMenuHighlightBackgroundColorMd = | 58 static const SkColor kMenuHighlightBackgroundColorMd = |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 469 } |
453 if (menu_item.corner_radius > 0) { | 470 if (menu_item.corner_radius > 0) { |
454 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); | 471 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); |
455 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); | 472 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); |
456 return; | 473 return; |
457 } | 474 } |
458 canvas->drawRect(gfx::RectToSkRect(rect), paint); | 475 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
459 } | 476 } |
460 | 477 |
461 } // namespace ui | 478 } // namespace ui |
OLD | NEW |