| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "ui/base/layout.h" | 8 #include "ui/base/layout.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 #include "ui/native_theme/native_theme_aura.h" | 12 #include "ui/native_theme/native_theme_aura.h" |
| 13 #include "ui/views/controls/menu/menu_image_util.h" | 13 #include "ui/views/controls/menu/menu_image_util.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 namespace { |
| 18 #if defined(OS_WIN) |
| 19 static const int kMenuCornerRadiusForAura = 0; |
| 20 #else |
| 21 static const int kMenuCornerRadiusForAura = 2; |
| 22 #endif |
| 23 } // namespace |
| 24 |
| 17 #if !defined(OS_WIN) | 25 #if !defined(OS_WIN) |
| 18 void MenuConfig::Init(const ui::NativeTheme* theme) { | 26 void MenuConfig::Init(const ui::NativeTheme* theme) { |
| 19 InitAura(); | 27 InitAura(); |
| 20 } | 28 } |
| 21 #endif | 29 #endif |
| 22 | 30 |
| 23 void MenuConfig::InitAura() { | 31 void MenuConfig::InitAura() { |
| 24 ui::NativeTheme* theme = ui::NativeThemeAura::instance(); | 32 ui::NativeTheme* theme = ui::NativeThemeAura::instance(); |
| 25 text_color = theme->GetSystemColor( | 33 text_color = theme->GetSystemColor( |
| 26 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); | 34 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 separator_height = 15; | 48 separator_height = 15; |
| 41 separator_spacing_height = 7; | 49 separator_spacing_height = 7; |
| 42 separator_lower_height = 8; | 50 separator_lower_height = 8; |
| 43 separator_upper_height = 8; | 51 separator_upper_height = 8; |
| 44 font = rb.GetFont(ResourceBundle::BaseFont); | 52 font = rb.GetFont(ResourceBundle::BaseFont); |
| 45 label_to_arrow_padding = 20; | 53 label_to_arrow_padding = 20; |
| 46 label_to_accelerator_padding = 20; | 54 label_to_accelerator_padding = 20; |
| 47 always_use_icon_to_label_padding = true; | 55 always_use_icon_to_label_padding = true; |
| 48 align_arrow_and_shortcut = true; | 56 align_arrow_and_shortcut = true; |
| 49 offset_context_menus = true; | 57 offset_context_menus = true; |
| 58 corner_radius = kMenuCornerRadiusForAura; |
| 50 } | 59 } |
| 51 | 60 |
| 52 #if !defined(OS_WIN) | 61 #if !defined(OS_WIN) |
| 53 // static | 62 // static |
| 54 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { | 63 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { |
| 55 static MenuConfig* views_instance = NULL; | 64 static MenuConfig* views_instance = NULL; |
| 56 if (!views_instance) | 65 if (!views_instance) |
| 57 views_instance = new MenuConfig(ui::NativeTheme::instance()); | 66 views_instance = new MenuConfig(ui::NativeTheme::instance()); |
| 58 return *views_instance; | 67 return *views_instance; |
| 59 } | 68 } |
| 60 #endif | 69 #endif |
| 61 | 70 |
| 62 } // namespace views | 71 } // namespace views |
| OLD | NEW |