| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // only need the background when we want it to look different, as when we're | 785 // only need the background when we want it to look different, as when we're |
| 786 // selected. | 786 // selected. |
| 787 ui::NativeTheme* native_theme = GetNativeTheme(); | 787 ui::NativeTheme* native_theme = GetNativeTheme(); |
| 788 SkColor override_color; | 788 SkColor override_color; |
| 789 if (GetDelegate() && | 789 if (GetDelegate() && |
| 790 GetDelegate()->GetBackgroundColor(GetCommand(), | 790 GetDelegate()->GetBackgroundColor(GetCommand(), |
| 791 render_selection, | 791 render_selection, |
| 792 &override_color)) { | 792 &override_color)) { |
| 793 canvas->DrawColor(override_color); | 793 canvas->DrawColor(override_color); |
| 794 } else if (render_selection) { | 794 } else if (render_selection) { |
| 795 // TODO(erg): The following doesn't actually get the focused menu item |
| 796 // background for times when we want to match the native OS. |
| 795 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { | 797 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { |
| 796 gfx::Rect item_bounds(0, 0, width(), height()); | 798 gfx::Rect item_bounds(0, 0, width(), height()); |
| 797 AdjustBoundsForRTLUI(&item_bounds); | 799 AdjustBoundsForRTLUI(&item_bounds); |
| 798 CommonThemePaintMenuItemBackground(canvas->sk_canvas(), | 800 CommonThemePaintMenuItemBackground(canvas->sk_canvas(), |
| 799 ui::NativeTheme::kHovered, item_bounds); | 801 ui::NativeTheme::kHovered, item_bounds); |
| 800 } else { | 802 } else { |
| 801 SkColor bg_color = native_theme->GetSystemColor( | 803 SkColor bg_color = native_theme->GetSystemColor( |
| 802 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); | 804 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); |
| 803 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); | 805 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); |
| 804 } | 806 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 } else { | 1053 } else { |
| 1052 const Type& type = menu_item->GetType(); | 1054 const Type& type = menu_item->GetType(); |
| 1053 if (type == CHECKBOX || type == RADIO) | 1055 if (type == CHECKBOX || type == RADIO) |
| 1054 return true; | 1056 return true; |
| 1055 } | 1057 } |
| 1056 } | 1058 } |
| 1057 return false; | 1059 return false; |
| 1058 } | 1060 } |
| 1059 | 1061 |
| 1060 } // namespace views | 1062 } // namespace views |
| OLD | NEW |