From 2bd08cbebfa3a290331cb4897430610cf067518f Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Tue, 4 Jun 2024 11:52:59 +0900 Subject: [PATCH 1/3] Re-branding app menu's icon fix https://github.com/brave/brave-browser/issues/38589 --- browser/ui/toolbar/app_menu_icons.cc | 41 +++++++++++++++++----- browser/ui/toolbar/brave_app_menu_model.cc | 16 +++++++++ components/vector_icons/BUILD.gn | 9 +++++ 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/browser/ui/toolbar/app_menu_icons.cc b/browser/ui/toolbar/app_menu_icons.cc index 0d155c9db776..98a839a26529 100644 --- a/browser/ui/toolbar/app_menu_icons.cc +++ b/browser/ui/toolbar/app_menu_icons.cc @@ -32,16 +32,17 @@ const std::map& GetCommandIcons() { {IDC_SHOW_BRAVE_WALLET, kLeoProductBraveWalletIcon}, {IDC_BRAVE_VPN_MENU, kLeoProductVpnIcon}, {IDC_APP_MENU_IPFS, kLeoProductIpfsOutlineIcon}, + {IDC_PASSWORDS_AND_AUTOFILL_MENU, kLeoKeyIcon}, {IDC_RECENT_TABS_MENU, kLeoHistoryIcon}, {IDC_BOOKMARKS_MENU, kLeoProductBookmarksIcon}, - {IDC_VIEW_PASSWORDS, kLeoKeyIcon}, {IDC_SHOW_DOWNLOADS, kLeoDownloadIcon}, {IDC_MANAGE_EXTENSIONS, kLeoBrowserExtensionsIcon}, {IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, kLeoBrowserExtensionsIcon}, {IDC_ZOOM_MENU, kLeoSearchZoomInIcon}, {IDC_PRINT, kLeoPrintIcon}, + {IDC_FIND_AND_EDIT_MENU, kLeoFileSearchIcon}, + {IDC_SAVE_AND_SHARE_MENU, kLeoFileDownloadIcon}, {IDC_MORE_TOOLS_MENU, kLeoWindowScrewdriverIcon}, - {IDC_EDIT_MENU, kLeoCopyPlainTextIcon}, {IDC_OPTIONS, kLeoSettingsIcon}, {IDC_HELP_MENU, kLeoHelpOutlineIcon}, {IDC_EXIT, kLeoCloseIcon}, @@ -59,25 +60,49 @@ const std::map& GetCommandIcons() { {IDC_BOOKMARK_ALL_TABS, kLeoBrowserBookmarkPluralIcon}, {IDC_BRAVE_BOOKMARK_BAR_SUBMENU, kLeoProductBookmarksIcon}, {IDC_SHOW_BOOKMARK_MANAGER, kLeoWindowBookmarkIcon}, + {IDC_SHOW_BOOKMARK_SIDE_PANEL, kLeoProductBookmarksIcon}, {IDC_IMPORT_SETTINGS, kLeoImportArrowIcon}, {IDC_READING_LIST_MENU, kLeoReadingListIcon}, // The `History submenu {IDC_SHOW_HISTORY, kLeoHistoryIcon}, - {IDC_CLEAR_BROWSING_DATA, kLeoShredDataIcon}, + {IDC_CLEAR_BROWSING_DATA, kLeoTrashIcon}, {IDC_RECENT_TABS_NO_DEVICE_TABS, kLeoSmartphoneLaptopIcon}, - // The `Help` menu + // The `Help` submenu {IDC_ABOUT, kLeoBraveIconMonochromeIcon}, {IDC_HELP_PAGE_VIA_MENU, kLeoHelpOutlineIcon}, {IDC_SHOW_BRAVE_WEBCOMPAT_REPORTER, kLeoWarningTriangleOutlineIcon}, - // The `More tools` menu - {IDC_ADD_NEW_PROFILE, kLeoUserAddIcon}, - {IDC_OPEN_GUEST_PROFILE, kLeoUserCircleIcon}, + // The `Passwords and autofill` submenu + {IDC_SHOW_PASSWORD_MANAGER, kLeoKeyIcon}, + {IDC_SHOW_PAYMENT_METHODS, kLeoCreditCardIcon}, + {IDC_SHOW_ADDRESSES, kLeoLocationOnIcon}, + + // The `Find and edit` submenu {IDC_FIND, kLeoSearchIcon}, + // Use when cut icon is ready. + // {IDC_CUT, kLeoCutIcon}, + {IDC_COPY, kLeoCopyIcon}, + {IDC_PASTE, kLeoClipboardIcon}, + + // The `Save and share` submenu {IDC_SAVE_PAGE, kLeoFileDownloadIcon}, + {IDC_INSTALL_PWA, kLeoClipboardIcon}, + {IDC_OPEN_IN_PWA_WINDOW, kLeoLaunchIcon}, {IDC_CREATE_SHORTCUT, kLeoShareWindowsIcon}, + {IDC_COPY_URL, kLeoLinkNormalIcon}, + {IDC_SEND_TAB_TO_SELF, kLeoSmartphoneLaptopIcon}, + {IDC_QRCODE_GENERATOR, kLeoQrCodeIcon}, + {IDC_SHARING_HUB_SCREENSHOT, kLeoScreenshotIcon}, + + // The `Reading list` submenu + {IDC_READING_LIST_MENU_ADD_TAB, kLeoReadingListAddIcon}, + {IDC_READING_LIST_MENU_SHOW_UI, kLeoReadingListIcon}, + + // The `More tools` submenu + {IDC_ADD_NEW_PROFILE, kLeoUserAddIcon}, + {IDC_OPEN_GUEST_PROFILE, kLeoUserCircleIcon}, {IDC_NAME_WINDOW, kLeoEditBoxIcon}, {IDC_COMMANDER, kLeoArrowSmallRightIcon}, {IDC_PERFORMANCE, kLeoNetworkSpeedFastIcon}, @@ -85,8 +110,6 @@ const std::map& GetCommandIcons() { {IDC_TASK_MANAGER, kLeoWindowBinaryCodeIcon}, {IDC_SHOW_BRAVE_SYNC, kLeoProductSyncIcon}, {IDC_ROUTE_MEDIA, kLeoChromeCastIcon}, - {IDC_INSTALL_PWA, kLeoPwaInstallIcon}, - {IDC_OPEN_IN_PWA_WINDOW, kLeoLaunchIcon}, {IDC_SIDEBAR_SHOW_OPTION_MENU, kLeoBrowserSidebarRightIcon}, }); return *kCommandIcons.get(); diff --git a/browser/ui/toolbar/brave_app_menu_model.cc b/browser/ui/toolbar/brave_app_menu_model.cc index c9f5c75acab1..aaec80203900 100644 --- a/browser/ui/toolbar/brave_app_menu_model.cc +++ b/browser/ui/toolbar/brave_app_menu_model.cc @@ -198,9 +198,25 @@ void BraveAppMenuModel::Build() { ApplyLeoIcons(this); ApplyLeoIcons(bookmark_sub_menu_model()); + for (const auto& submenu : sub_menus()) { ApplyLeoIcons(submenu.get()); } + + // TODO(simonhong): apply reo icons recursively. + // Can be null in tests. + if (!bookmark_sub_menu_model()) { + return; + } + + if (const auto reading_list_submenu_index = + bookmark_sub_menu_model()->GetIndexOfCommandId( + IDC_READING_LIST_MENU)) { + auto* reading_list_submenu = bookmark_sub_menu_model()->GetSubmenuModelAt( + *reading_list_submenu_index); + CHECK(reading_list_submenu); + ApplyLeoIcons(static_cast(reading_list_submenu)); + } } void BraveAppMenuModel::BuildTabsAndWindowsSection() { diff --git a/components/vector_icons/BUILD.gn b/components/vector_icons/BUILD.gn index 8b1249a53adc..9cbe2713fa2b 100644 --- a/components/vector_icons/BUILD.gn +++ b/components/vector_icons/BUILD.gn @@ -29,15 +29,19 @@ aggregate_vector_icons("brave_components_vector_icons") { "leo_check_circle_filled.icon", "leo_check_circle_outline.icon", "leo_chrome_cast.icon", + "leo_clipboard.icon", "leo_close.icon", "leo_code.icon", + "leo_copy.icon", "leo_copy_plain_text.icon", + "leo_credit_card.icon", "leo_desktop_vpn_error_color.icon", "leo_desktop_vpn_on_color.icon", "leo_download.icon", "leo_edit_box.icon", "leo_eye_on.icon", "leo_file_download.icon", + "leo_file_search.icon", "leo_folder_exchange.icon", "leo_folder.icon", "leo_fullscreen_on.icon", @@ -48,7 +52,9 @@ aggregate_vector_icons("brave_components_vector_icons") { "leo_import_arrow.icon", "leo_info_outline.icon", "leo_key.icon", + "leo_link_normal.icon", "leo_launch.icon", + "leo_location_on.icon", "leo_message_bubble_heart.icon", "leo_more_vertical.icon", "leo_network_speed_fast.icon", @@ -70,9 +76,12 @@ aggregate_vector_icons("brave_components_vector_icons") { "leo_product_tor.icon", "leo_product_vpn.icon", "leo_pwa_install.icon", + "leo_qr_code.icon", "leo_reading_list.icon", + "leo_reading_list_add.icon", "leo_reload.icon", "leo_rss.icon", + "leo_screenshot.icon", "leo_search_zoom_in.icon", "leo_search.icon", "leo_settings.icon", From a563bcbaad752d76f84411cbc7375393ff20ffab Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Wed, 5 Jun 2024 15:34:42 +0900 Subject: [PATCH 2/3] Update browser/ui/toolbar/brave_app_menu_model.cc Co-authored-by: Jay Harris --- browser/ui/toolbar/brave_app_menu_model.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/ui/toolbar/brave_app_menu_model.cc b/browser/ui/toolbar/brave_app_menu_model.cc index aaec80203900..f32478314e56 100644 --- a/browser/ui/toolbar/brave_app_menu_model.cc +++ b/browser/ui/toolbar/brave_app_menu_model.cc @@ -203,7 +203,7 @@ void BraveAppMenuModel::Build() { ApplyLeoIcons(submenu.get()); } - // TODO(simonhong): apply reo icons recursively. + // TODO(simonhong): apply Nala icons recursively. // Can be null in tests. if (!bookmark_sub_menu_model()) { return; From bcc75947e9086748b41c0da1458899d1e45022e3 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Wed, 5 Jun 2024 22:01:13 +0900 Subject: [PATCH 3/3] Updated icon for pwa install menu --- browser/ui/toolbar/app_menu_icons.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/ui/toolbar/app_menu_icons.cc b/browser/ui/toolbar/app_menu_icons.cc index 98a839a26529..b90b0e5c43b0 100644 --- a/browser/ui/toolbar/app_menu_icons.cc +++ b/browser/ui/toolbar/app_menu_icons.cc @@ -88,7 +88,7 @@ const std::map& GetCommandIcons() { // The `Save and share` submenu {IDC_SAVE_PAGE, kLeoFileDownloadIcon}, - {IDC_INSTALL_PWA, kLeoClipboardIcon}, + {IDC_INSTALL_PWA, kLeoPwaInstallIcon}, {IDC_OPEN_IN_PWA_WINDOW, kLeoLaunchIcon}, {IDC_CREATE_SHORTCUT, kLeoShareWindowsIcon}, {IDC_COPY_URL, kLeoLinkNormalIcon},