diff --git a/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.cc b/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.cc index c67a872105f5..8959b2181e2e 100644 --- a/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.cc +++ b/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.cc @@ -3,32 +3,34 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" #include "brave/common/webui_url_constants.h" -#include "brave/components/vector_icons/vector_icons.h" #include "brave/components/ipfs/ipfs_constants.h" #include "brave/components/ipfs/ipfs_utils.h" +#include "brave/components/vector_icons/vector_icons.h" #include "brave/grit/brave_theme_resources.h" -#include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "components/grit/brave_components_strings.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/browser/ui/browser_finder.h" #include "ui/base/l10n/l10n_util.h" namespace { const char kIPFSDocsURL[] = "https://docs.ipfs.io/"; -std::unique_ptr CreateButton(int logo_resource_id, - int text_resource_id, int tooltip_resource_ud, +std::unique_ptr CreateButton( + int logo_resource_id, + int text_resource_id, + int tooltip_resource_id, views::Button::PressedCallback callback) { auto& bundle = ui::ResourceBundle::GetSharedInstance(); const auto& ipfs_logo = *bundle.GetImageSkiaNamed(logo_resource_id); const std::u16string& tooltip = - l10n_util::GetStringUTF16(tooltip_resource_ud); + l10n_util::GetStringUTF16(tooltip_resource_id); - return std::make_unique(std::move(callback), - ui::ImageModel::FromImageSkia(ipfs_logo), + return std::make_unique( + std::move(callback), ui::ImageModel::FromImageSkia(ipfs_logo), text_resource_id, std::u16string(), PageInfoViewFactory::VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_COOKIE_DIALOG, tooltip, std::u16string()); @@ -36,43 +38,47 @@ std::unique_ptr CreateButton(int logo_resource_id, } // namespace -#define InitializeUiState InitializeUiState(this); \ - if (ipfs::IsIPFSScheme(url)) BraveAddIPFSButtons +// clang-format off +#define InitializeUiState InitializeUiState(this); if (ipfs::IsIPFSScheme(url)) BraveAddIPFSButtons // NOLINT +// clang-format on #include "../../../../../../../chrome/browser/ui/views/page_info/page_info_bubble_view.cc" #undef InitializeUiState void PageInfoBubbleView::BraveAddIPFSButtons(PageInfoBubbleView* ui) { - site_settings_view_->AddChildViewAt(CreateButton( - IDR_BRAVE_IPFS_LOGO, - IDS_PAGE_INFO_IPFS_SETTINGS_BUTTON_TEXT, - IDS_PAGE_INFO_IPFS_SETTINGS_BUTTON_TOOLTIP_TEXT, - base::BindRepeating( - [](Profile* profile) { - chrome::AddTabAt(chrome::FindLastActiveWithProfile(profile), - GURL(ipfs::kIPFSSettingsURL), -1, true); - }, - profile_)), 0); - site_settings_view_->AddChildViewAt(CreateButton( - IDR_BRAVE_IPFS_LOGO, - IDS_PAGE_INFO_IPFS_DIAGNOSTICS_BUTTON_TEXT, - IDS_PAGE_INFO_IPFS_DIAGNOSTICS_BUTTON_TOOLTIP_TEXT, - base::BindRepeating( - [](Profile* profile) { - chrome::AddTabAt(chrome::FindLastActiveWithProfile(profile), - GURL(kIPFSWebUIURL), -1, true); - }, - profile_)), 0); - site_settings_view_->AddChildViewAt(CreateButton( - IDR_BRAVE_IPFS_LOGO, - IDS_PAGE_INFO_IPFS_DOCS_BUTTON_TEXT, - IDS_PAGE_INFO_IPFS_DOCS_BUTTON_TEXT_TOOLTIP_TEXT, - base::BindRepeating( - [](Profile* profile) { - chrome::AddTabAt(chrome::FindLastActiveWithProfile(profile), - GURL(kIPFSDocsURL), -1, true); - }, - profile_)), 0); + site_settings_view_->AddChildViewAt( + CreateButton(IDR_BRAVE_IPFS_LOGO, IDS_PAGE_INFO_IPFS_SETTINGS_BUTTON_TEXT, + IDS_PAGE_INFO_IPFS_SETTINGS_BUTTON_TOOLTIP_TEXT, + base::BindRepeating( + [](Profile* profile) { + chrome::AddTabAt( + chrome::FindLastActiveWithProfile(profile), + GURL(ipfs::kIPFSSettingsURL), -1, true); + }, + profile_)), + 0); + site_settings_view_->AddChildViewAt( + CreateButton( + IDR_BRAVE_IPFS_LOGO, IDS_PAGE_INFO_IPFS_DIAGNOSTICS_BUTTON_TEXT, + IDS_PAGE_INFO_IPFS_DIAGNOSTICS_BUTTON_TOOLTIP_TEXT, + base::BindRepeating( + [](Profile* profile) { + chrome::AddTabAt(chrome::FindLastActiveWithProfile(profile), + GURL(kIPFSWebUIURL), -1, true); + }, + profile_)), + 0); + site_settings_view_->AddChildViewAt( + CreateButton(IDR_BRAVE_IPFS_LOGO, IDS_PAGE_INFO_IPFS_DOCS_BUTTON_TEXT, + IDS_PAGE_INFO_IPFS_DOCS_BUTTON_TEXT_TOOLTIP_TEXT, + base::BindRepeating( + [](Profile* profile) { + chrome::AddTabAt( + chrome::FindLastActiveWithProfile(profile), + GURL(kIPFSDocsURL), -1, true); + }, + profile_)), + 0); Layout(); SizeToContents(); diff --git a/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.h b/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.h index 2614db849005..003fd9845bf8 100644 --- a/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.h +++ b/chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.h @@ -8,8 +8,9 @@ class PageInfoBubbleView; -#define HandleMoreInfoRequest BraveAddIPFSButtons(PageInfoBubbleView* ui); \ -void HandleMoreInfoRequest +#define HandleMoreInfoRequest \ + BraveAddIPFSButtons(PageInfoBubbleView* ui); \ + void HandleMoreInfoRequest #include "../../../../../../../chrome/browser/ui/views/page_info/page_info_bubble_view.h" #undef HandleMoreInfoRequest diff --git a/components/resources/ipfs_strings.grdp b/components/resources/ipfs_strings.grdp index 97174f9f5cb8..7bddb8be8588 100644 --- a/components/resources/ipfs_strings.grdp +++ b/components/resources/ipfs_strings.grdp @@ -121,22 +121,22 @@ InterPlanetary File System (IPFS) is a public network for peer-to-peer data storage and delivery. You can learn more about Brave's integration or configure your IPFS settings at any time. - IPFS Settings + IPFS settings - Go to IPFS Settings page + Go to the IPFS settings page - IPFS Diagnostics + IPFS diagnostics - Go to IPFS Diagnostics page + Go to the IPFS diagnostics page - IPFS Docs + IPFS docs - Go to IPFS Docs page + Go to the IPFS docs page IPFS import completed