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 7b4531d031e6ba365fc4db35e9b68658f00f79fd..a7ef23c0d6623136531696928778bd0801726aa0 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 bc3cb82154ab964d7ef28fdb90db17782eb74564..d4da1ad6447e0241433019e726edecc66ed76ad6 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(); +} + ui::ImageModel StatusIconMenuModel::GetIconForCommandId(int command_id) const { auto iter = item_states_.find(command_id); if (iter != item_states_.end() && !iter->second.icon.IsEmpty()) diff --git a/chrome/browser/status_icons/status_icon_menu_model.h b/chrome/browser/status_icons/status_icon_menu_model.h index c69344ab9b4e1a4fb1293abf65a392d513099e4a..b6f90d0a6902848b18201d12b7441d874807eee9 100644 --- a/chrome/browser/status_icons/status_icon_menu_model.h +++ b/chrome/browser/status_icons/status_icon_menu_model.h @@ -62,9 +62,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); @@ -78,6 +80,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; ui::ImageModel GetIconForCommandId(int command_id) 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 952714121ff7c5ffdcdb0d757450b53d926f2fc8..2c4de7bddc5d47ba4d0e528a98d4d1df65bc59f8 100644 --- a/chrome/browser/status_icons/status_icon_menu_model_unittest.cc +++ b/chrome/browser/status_icons/status_icon_menu_model_unittest.cc @@ -86,6 +86,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); image_arg = menu_model()->GetIconForCommandId(1); @@ -96,8 +100,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_TRUE(menu_model()->GetIconForCommandId(0).IsEmpty()); - // 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 331f33660d682c14f7c5d096d8d1241d3670f4ee..a1699d1bd23f3dc1e063bd1dc3f2818c543f40c2 100644 --- a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc @@ -92,8 +92,9 @@ class MenuItemViewTestInsert : public MenuTestBase { inserted_item_ = menu()->AddMenuItemAt( INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), base::string16(), - ui::ThemedVectorIcon(), gfx::ImageSkia(), ui::ThemedVectorIcon(), - views::MenuItemView::Type::kNormal, ui::NORMAL_SEPARATOR); + base::string16(), ui::ThemedVectorIcon(), gfx::ImageSkia(), + ui::ThemedVectorIcon(), views::MenuItemView::Type::kNormal, + ui::NORMAL_SEPARATOR); ASSERT_TRUE(inserted_item_); menu()->ChildrenChanged(); @@ -187,7 +188,11 @@ class MenuItemViewTestInsertWithSubmenu : public MenuTestBase { void Step2() { inserted_item_ = menu()->AddMenuItemAt( INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), base::string16(), +<<<<<<< HEAD ui::ThemedVectorIcon(), gfx::ImageSkia(), ui::ThemedVectorIcon(), +======= + base::string16(), nullptr, gfx::ImageSkia(), nullptr, +>>>>>>> Revert "Cleanup: Remove Menu Subtitles/Sublabels" 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 c6fb2f029c87391e13a9c05fe6c8f3f6e0b82779..5bf9acfa5c5ec08144b3e9e290fd19f15d307a8f 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 bad06f01f90b2ecfec3e7478034dde83ef643e53..c4414b8cb67f99dc4b1e4ed9088204f660a63098 100644 --- a/chrome/browser/ui/views/status_icons/concat_menu_model.h +++ b/chrome/browser/ui/views/status_icons/concat_menu_model.h @@ -24,6 +24,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; ui::ImageModel 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 90a350cf9ce045b1f920ff58d84cd9a32ab4b267..e31b71712591e54a33f93d7a1e44353a8a36ffaa 100644 --- a/ui/base/models/menu_model.cc +++ b/ui/base/models/menu_model.cc @@ -48,6 +48,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 887eee64e27f7437be2b308c1d74b0ea49efc745..340109357fb9840744f231d583722f369fa885d7 100644 --- a/ui/base/models/menu_model.h +++ b/ui/base/models/menu_model.h @@ -65,6 +65,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 88053e9d501413d18b6a6ae36b76668431db7ee9..2af6fb77acbe97e7dd7f02f646a91f0fb27878ab 100644 --- a/ui/base/models/simple_menu_model.cc +++ b/ui/base/models/simple_menu_model.cc @@ -49,6 +49,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(); +} + ImageModel SimpleMenuModel::Delegate::GetIconForCommandId( int command_id) const { return ImageModel(); @@ -364,6 +374,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 2b06f3f4a03227ac7898fc3563ab04518d24a313..f7c42c8cea2d7e8198e1fb58dbb2beaf006bf4b0 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -45,6 +45,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { virtual base::string16 GetLabelForCommandId(int command_id) const; // Gets the icon for the item with the specified id. virtual ImageModel GetIconForCommandId(int command_id) const; + virtual base::string16 GetSublabelForCommandId(int command_id) const; // Performs the action associates with the specified command id. // The passed |event_flags| are the flags from the event which issued this @@ -146,6 +147,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); @@ -172,6 +176,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; ImageModel GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; @@ -206,6 +211,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; ImageModel minor_icon; ImageModel icon; diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index 6f45e5ac5d1cec52f6f9a434c06cd894a788e421..2167b02facb30fcff40a166038e093fc7855bf49 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc @@ -261,6 +261,7 @@ MenuItemView* MenuItemView::AddMenuItemAt( int index, int item_id, const base::string16& label, + const base::string16& sublabel, const base::string16& minor_text, const ui::ThemedVectorIcon& minor_icon, const gfx::ImageSkia& icon, @@ -282,6 +283,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.empty()) { @@ -322,21 +324,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=*/ui::ThemedVectorIcon(), /*icon=*/gfx::ImageSkia(), @@ -347,10 +350,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(), + return AddMenuItemAt(index, item_id, label, sublabel, base::string16(), ui::ThemedVectorIcon(), icon, ui::ThemedVectorIcon(), type, ui::NORMAL_SEPARATOR); } @@ -383,6 +387,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. @@ -937,13 +946,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. @@ -1195,15 +1214,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 b38a048c22e6f89dfc02d7bda2ed053519a80e29..2db46616cb9a443d6fd280947e5a2673f9ca670c 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h @@ -148,6 +148,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 ui::ThemedVectorIcon& minor_icon, const gfx::ImageSkia& icon, @@ -190,6 +191,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); @@ -214,6 +216,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); @@ -420,7 +425,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. @@ -511,6 +516,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 119aa4a49c32c2cb14832fd88a520e8645b732bd..e1f99e1fc7a3e42173250f5980a35378867ab298 100644 --- a/ui/views/controls/menu/menu_item_view_unittest.cc +++ b/ui/views/controls/menu/menu_item_view_unittest.cc @@ -324,8 +324,8 @@ class MenuItemViewPaintUnitTest : public ViewsTestBase { 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(), ui::ThemedVectorIcon(), + 0, 1000, base::ASCIIToUTF16(label), base::string16(), minor_label, + minor_icon, gfx::ImageSkia(), ui::ThemedVectorIcon(), views::MenuItemView::Type::kNormal, ui::NORMAL_SEPARATOR); }; AddItem("No minor content", base::string16(), ui::ThemedVectorIcon()); diff --git a/ui/views/controls/menu/menu_model_adapter.cc b/ui/views/controls/menu/menu_model_adapter.cc index cbf9288765ade430451251f8f266975b2047828d..2aea7766d807120866872cbd7fa17776259f30b8 100644 --- a/ui/views/controls/menu/menu_model_adapter.cc +++ b/ui/views/controls/menu/menu_model_adapter.cc @@ -99,8 +99,9 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model, if (*type == MenuItemView::Type::kSeparator) { return menu->AddMenuItemAt(menu_index, item_id, base::string16(), - base::string16(), ui::ThemedVectorIcon(), - gfx::ImageSkia(), ui::ThemedVectorIcon(), *type, + base::string16(), base::string16(), + ui::ThemedVectorIcon(), gfx::ImageSkia(), + ui::ThemedVectorIcon(), *type, model->GetSeparatorTypeAt(model_index)); } @@ -108,6 +109,7 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model, ui::ImageModel minor_icon = model->GetMinorIconAt(model_index); return menu->AddMenuItemAt( menu_index, item_id, model->GetLabelAt(model_index), + model->GetSublabelAt(model_index), model->GetMinorTextAt(model_index), minor_icon.IsVectorIcon() ? ui::ThemedVectorIcon(minor_icon.GetVectorIcon())