OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 | 8 |
| 9 #include "ui/gfx/image/image_skia.h" |
| 10 #include "ui/native_theme/native_theme_mac.h" |
| 11 #include "ui/views/controls/menu/menu_image_util.h" |
| 12 |
9 namespace views { | 13 namespace views { |
10 | 14 |
11 void MenuConfig::Init() { | 15 void MenuConfig::Init(const ui::NativeTheme* theme) { |
| 16 DCHECK_EQ(theme, ui::NativeThemeMac::instance()); |
12 font_list = gfx::FontList(gfx::Font([NSFont menuFontOfSize:0.0])); | 17 font_list = gfx::FontList(gfx::Font([NSFont menuFontOfSize:0.0])); |
13 menu_vertical_border_size = 4; | 18 menu_vertical_border_size = 4; |
14 item_top_margin = item_no_icon_top_margin = 1; | 19 item_top_margin = item_no_icon_top_margin = 1; |
15 item_bottom_margin = item_no_icon_bottom_margin = 1; | 20 item_bottom_margin = item_no_icon_bottom_margin = 1; |
16 item_left_margin = 2; | 21 item_left_margin = 2; |
17 arrow_to_edge_padding = 12; | 22 arrow_to_edge_padding = 12; |
18 icon_to_label_padding = 4; | 23 icon_to_label_padding = 4; |
19 check_width = 19; | 24 check_width = 19; |
20 check_height = 11; | 25 check_height = 11; |
21 separator_height = 13; | 26 separator_height = 13; |
22 separator_upper_height = 7; | 27 separator_upper_height = 7; |
23 separator_lower_height = 6; | 28 separator_lower_height = 6; |
24 align_arrow_and_shortcut = true; | 29 align_arrow_and_shortcut = true; |
25 icons_in_label = true; | 30 icons_in_label = true; |
26 check_selected_combobox_item = true; | 31 check_selected_combobox_item = true; |
27 corner_radius = 5; | 32 corner_radius = 5; |
28 use_outer_border = false; | 33 use_outer_border = false; |
29 } | 34 } |
30 | 35 |
| 36 // static |
| 37 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { |
| 38 CR_DEFINE_STATIC_LOCAL(MenuConfig, mac_instance, (theme)); |
| 39 return mac_instance; |
| 40 } |
| 41 |
31 } // namespace views | 42 } // namespace views |
OLD | NEW |