From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 28 Aug 2019 14:00:54 -0700 Subject: Revert "Cleanup: Remove Menu Subtitles/Sublabels" This reverts commit 27a7b3648684204ccb16ede5cf3947579bd6c222. diff --git a/chrome/browser/renderer_context_menu/mock_render_view_context_menu.cc b/chrome/browser/renderer_context_menu/mock_render_view_context_menu.cc index 273666e278b3c6d1ac1e203f51a6a701366cdf2f..e9ab80665fd54b13c4211016e1607dc6cc5d53c2 100644 --- a/chrome/browser/renderer_context_menu/mock_render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/mock_render_view_context_menu.cc @@ -157,7 +157,7 @@ void MockRenderViewContextMenu::AppendSubMenuItems(ui::MenuModel* model) { sub_item.enabled = model->IsEnabledAt(i); sub_item.checked = model->IsItemCheckedAt(i); sub_item.hidden = false; - sub_item.title = model->GetLabelAt(i); + sub_item.title = model->GetSublabelAt(i); items_.push_back(sub_item); } } diff --git a/chrome/browser/status_icons/status_icon_menu_model.cc b/chrome/browser/status_icons/status_icon_menu_model.cc index 35d5182b293bcc5e013654f71e2366afef7f3e24..6deae7c286e9da72ab6a35d2e973da7fb32353d6 100644 --- a/chrome/browser/status_icons/status_icon_menu_model.cc +++ b/chrome/browser/status_icons/status_icon_menu_model.cc @@ -20,6 +20,7 @@ struct StatusIconMenuModel::ItemState { bool is_dynamic; ui::Accelerator accelerator; base::string16 label; + base::string16 sublabel; gfx::Image icon; }; @@ -61,6 +62,13 @@ void StatusIconMenuModel::ChangeLabelForCommandId(int command_id, NotifyMenuStateChanged(); } +void StatusIconMenuModel::ChangeSublabelForCommandId( + int command_id, const base::string16& sublabel) { + item_states_[command_id].is_dynamic = true; + item_states_[command_id].sublabel = sublabel; + NotifyMenuStateChanged(); +} + void StatusIconMenuModel::ChangeIconForCommandId( int command_id, const gfx::Image& icon) { item_states_[command_id].is_dynamic = true; @@ -122,6 +130,14 @@ base::string16 StatusIconMenuModel::GetLabelForCommandId(int command_id) const { return base::string16(); } +base::string16 StatusIconMenuModel::GetSublabelForCommandId( + int command_id) const { + auto iter = item_states_.find(command_id); + if (iter != item_states_.end()) + return iter->second.sublabel; + return base::string16(); +} + bool StatusIconMenuModel::GetIconForCommandId(int command_id, gfx::Image* image_skia) const { auto iter = item_states_.find(command_id); diff --git a/chrome/browser/status_icons/status_icon_menu_model.h b/chrome/browser/status_icons/status_icon_menu_model.h index f40a33f7ce6ef9c9c538f44a86a404925eec32b5..556f531fcb66072828f3b5c2c07cd9d6a744ad53 100644 --- a/chrome/browser/status_icons/status_icon_menu_model.h +++ b/chrome/browser/status_icons/status_icon_menu_model.h @@ -61,9 +61,11 @@ class StatusIconMenuModel // Calling any of these "change" methods will mark the menu item as "dynamic" // (see menu_model.h:IsItemDynamicAt) which many platforms take as a cue to - // refresh the label and icon of the menu item each time the menu is + // refresh the label, sublabel and icon of the menu item each time the menu is // shown. void ChangeLabelForCommandId(int command_id, const base::string16& label); + void ChangeSublabelForCommandId( + int command_id, const base::string16& sublabel); void ChangeIconForCommandId(int command_id, const gfx::Image& icon); void AddObserver(Observer* observer); @@ -77,6 +79,7 @@ class StatusIconMenuModel ui::Accelerator* accelerator) const override; bool IsItemForCommandIdDynamic(int command_id) const override; base::string16 GetLabelForCommandId(int command_id) const override; + base::string16 GetSublabelForCommandId(int command_id) const override; bool GetIconForCommandId(int command_id, gfx::Image* icon) const override; protected: diff --git a/chrome/browser/status_icons/status_icon_menu_model_unittest.cc b/chrome/browser/status_icons/status_icon_menu_model_unittest.cc index a258d038da4a2bbfc6ec13c250781166235c1fbc..f6dbaa19cdb8938204c3452622589708c7bc3bb2 100644 --- a/chrome/browser/status_icons/status_icon_menu_model_unittest.cc +++ b/chrome/browser/status_icons/status_icon_menu_model_unittest.cc @@ -90,6 +90,10 @@ TEST_F(StatusIconMenuModelTest, SetProperties) { menu_model()->ChangeLabelForCommandId(0, ASCIIToUTF16("label2")); EXPECT_EQ(ASCIIToUTF16("label2"), menu_model()->GetLabelForCommandId(0)); + // Set the sublabel and icon image for the second menu item. + menu_model()->ChangeSublabelForCommandId(1, ASCIIToUTF16("sublabel")); + EXPECT_EQ(ASCIIToUTF16("sublabel"), menu_model()->GetSublabelForCommandId(1)); + // Try setting icon image and changing it. menu_model()->ChangeIconForCommandId(1, test_image1); EXPECT_TRUE(menu_model()->GetIconForCommandId(1, &image_arg)); @@ -98,8 +102,9 @@ TEST_F(StatusIconMenuModelTest, SetProperties) { // Ensure changes to one menu item does not affect the other menu item. EXPECT_FALSE(menu_model()->GetAcceleratorForCommandId(1, &accel_arg)); EXPECT_EQ(base::string16(), menu_model()->GetLabelForCommandId(1)); + EXPECT_EQ(base::string16(), menu_model()->GetSublabelForCommandId(0)); EXPECT_FALSE(menu_model()->GetIconForCommandId(0, &image_arg)); - // Menu state should have changed 6 times in this test. - EXPECT_EQ(6, changed_count()); + // Menu state should have changed 7 times in this test. + EXPECT_EQ(7, changed_count()); } diff --git a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc index 326fe5abe680051a393c49ecbbdb07354ee16191..b80baf9290c054a3f254b73b4ed82f785c02b4b1 100644 --- a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc @@ -91,8 +91,8 @@ class MenuItemViewTestInsert : public MenuTestBase { inserted_item_ = menu()->AddMenuItemAt( INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), base::string16(), - nullptr, gfx::ImageSkia(), nullptr, views::MenuItemView::Type::kNormal, - ui::NORMAL_SEPARATOR); + base::string16(), nullptr, gfx::ImageSkia(), nullptr, + views::MenuItemView::Type::kNormal, ui::NORMAL_SEPARATOR); ASSERT_TRUE(inserted_item_); menu()->ChildrenChanged(); @@ -186,8 +186,8 @@ class MenuItemViewTestInsertWithSubmenu : public MenuTestBase { void Step2() { inserted_item_ = menu()->AddMenuItemAt( INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), base::string16(), - nullptr, gfx::ImageSkia(), nullptr, views::MenuItemView::Type::kNormal, - ui::NORMAL_SEPARATOR); + base::string16(), nullptr, gfx::ImageSkia(), nullptr, + views::MenuItemView::Type::kNormal, ui::NORMAL_SEPARATOR); ASSERT_TRUE(inserted_item_); menu()->ChildrenChanged(); diff --git a/chrome/browser/ui/views/status_icons/concat_menu_model.cc b/chrome/browser/ui/views/status_icons/concat_menu_model.cc index ead2226583589c2921db7a0d5e97dc6388c49b6c..d537405caad6c30af0f48a168a17252756250e46 100644 --- a/chrome/browser/ui/views/status_icons/concat_menu_model.cc +++ b/chrome/browser/ui/views/status_icons/concat_menu_model.cc @@ -33,6 +33,10 @@ base::string16 ConcatMenuModel::GetLabelAt(int index) const { return GetterImpl(&ui::MenuModel::GetLabelAt, index); } +base::string16 ConcatMenuModel::GetSublabelAt(int index) const { + return GetterImpl(&ui::MenuModel::GetSublabelAt, index); +} + base::string16 ConcatMenuModel::GetMinorTextAt(int index) const { return GetterImpl(&ui::MenuModel::GetMinorTextAt, index); } diff --git a/chrome/browser/ui/views/status_icons/concat_menu_model.h b/chrome/browser/ui/views/status_icons/concat_menu_model.h index 0ad30d57d6d13bc8d42920010145595ce0031573..7b73b5753cfd4595121e5b81fd3c95682869e17b 100644 --- a/chrome/browser/ui/views/status_icons/concat_menu_model.h +++ b/chrome/browser/ui/views/status_icons/concat_menu_model.h @@ -23,6 +23,7 @@ class ConcatMenuModel : public ui::MenuModel { ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; int GetCommandIdAt(int index) const override; base::string16 GetLabelAt(int index) const override; + base::string16 GetSublabelAt(int index) const override; base::string16 GetMinorTextAt(int index) const override; const gfx::VectorIcon* GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; diff --git a/ui/base/models/menu_model.cc b/ui/base/models/menu_model.cc index 73f0ab6d84d2cab6732866a6dc4b781faf630c0e..3319d058e8303066e0159d02d27ee2e8a46b38ec 100644 --- a/ui/base/models/menu_model.cc +++ b/ui/base/models/menu_model.cc @@ -46,6 +46,10 @@ bool MenuModel::GetModelAndIndexForCommandId(int command_id, return false; } +base::string16 MenuModel::GetSublabelAt(int index) const { + return base::string16(); +} + base::string16 MenuModel::GetMinorTextAt(int index) const { return base::string16(); } diff --git a/ui/base/models/menu_model.h b/ui/base/models/menu_model.h index 5bcc6204c2b579fb2cba47ba1bc156967ec87faf..34e647d56dfe583a3484fb8df0a148064eacb07b 100644 --- a/ui/base/models/menu_model.h +++ b/ui/base/models/menu_model.h @@ -67,6 +67,10 @@ class UI_BASE_EXPORT MenuModel : public base::SupportsWeakPtr { // Returns the label of the item at the specified index. virtual base::string16 GetLabelAt(int index) const = 0; + // Returns the sublabel of the item at the specified index. The sublabel + // is rendered beneath the label and using the font GetLabelFontAt(). + virtual base::string16 GetSublabelAt(int index) const; + // Returns the minor text of the item at the specified index. The minor text // is rendered to the right of the label and using the font GetLabelFontAt(). virtual base::string16 GetMinorTextAt(int index) const; diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc index 6a55c0f82ce3df3d8b2b31dbb67830bb5464019c..c42dee1fc9ddccf5b5556fff7282a64d14c8333d 100644 --- a/ui/base/models/simple_menu_model.cc +++ b/ui/base/models/simple_menu_model.cc @@ -46,6 +46,16 @@ base::string16 SimpleMenuModel::Delegate::GetLabelForCommandId( return base::string16(); } +base::string16 SimpleMenuModel::Delegate::GetSublabelForCommandId( + int command_id) const { + return base::string16(); +} + +void SimpleMenuModel::SetSublabel(int index, const base::string16& sublabel) { + items_[ValidateItemIndex(index)].sublabel = sublabel; + MenuItemsChanged(); +} + bool SimpleMenuModel::Delegate::GetIconForCommandId( int command_id, gfx::Image* image_skia) const { return false; @@ -404,6 +414,12 @@ base::string16 SimpleMenuModel::GetLabelAt(int index) const { return items_[ValidateItemIndex(index)].label; } +base::string16 SimpleMenuModel::GetSublabelAt(int index) const { + if (IsItemDynamicAt(index)) + return delegate_->GetSublabelForCommandId(GetCommandIdAt(index)); + return items_[ValidateItemIndex(index)].sublabel; +} + base::string16 SimpleMenuModel::GetMinorTextAt(int index) const { return items_[ValidateItemIndex(index)].minor_text; } diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h index 1ae8909a1404a43b34b9ef585511c7a3de39fa28..0d2a74ab5e9d55201a4992d81aecf9c2a83af5b8 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -47,6 +47,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { // Some command ids have labels and icons that change over time. virtual bool IsItemForCommandIdDynamic(int command_id) const; virtual base::string16 GetLabelForCommandId(int command_id) const; + virtual base::string16 GetSublabelForCommandId(int command_id) const; // Gets the icon for the item with the specified id, returning true if there // is an icon, false otherwise. virtual bool GetIconForCommandId(int command_id, @@ -174,6 +175,9 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { // Sets the label for the item at |index|. void SetLabel(int index, const base::string16& label); + // Sets the sublabel for the item at |index|. + void SetSublabel(int index, const base::string16& sublabel); + // Sets the minor text for the item at |index|. void SetMinorText(int index, const base::string16& minor_text); @@ -200,6 +204,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; int GetCommandIdAt(int index) const override; base::string16 GetLabelAt(int index) const override; + base::string16 GetSublabelAt(int index) const override; base::string16 GetMinorTextAt(int index) const override; const gfx::VectorIcon* GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; @@ -235,6 +240,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { int command_id = 0; ItemType type = TYPE_COMMAND; base::string16 label; + base::string16 sublabel; base::string16 minor_text; const gfx::VectorIcon* minor_icon = nullptr; gfx::Image icon; diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index c67fc8503db775079068d23c84bee615506ee81f..189951e6b3bdadbf9bc0bc17fb4263a4aa2deec5 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc @@ -279,6 +279,7 @@ MenuItemView* MenuItemView::AddMenuItemAt( int index, int item_id, const base::string16& label, + const base::string16& sublabel, const base::string16& minor_text, const gfx::VectorIcon* minor_icon, const gfx::ImageSkia& icon, @@ -299,6 +300,7 @@ MenuItemView* MenuItemView::AddMenuItemAt( item->SetTitle(GetDelegate()->GetLabel(item_id)); else item->SetTitle(label); + item->SetSubtitle(sublabel); item->SetMinorText(minor_text); item->SetMinorIcon(minor_icon); if (vector_icon) { @@ -340,21 +342,22 @@ void MenuItemView::RemoveAllMenuItems() { MenuItemView* MenuItemView::AppendMenuItem(int item_id, const base::string16& label, const gfx::ImageSkia& icon) { - return AppendMenuItemImpl(item_id, label, icon, Type::kNormal); + return AppendMenuItemImpl(item_id, label, base::string16(), icon, Type::kNormal); } MenuItemView* MenuItemView::AppendSubMenu(int item_id, const base::string16& label, const gfx::ImageSkia& icon) { - return AppendMenuItemImpl(item_id, label, icon, Type::kSubMenu); + return AppendMenuItemImpl(item_id, label, base::string16(), icon, Type::kSubMenu); } void MenuItemView::AppendSeparator() { - AppendMenuItemImpl(0, base::string16(), gfx::ImageSkia(), Type::kSeparator); + AppendMenuItemImpl(0, base::string16(), base::string16(), gfx::ImageSkia(), Type::kSeparator); } void MenuItemView::AddSeparatorAt(int index) { AddMenuItemAt(index, /*item_id=*/0, /*label=*/base::string16(), + /*sub_label=*/base::string16(), /*minor_text=*/base::string16(), /*minor_icon=*/nullptr, /*icon=*/gfx::ImageSkia(), /*vector_icon=*/nullptr, /*type=*/Type::kSeparator, @@ -363,10 +366,11 @@ void MenuItemView::AddSeparatorAt(int index) { MenuItemView* MenuItemView::AppendMenuItemImpl(int item_id, const base::string16& label, + const base::string16& sublabel, const gfx::ImageSkia& icon, Type type) { const int index = submenu_ ? int{submenu_->children().size()} : 0; - return AddMenuItemAt(index, item_id, label, base::string16(), nullptr, icon, + return AddMenuItemAt(index, item_id, label, sublabel, base::string16(), nullptr, icon, nullptr, type, ui::NORMAL_SEPARATOR); } @@ -399,6 +403,11 @@ void MenuItemView::SetTitle(const base::string16& title) { invalidate_dimensions(); // Triggers preferred size recalculation. } +void MenuItemView::SetSubtitle(const base::string16& subtitle) { + subtitle_ = subtitle; + invalidate_dimensions(); // Triggers preferred size recalculation. +} + void MenuItemView::SetMinorText(const base::string16& minor_text) { minor_text_ = minor_text; invalidate_dimensions(); // Triggers preferred size recalculation. @@ -989,13 +998,23 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { (!delegate || delegate->ShouldReserveSpaceForSubmenuIndicator() ? item_right_margin_ : config.arrow_to_edge_padding); - gfx::Rect text_bounds(label_start, top_margin, width, available_height); + gfx::Rect text_bounds(label_start, top_margin, width, + subtitle_.empty() ? available_height + : available_height / 2); text_bounds.set_x(GetMirroredXForRect(text_bounds)); int flags = GetDrawStringFlags(); if (mode == PaintButtonMode::kForDrag) flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; canvas->DrawStringRectWithFlags(title(), style.font_list, style.foreground, text_bounds, flags); + if (!subtitle_.empty()) { + canvas->DrawStringRectWithFlags( + subtitle_, style.font_list, + GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_MenuItemMinorTextColor), + text_bounds + gfx::Vector2d(0, style.font_list.GetHeight()), flags); + } + PaintMinorIconAndText(canvas, style); // Set the submenu indicator (arrow) image and color. @@ -1244,15 +1263,20 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() const { // Determine the length of the label text. int string_width = gfx::GetStringWidth(title_, style.font_list); + if (!subtitle_.empty()) { + string_width = + std::max(string_width, gfx::GetStringWidth(subtitle_, style.font_list)); + } dimensions.standard_width = string_width + label_start + item_right_margin_; // Determine the length of the right-side text. dimensions.minor_text_width = minor_text.empty() ? 0 : gfx::GetStringWidth(minor_text, style.font_list); // Determine the height to use. - dimensions.height = - std::max(dimensions.height, style.font_list.GetHeight() + - GetBottomMargin() + GetTopMargin()); + dimensions.height = std::max( + dimensions.height, (subtitle_.empty() ? 0 : style.font_list.GetHeight()) + + style.font_list.GetHeight() + GetBottomMargin() + + GetTopMargin()); dimensions.height = std::max(dimensions.height, MenuConfig::instance().item_min_height); diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index 294b0ea5d2bf28a41a1ae5e114d6e68936b958a9..ae97f8d3bb4b94ea89957cb761ee63ffab78b26a 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h @@ -153,6 +153,7 @@ class VIEWS_EXPORT MenuItemView : public View { MenuItemView* AddMenuItemAt(int index, int item_id, const base::string16& label, + const base::string16& sublabel, const base::string16& minor_text, const gfx::VectorIcon* minor_icon, const gfx::ImageSkia& icon, @@ -195,6 +196,7 @@ class VIEWS_EXPORT MenuItemView : public View { // All the AppendXXX methods funnel into this. MenuItemView* AppendMenuItemImpl(int item_id, const base::string16& label, + const base::string16& sublabel, const gfx::ImageSkia& icon, Type type); @@ -219,6 +221,9 @@ class VIEWS_EXPORT MenuItemView : public View { void SetTitle(const base::string16& title); const base::string16& title() const { return title_; } + // Sets the subtitle. + void SetSubtitle(const base::string16& subtitle); + // Sets the minor text. void SetMinorText(const base::string16& minor_text); @@ -427,7 +432,7 @@ class VIEWS_EXPORT MenuItemView : public View { void DestroyAllMenuHosts(); // Returns the text that should be displayed on the end (right) of the menu - // item. This will be the accelerator (if one exists). + // item. This will be the accelerator (if one exists), otherwise |subtitle_|. base::string16 GetMinorText() const; // Returns the icon that should be displayed to the left of the minor text. @@ -518,6 +523,9 @@ class VIEWS_EXPORT MenuItemView : public View { // Title. base::string16 title_; + // Subtitle/sublabel. + base::string16 subtitle_; + // Minor text. base::string16 minor_text_; diff --git a/ui/views/controls/menu/menu_item_view_unittest.cc b/ui/views/controls/menu/menu_item_view_unittest.cc index 6b5229578e0856a07c85db7d5eb36ffee812cef8..3d90eefa5345f4dc8563dfcefb2ee1376dd668d3 100644 --- a/ui/views/controls/menu/menu_item_view_unittest.cc +++ b/ui/views/controls/menu/menu_item_view_unittest.cc @@ -322,10 +322,10 @@ class MenuItemViewPaintUnitTest : public ViewsTestBase { // Provides assertion coverage for painting minor text and icons. TEST_F(MenuItemViewPaintUnitTest, MinorTextAndIconAssertionCoverage) { auto AddItem = [this](auto label, auto minor_label, auto minor_icon) { - menu_item_view()->AddMenuItemAt(0, 1000, base::ASCIIToUTF16(label), - minor_label, minor_icon, gfx::ImageSkia(), - nullptr, views::MenuItemView::Type::kNormal, - ui::NORMAL_SEPARATOR); + menu_item_view()->AddMenuItemAt( + 0, 1000, base::ASCIIToUTF16(label), base::string16(), minor_label, + minor_icon, gfx::ImageSkia(), nullptr, views::MenuItemView::Type::kNormal, + ui::NORMAL_SEPARATOR); }; AddItem("No minor content", base::string16(), nullptr); AddItem("Minor text only", base::ASCIIToUTF16("minor text"), nullptr); diff --git a/ui/views/controls/menu/menu_model_adapter.cc b/ui/views/controls/menu/menu_model_adapter.cc index 373ea41937feea562ed25dbcb8c1ad6546beecb5..7307ac7b82b6432343c404d19cf0cdd60557d3d5 100644 --- a/ui/views/controls/menu/menu_model_adapter.cc +++ b/ui/views/controls/menu/menu_model_adapter.cc @@ -99,8 +99,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model, if (*type == MenuItemView::Type::kSeparator) { return menu->AddMenuItemAt(menu_index, item_id, base::string16(), - base::string16(), nullptr, gfx::ImageSkia(), - nullptr, *type, + base::string16(), base::string16(), nullptr, + gfx::ImageSkia(), nullptr, *type, model->GetSeparatorTypeAt(model_index)); } @@ -108,7 +108,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model, model->GetIconAt(model_index, &icon); return menu->AddMenuItemAt( menu_index, item_id, model->GetLabelAt(model_index), - model->GetMinorTextAt(model_index), model->GetMinorIconAt(model_index), + model->GetSublabelAt(model_index), model->GetMinorTextAt(model_index), + model->GetMinorIconAt(model_index), icon.IsEmpty() ? gfx::ImageSkia() : *icon.ToImageSkia(), icon.IsEmpty() ? model->GetVectorIconAt(model_index) : nullptr, *type, ui::NORMAL_SEPARATOR);