Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: ui/views/controls/menu/menu_config_chromeos.cc

Issue 1477253002: Use a single views::MenuConfig instance for each platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add menu_config_android Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/menu/menu_config_aura.cc ('k') | ui/views/controls/menu/menu_config_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/base/layout.h"
8 #include "ui/base/resource/resource_bundle.h" 7 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/image/image.h" 8 #include "ui/gfx/image/image.h"
10 #include "ui/gfx/image/image_skia.h" 9 #include "ui/gfx/image/image_skia.h"
11 #include "ui/native_theme/native_theme_aura.h"
12 #include "ui/resources/grit/ui_resources.h" 10 #include "ui/resources/grit/ui_resources.h"
13 #include "ui/views/controls/menu/menu_image_util.h" 11 #include "ui/views/controls/menu/menu_image_util.h"
14 #include "ui/views/resources/grit/views_resources.h"
15 12
16 namespace views { 13 namespace views {
17 14
18 namespace { 15 void MenuConfig::Init() {
19 #if defined(OS_CHROMEOS)
20 static const int kMenuCornerRadiusForAura = 2;
21 #else
22 static const int kMenuCornerRadiusForAura = 0;
23 #endif
24 } // namespace
25
26 #if !defined(OS_WIN)
27 void MenuConfig::Init(const ui::NativeTheme* theme) {
28 if (theme == ui::NativeThemeAura::instance())
29 InitAura(theme);
30 }
31 #endif
32
33 void MenuConfig::InitAura(const ui::NativeTheme* theme) {
34 submenu_horizontal_inset = 1; 16 submenu_horizontal_inset = 1;
35 arrow_to_edge_padding = 20; 17 arrow_to_edge_padding = 20;
36 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 18 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
37 arrow_width = rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).Width(); 19 arrow_width = rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).Width();
38 gfx::ImageSkia check = GetMenuCheckImage(false); 20 gfx::ImageSkia check = GetMenuCheckImage(false);
39 check_height = check.height(); 21 check_height = check.height();
40 item_min_height = 29; 22 item_min_height = 29;
41 separator_spacing_height = 7; 23 separator_spacing_height = 7;
42 separator_lower_height = 8; 24 separator_lower_height = 8;
43 separator_upper_height = 8; 25 separator_upper_height = 8;
44 label_to_arrow_padding = 20; 26 label_to_arrow_padding = 20;
45 label_to_minor_text_padding = 20; 27 label_to_minor_text_padding = 20;
46 always_use_icon_to_label_padding = true; 28 always_use_icon_to_label_padding = true;
47 align_arrow_and_shortcut = true; 29 align_arrow_and_shortcut = true;
48 offset_context_menus = true; 30 offset_context_menus = true;
49 corner_radius = kMenuCornerRadiusForAura; 31 corner_radius = 2;
50 32
51 // In Ash, the border is provided by the shadow. 33 // In Ash, the border is provided by the shadow.
52 use_outer_border = false; 34 use_outer_border = false;
53 } 35 }
54 36
55 #if !defined(OS_WIN)
56 // static
57 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) {
58 CR_DEFINE_STATIC_LOCAL(MenuConfig, instance,
59 (theme ? theme : ui::NativeThemeAura::instance()));
60 return instance;
61 }
62 #endif
63
64 } // namespace views 37 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_config_aura.cc ('k') | ui/views/controls/menu/menu_config_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698