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/views/controls/menu/menu_item_view.h" | 5 #include "ui/views/controls/menu/menu_item_view.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 int bottom_margin = GetBottomMargin(); | 769 int bottom_margin = GetBottomMargin(); |
770 int icon_y = top_margin + (height() - config.item_top_margin - | 770 int icon_y = top_margin + (height() - config.item_top_margin - |
771 bottom_margin - config.check_height) / 2; | 771 bottom_margin - config.check_height) / 2; |
772 int icon_height = config.check_height; | 772 int icon_height = config.check_height; |
773 int available_height = height() - top_margin - bottom_margin; | 773 int available_height = height() - top_margin - bottom_margin; |
774 | 774 |
775 // Render the background. As MenuScrollViewContainer draws the background, we | 775 // Render the background. As MenuScrollViewContainer draws the background, we |
776 // only need the background when we want it to look different, as when we're | 776 // only need the background when we want it to look different, as when we're |
777 // selected. | 777 // selected. |
778 ui::NativeTheme* native_theme = GetNativeTheme(); | 778 ui::NativeTheme* native_theme = GetNativeTheme(); |
779 if (render_selection) { | 779 SkColor override_color; |
| 780 if (GetDelegate() && |
| 781 GetDelegate()->GetBackgroundColor(GetCommand(), |
| 782 render_selection, |
| 783 &override_color)) { |
| 784 canvas->DrawColor(override_color); |
| 785 } else if (render_selection) { |
780 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { | 786 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { |
781 gfx::Rect item_bounds(0, 0, width(), height()); | 787 gfx::Rect item_bounds(0, 0, width(), height()); |
782 AdjustBoundsForRTLUI(&item_bounds); | 788 AdjustBoundsForRTLUI(&item_bounds); |
783 CommonThemePaintMenuItemBackground(canvas->sk_canvas(), | 789 CommonThemePaintMenuItemBackground(canvas->sk_canvas(), |
784 ui::NativeTheme::kHovered, item_bounds); | 790 ui::NativeTheme::kHovered, item_bounds); |
785 } else { | 791 } else { |
786 SkColor bg_color = native_theme->GetSystemColor( | 792 SkColor bg_color = native_theme->GetSystemColor( |
787 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); | 793 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); |
788 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); | 794 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); |
789 } | 795 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 } else { | 1035 } else { |
1030 const Type& type = menu_item->GetType(); | 1036 const Type& type = menu_item->GetType(); |
1031 if (type == CHECKBOX || type == RADIO) | 1037 if (type == CHECKBOX || type == RADIO) |
1032 return true; | 1038 return true; |
1033 } | 1039 } |
1034 } | 1040 } |
1035 return false; | 1041 return false; |
1036 } | 1042 } |
1037 | 1043 |
1038 } // namespace views | 1044 } // namespace views |
OLD | NEW |