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