| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #if !defined(OS_WIN) | 25 #if !defined(OS_WIN) |
| 26 void MenuConfig::Init(const ui::NativeTheme* theme) { | 26 void MenuConfig::Init(const ui::NativeTheme* theme) { |
| 27 InitAura(theme); | 27 InitAura(theme); |
| 28 } | 28 } |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 void MenuConfig::InitAura(const ui::NativeTheme* theme) { | 31 void MenuConfig::InitAura(const ui::NativeTheme* theme) { |
| 32 text_color = theme->GetSystemColor( | 32 text_color = theme->GetSystemColor( |
| 33 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); | 33 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
| 34 submenu_horizontal_inset = 1; | 34 submenu_horizontal_inset = 1; |
| 35 arrow_to_edge_padding = 20; |
| 35 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 36 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 36 arrow_to_edge_padding = 20; | |
| 37 arrow_width = | 37 arrow_width = |
| 38 rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia()->width(); | 38 rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia()->width(); |
| 39 const gfx::ImageSkia* check = GetMenuCheckImage(); | 39 gfx::ImageSkia check = GetMenuCheckImage(false); |
| 40 check_height = check->height(); | 40 check_height = check.height(); |
| 41 item_min_height = 29; | 41 item_min_height = 29; |
| 42 separator_spacing_height = 7; | 42 separator_spacing_height = 7; |
| 43 separator_lower_height = 8; | 43 separator_lower_height = 8; |
| 44 separator_upper_height = 8; | 44 separator_upper_height = 8; |
| 45 font = rb.GetFont(ResourceBundle::BaseFont); | 45 font = rb.GetFont(ResourceBundle::BaseFont); |
| 46 label_to_arrow_padding = 20; | 46 label_to_arrow_padding = 20; |
| 47 label_to_minor_text_padding = 20; | 47 label_to_minor_text_padding = 20; |
| 48 always_use_icon_to_label_padding = true; | 48 always_use_icon_to_label_padding = true; |
| 49 align_arrow_and_shortcut = true; | 49 align_arrow_and_shortcut = true; |
| 50 offset_context_menus = true; | 50 offset_context_menus = true; |
| 51 corner_radius = kMenuCornerRadiusForAura; | 51 corner_radius = kMenuCornerRadiusForAura; |
| 52 } | 52 } |
| 53 | 53 |
| 54 #if !defined(OS_WIN) | 54 #if !defined(OS_WIN) |
| 55 // static | 55 // static |
| 56 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { | 56 const MenuConfig& MenuConfig::instance(const ui::NativeTheme* theme) { |
| 57 static MenuConfig* views_instance = NULL; | 57 static MenuConfig* views_instance = NULL; |
| 58 if (!views_instance) | 58 if (!views_instance) |
| 59 views_instance = new MenuConfig(theme ? | 59 views_instance = new MenuConfig(theme ? |
| 60 theme : ui::NativeTheme::instance()); | 60 theme : ui::NativeTheme::instance()); |
| 61 return *views_instance; | 61 return *views_instance; |
| 62 } | 62 } |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 } // namespace views | 65 } // namespace views |
| OLD | NEW |