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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months 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.cc ('k') | ui/views/controls/menu/menu_config_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ui/views/controls/menu/menu_config.h"
6
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
15 namespace views {
16
17 namespace {
18 #if defined(OS_CHROMEOS)
19 static const int kMenuCornerRadiusForAura = 2;
20 #else
21 static const int kMenuCornerRadiusForAura = 0;
22 #endif
23 } // namespace
24
25 #if !defined(OS_WIN)
26 void MenuConfig::Init(const ui::NativeTheme* theme) {
27 if (theme == ui::NativeThemeAura::instance())
28 InitAura(theme);
29 }
30 #endif
31
32 void MenuConfig::InitAura(const ui::NativeTheme* theme) {
33 submenu_horizontal_inset = 1;
34 arrow_to_edge_padding = 20;
35 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
36 arrow_width = rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).Width();
37 gfx::ImageSkia check = GetMenuCheckImage(false);
38 check_height = check.height();
39 item_min_height = 29;
40 separator_spacing_height = 7;
41 separator_lower_height = 8;
42 separator_upper_height = 8;
43 label_to_arrow_padding = 20;
44 label_to_minor_text_padding = 20;
45 always_use_icon_to_label_padding = true;
46 align_arrow_and_shortcut = true;
47 offset_context_menus = true;
48 corner_radius = kMenuCornerRadiusForAura;
49 }
50
51 #if !defined(OS_WIN)
52 // static
53 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) {
54 static MenuConfig* views_instance = NULL;
55 if (!views_instance)
56 views_instance = new MenuConfig(theme ?
57 theme : ui::NativeTheme::instance());
58 return *views_instance;
59 }
60 #endif
61
62 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_config.cc ('k') | ui/views/controls/menu/menu_config_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698