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
3 // found in the LICENSE file.
5 #include "ui/views/controls/menu/menu_config.h"
7 #include "ui/base/layout.h"
8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/image/image.h"
10 #include "ui/gfx/image/image_skia.h"
11 #include "ui/native_theme/native_theme_aura.h"
12 #include "ui/resources/grit/ui_resources.h"
13 #include "ui/views/controls/menu/menu_image_util.h"
14 #include "ui/views/resources/grit/views_resources.h"
19 #if defined(OS_CHROMEOS)
20 static const int kMenuCornerRadiusForAura
= 2;
22 static const int kMenuCornerRadiusForAura
= 0;
27 void MenuConfig::Init(const ui::NativeTheme
* theme
) {
28 if (theme
== ui::NativeThemeAura::instance())
33 void MenuConfig::InitAura(const ui::NativeTheme
* theme
) {
34 submenu_horizontal_inset
= 1;
35 arrow_to_edge_padding
= 20;
36 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
37 arrow_width
= rb
.GetImageNamed(IDR_MENU_HIERARCHY_ARROW
).Width();
38 gfx::ImageSkia check
= GetMenuCheckImage(false);
39 check_height
= check
.height();
41 separator_spacing_height
= 7;
42 separator_lower_height
= 8;
43 separator_upper_height
= 8;
44 label_to_arrow_padding
= 20;
45 label_to_minor_text_padding
= 20;
46 always_use_icon_to_label_padding
= true;
47 align_arrow_and_shortcut
= true;
48 offset_context_menus
= true;
49 corner_radius
= kMenuCornerRadiusForAura
;
54 const MenuConfig
& MenuConfig::instance(const ui::NativeTheme
* theme
) {
55 static MenuConfig
* views_instance
= NULL
;
57 views_instance
= new MenuConfig(theme
?
58 theme
: ui::NativeTheme::instance());
59 return *views_instance
;