| 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_config.h" | 5 #include "ui/views/controls/menu/menu_config.h" |
| 6 | 6 |
| 7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "ui/base/layout.h" | 8 #include "ui/base/layout.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 void MenuConfig::InitAura() { | 23 void MenuConfig::InitAura() { |
| 24 ui::NativeTheme* theme = ui::NativeThemeAura::instance(); | 24 ui::NativeTheme* theme = ui::NativeThemeAura::instance(); |
| 25 text_color = theme->GetSystemColor( | 25 text_color = theme->GetSystemColor( |
| 26 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); | 26 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
| 27 menu_horizontal_border_size = 0; | 27 menu_horizontal_border_size = 0; |
| 28 menu_vertical_border_size = 0; | 28 menu_vertical_border_size = 0; |
| 29 submenu_horizontal_inset = 1; | 29 submenu_horizontal_inset = 1; |
| 30 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 30 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 31 arrow_to_edge_padding = 20; | 31 arrow_to_edge_padding = 20; |
| 32 icon_to_label_padding = 4; | 32 icon_to_label_padding = 4; |
| 33 arrow_width = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia()->width(); | 33 arrow_width = |
| 34 rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia()->width(); |
| 34 const gfx::ImageSkia* check = GetMenuCheckImage(); | 35 const gfx::ImageSkia* check = GetMenuCheckImage(); |
| 35 // Add 4 to force some padding between check and label. | 36 // Add 4 to force some padding between check and label. |
| 36 check_width = check->width() + 4; | 37 check_width = check->width() + 4; |
| 37 check_height = check->height(); | 38 check_height = check->height(); |
| 38 item_left_margin = 4; | 39 item_left_margin = 4; |
| 39 item_min_height = 29; | 40 item_min_height = 29; |
| 40 separator_height = 15; | 41 separator_height = 15; |
| 41 separator_spacing_height = 7; | 42 separator_spacing_height = 7; |
| 42 separator_lower_height = 8; | 43 separator_lower_height = 8; |
| 43 separator_upper_height = 8; | 44 separator_upper_height = 8; |
| 44 font = rb.GetFont(ResourceBundle::BaseFont); | 45 font = rb.GetFont(ResourceBundle::BaseFont); |
| 45 label_to_arrow_padding = 20; | 46 label_to_arrow_padding = 20; |
| 46 label_to_accelerator_padding = 20; | 47 label_to_accelerator_padding = 20; |
| 47 always_use_icon_to_label_padding = true; | 48 always_use_icon_to_label_padding = true; |
| 48 align_arrow_and_shortcut = true; | 49 align_arrow_and_shortcut = true; |
| 49 offset_context_menus = true; | 50 offset_context_menus = true; |
| 50 } | 51 } |
| 51 | 52 |
| 52 #if !defined(OS_WIN) | 53 #if !defined(OS_WIN) |
| 53 // static | 54 // static |
| 54 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { | 55 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { |
| 55 static MenuConfig* views_instance = NULL; | 56 static MenuConfig* views_instance = NULL; |
| 56 if (!views_instance) | 57 if (!views_instance) |
| 57 views_instance = new MenuConfig(ui::NativeTheme::instance()); | 58 views_instance = new MenuConfig(ui::NativeTheme::instance()); |
| 58 return *views_instance; | 59 return *views_instance; |
| 59 } | 60 } |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 } // namespace views | 63 } // namespace views |
| OLD | NEW |