| 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 10 #include "ui/base/native_theme/native_theme.h" | 10 #include "ui/base/native_theme/native_theme.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/favicon_size.h" | 13 #include "ui/gfx/favicon_size.h" |
| 14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 15 #include "ui/views/controls/menu/menu_config.h" | 15 #include "ui/views/controls/menu/menu_config.h" |
| 16 #include "ui/views/controls/menu/menu_image_util.h" | 16 #include "ui/views/controls/menu/menu_image_util.h" |
| 17 #include "ui/views/controls/menu/submenu_view.h" | 17 #include "ui/views/controls/menu/submenu_view.h" |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 | 20 |
| 21 void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { | 21 void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
| 22 const MenuConfig& config = MenuConfig::instance(); | 22 const MenuConfig& config = GetMenuConfig(); |
| 23 bool render_selection = | 23 bool render_selection = |
| 24 (mode == PB_NORMAL && IsSelected() && | 24 (mode == PB_NORMAL && IsSelected() && |
| 25 parent_menu_item_->GetSubmenu()->GetShowSelection(this) && | 25 parent_menu_item_->GetSubmenu()->GetShowSelection(this) && |
| 26 (NonIconChildViewsCount() == 0)); | 26 (NonIconChildViewsCount() == 0)); |
| 27 | 27 |
| 28 int icon_x = config.item_left_margin; | 28 int icon_x = config.item_left_margin; |
| 29 int top_margin = GetTopMargin(); | 29 int top_margin = GetTopMargin(); |
| 30 int bottom_margin = GetBottomMargin(); | 30 int bottom_margin = GetBottomMargin(); |
| 31 int icon_y = top_margin + (height() - config.item_top_margin - | 31 int icon_y = top_margin + (height() - config.item_top_margin - |
| 32 bottom_margin - config.check_height) / 2; | 32 bottom_margin - config.check_height) / 2; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 top_margin + (available_height - | 91 top_margin + (available_height - |
| 92 config.arrow_width) / 2, | 92 config.arrow_width) / 2, |
| 93 config.arrow_width, height()); | 93 config.arrow_width, height()); |
| 94 AdjustBoundsForRTLUI(&arrow_bounds); | 94 AdjustBoundsForRTLUI(&arrow_bounds); |
| 95 canvas->DrawImageInt(*GetSubmenuArrowImage(), | 95 canvas->DrawImageInt(*GetSubmenuArrowImage(), |
| 96 arrow_bounds.x(), arrow_bounds.y()); | 96 arrow_bounds.x(), arrow_bounds.y()); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace views | 100 } // namespace views |
| OLD | NEW |