Chromium Code Reviews| 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/native_theme_gtk.h" | 5 #include "ui/native_theme/native_theme_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "ui/gfx/skia_utils_gtk.h" | 11 #include "ui/gfx/skia_utils_gtk.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | 15 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
| 16 | 16 |
| 17 // Theme colors returned by GetSystemColor(). | 17 // Theme colors returned by GetSystemColor(). |
| 18 | 18 |
| 19 // FocusableBorder: | 19 // FocusableBorder: |
| 20 const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); | 20 const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); |
| 21 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); | 21 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); |
| 22 | 22 |
| 23 // MenuItem | |
| 24 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetARGB(13, 0, 0, 0); | |
|
sky
2013/03/20 16:30:02
Can we not copy these values to three places?
Bobby Powers
2013/03/21 17:08:43
Copying is what Elliot originally suggested, and t
| |
| 25 const SkColor kHoverMenuItemBackgroundColor = SkColorSetRGB(204, 204, 204); | |
| 26 | |
| 27 // MenuButton | |
| 28 const SkColor kEnabledMenuButtonBorderColor = SkColorSetARGB(36, 0, 0, 0); | |
| 29 const SkColor kFocusedMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); | |
| 30 const SkColor kHoverMenuButtonBorderColor = SkColorSetARGB(72, 0, 0, 0); | |
| 31 | |
| 23 // TextButton: | 32 // TextButton: |
| 24 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); | 33 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); |
| 25 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117); | 34 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117); |
| 26 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146); | 35 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146); |
| 27 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); | 36 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); |
| 28 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; | 37 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; |
| 29 | 38 |
| 30 } // namespace | 39 } // namespace |
| 31 | 40 |
| 32 namespace ui { | 41 namespace ui { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 52 // chromium-os bug 23461). Need to figure out the right thing and do it. | 61 // chromium-os bug 23461). Need to figure out the right thing and do it. |
| 53 return gfx::GdkColorToSkColor( | 62 return gfx::GdkColorToSkColor( |
| 54 gtk_widget_get_default_style()->bg[GTK_STATE_NORMAL]); | 63 gtk_widget_get_default_style()->bg[GTK_STATE_NORMAL]); |
| 55 | 64 |
| 56 // FocusableBorder: | 65 // FocusableBorder: |
| 57 case kColorId_FocusedBorderColor: | 66 case kColorId_FocusedBorderColor: |
| 58 return kFocusedBorderColor; | 67 return kFocusedBorderColor; |
| 59 case kColorId_UnfocusedBorderColor: | 68 case kColorId_UnfocusedBorderColor: |
| 60 return kUnfocusedBorderColor; | 69 return kUnfocusedBorderColor; |
| 61 | 70 |
| 71 // MenuItem | |
| 72 case kColorId_FocusedMenuItemBackgroundColor: | |
| 73 return kFocusedMenuItemBackgroundColor; | |
| 74 case kColorId_HoverMenuItemBackgroundColor: | |
| 75 return kHoverMenuItemBackgroundColor; | |
| 76 case kColorId_EnabledMenuButtonBorderColor: | |
| 77 return kEnabledMenuButtonBorderColor; | |
| 78 case kColorId_FocusedMenuButtonBorderColor: | |
| 79 return kFocusedMenuButtonBorderColor; | |
| 80 case kColorId_HoverMenuButtonBorderColor: | |
| 81 return kHoverMenuButtonBorderColor; | |
| 82 | |
| 62 // TextButton: | 83 // TextButton: |
| 63 case kColorId_TextButtonBackgroundColor: | 84 case kColorId_TextButtonBackgroundColor: |
| 64 return kTextButtonBackgroundColor; | 85 return kTextButtonBackgroundColor; |
| 65 case kColorId_TextButtonEnabledColor: | 86 case kColorId_TextButtonEnabledColor: |
| 66 return kTextButtonEnabledColor; | 87 return kTextButtonEnabledColor; |
| 67 case kColorId_TextButtonDisabledColor: | 88 case kColorId_TextButtonDisabledColor: |
| 68 return kTextButtonDisabledColor; | 89 return kTextButtonDisabledColor; |
| 69 case kColorId_TextButtonHighlightColor: | 90 case kColorId_TextButtonHighlightColor: |
| 70 return kTextButtonHighlightColor; | 91 return kTextButtonHighlightColor; |
| 71 case kColorId_TextButtonHoverColor: | 92 case kColorId_TextButtonHoverColor: |
| 72 return kTextButtonHoverColor; | 93 return kTextButtonHoverColor; |
| 73 | 94 |
| 74 default: | 95 default: |
| 75 NOTREACHED() << "Invalid color_id: " << color_id; | 96 NOTREACHED() << "Invalid color_id: " << color_id; |
| 76 break; | 97 break; |
| 77 } | 98 } |
| 78 return kInvalidColorIdColor; | 99 return kInvalidColorIdColor; |
| 79 } | 100 } |
| 80 | 101 |
| 81 NativeThemeGtk::NativeThemeGtk() { | 102 NativeThemeGtk::NativeThemeGtk() { |
| 82 } | 103 } |
| 83 | 104 |
| 84 NativeThemeGtk::~NativeThemeGtk() { | 105 NativeThemeGtk::~NativeThemeGtk() { |
| 85 } | 106 } |
| 86 | 107 |
| 87 } // namespace ui | 108 } // namespace ui |
| OLD | NEW |