Chromium Code Reviews| 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 #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 { | |
| 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) | 15 #if !defined(OS_WIN) |
| 27 void MenuConfig::Init(const ui::NativeTheme* theme) { | 16 void MenuConfig::Init(const ui::NativeTheme* theme) { |
| 28 if (theme == ui::NativeThemeAura::instance()) | 17 // On Desktop Linux, always use the GTK config (MenuConfig member initializers), |
|
Evan Stade
2015/11/30 18:44:34
are you sure the MenuConfig member initializers ha
tapted
2015/12/01 07:35:09
Hm - that was the way I was reasoning about it, si
| |
| 29 InitAura(theme); | 18 // even for "Classic mode" on Linux (chrome://settings/#themes-reset). |
| 19 // Note this causes --open-ash on Linux to use the Desktop Linux style as well. | |
| 20 #if defined(OS_CHROMEOS) | |
| 21 InitAura(theme); | |
| 22 #endif | |
| 30 } | 23 } |
| 31 #endif | 24 #endif // OS_WIN |
| 32 | 25 |
| 33 void MenuConfig::InitAura(const ui::NativeTheme* theme) { | 26 void MenuConfig::InitAura(const ui::NativeTheme* theme) { |
|
Evan Stade
2015/11/30 18:44:34
|theme| isn't used; remove it?
tapted
2015/12/01 07:35:09
Done (removed from InitAura - removing from Init()
Evan Stade
2015/12/01 18:07:50
I think it's ok to peel the bandaid off all at onc
| |
| 34 submenu_horizontal_inset = 1; | 27 submenu_horizontal_inset = 1; |
| 35 arrow_to_edge_padding = 20; | 28 arrow_to_edge_padding = 20; |
| 36 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 29 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 37 arrow_width = rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).Width(); | 30 arrow_width = rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).Width(); |
| 38 gfx::ImageSkia check = GetMenuCheckImage(false); | 31 gfx::ImageSkia check = GetMenuCheckImage(false); |
| 39 check_height = check.height(); | 32 check_height = check.height(); |
| 40 item_min_height = 29; | 33 item_min_height = 29; |
| 41 separator_spacing_height = 7; | 34 separator_spacing_height = 7; |
| 42 separator_lower_height = 8; | 35 separator_lower_height = 8; |
| 43 separator_upper_height = 8; | 36 separator_upper_height = 8; |
| 44 label_to_arrow_padding = 20; | 37 label_to_arrow_padding = 20; |
| 45 label_to_minor_text_padding = 20; | 38 label_to_minor_text_padding = 20; |
| 46 always_use_icon_to_label_padding = true; | 39 always_use_icon_to_label_padding = true; |
| 47 align_arrow_and_shortcut = true; | 40 align_arrow_and_shortcut = true; |
| 48 offset_context_menus = true; | 41 offset_context_menus = true; |
| 49 corner_radius = kMenuCornerRadiusForAura; | 42 corner_radius = 2; |
|
sky
2015/11/30 16:54:33
Won't this change effect windows too?
tapted
2015/12/01 07:35:09
Ah, yes - it would change menus in Ash/Metro, whic
| |
| 50 | 43 |
| 51 // In Ash, the border is provided by the shadow. | 44 // In Ash, the border is provided by the shadow. |
| 52 use_outer_border = false; | 45 use_outer_border = false; |
| 53 } | 46 } |
| 54 | 47 |
| 55 #if !defined(OS_WIN) | 48 #if !defined(OS_WIN) |
| 56 // static | 49 // static |
| 57 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { | 50 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { |
| 58 CR_DEFINE_STATIC_LOCAL(MenuConfig, instance, | 51 CR_DEFINE_STATIC_LOCAL(MenuConfig, instance, (theme)); |
| 59 (theme ? theme : ui::NativeThemeAura::instance())); | |
| 60 return instance; | 52 return instance; |
| 61 } | 53 } |
| 62 #endif | 54 #endif |
| 63 | 55 |
| 64 } // namespace views | 56 } // namespace views |
| OLD | NEW |