diff --git a/browser/ui/content_settings/brave_content_setting_bubble_model.cc b/browser/ui/content_settings/brave_content_setting_bubble_model.cc index b9d7efd3adc5..c601814e79e1 100644 --- a/browser/ui/content_settings/brave_content_setting_bubble_model.cc +++ b/browser/ui/content_settings/brave_content_setting_bubble_model.cc @@ -7,6 +7,7 @@ #include "brave/components/brave_shields/common/brave_shield_constants.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/plugins/plugin_utils.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/subresource_filter/chrome_subresource_filter_client.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h" #include "chrome/grit/generated_resources.h" @@ -25,15 +26,24 @@ BraveContentSettingPluginBubbleModel::BraveContentSettingPluginBubbleModel( GURL url = web_contents->GetURL(); std::unique_ptr value = map->GetWebsiteSetting(url, url, content_type(), std::string(), &info); + + set_show_learn_more(true); + + // Do not show "Run flash this time" and "Manage" button in Tor profile. + if (profile->IsTorProfile()) { + set_manage_text_style(ContentSettingBubbleModel::ManageTextStyle::kNone); + return; + } + // If the setting is not managed by the user, hide the "Manage" button. if (info.source != content_settings::SETTING_SOURCE_USER) set_manage_text_style(ContentSettingBubbleModel::ManageTextStyle::kNone); + set_custom_link(l10n_util::GetStringUTF16(IDS_BLOCKED_PLUGINS_LOAD_ALL)); set_custom_link_enabled( web_contents && TabSpecificContentSettings::FromWebContents(web_contents) ->load_plugins_link_enabled()); - set_show_learn_more(true); } void BraveContentSettingPluginBubbleModel::OnLearnMoreClicked() { diff --git a/chromium_src/chrome/browser/ui/page_info/page_info.cc b/chromium_src/chrome/browser/ui/page_info/page_info.cc new file mode 100644 index 000000000000..8af39526bd7a --- /dev/null +++ b/chromium_src/chrome/browser/ui/page_info/page_info.cc @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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 "content/public/browser/web_contents.h" +#include "chrome/browser/ui/page_info/page_info_ui.h" +#include "chrome/browser/profiles/profile.h" + +namespace { + +bool BraveShouldShowPermission( + const PageInfoUI::PermissionInfo& info, + content::WebContents* web_contents) { + if ((info.type == CONTENT_SETTINGS_TYPE_PLUGINS || + info.type == CONTENT_SETTINGS_TYPE_GEOLOCATION) && + Profile::FromBrowserContext(web_contents->GetBrowserContext())->IsTorProfile()) { + return false; + } + + return true; +} + +} + +#include "../../../../../../chrome/browser/ui/page_info/page_info.cc" diff --git a/patches/chrome-browser-ui-page_info-page_info.cc.patch b/patches/chrome-browser-ui-page_info-page_info.cc.patch index 18341f5e6045..a4029743e5ce 100644 --- a/patches/chrome-browser-ui-page_info-page_info.cc.patch +++ b/patches/chrome-browser-ui-page_info-page_info.cc.patch @@ -1,8 +1,16 @@ diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc -index e7e7c5d1c2c0699f8892d4be90281c2bb7c7d1b9..1a6713c6604bab2f05d4d2de89a83f488e6be089 100644 +index e7e7c5d1c2c0699f8892d4be90281c2bb7c7d1b9..91c46da0bddfcf3ea3e2b4bc587a26138d79a3c3 100644 --- a/chrome/browser/ui/page_info/page_info.cc +++ b/chrome/browser/ui/page_info/page_info.cc -@@ -197,7 +197,7 @@ bool ShouldShowPermission( +@@ -152,6 +152,7 @@ bool ShouldShowPermission( + HostContentSettingsMap* content_settings, + content::WebContents* web_contents, + TabSpecificContentSettings* tab_specific_content_settings) { ++ if (!BraveShouldShowPermission(info, web_contents)) return false; + // Note |CONTENT_SETTINGS_TYPE_ADS| will show up regardless of its default + // value when it has been activated on the current origin. + if (info.type == CONTENT_SETTINGS_TYPE_ADS) { +@@ -197,7 +198,7 @@ bool ShouldShowPermission( } #endif @@ -11,7 +19,7 @@ index e7e7c5d1c2c0699f8892d4be90281c2bb7c7d1b9..1a6713c6604bab2f05d4d2de89a83f48 // Autoplay is Android-only at the moment. if (info.type == CONTENT_SETTINGS_TYPE_AUTOPLAY) return false; -@@ -1001,7 +1001,7 @@ void PageInfo::PresentSiteIdentity() { +@@ -1001,7 +1002,7 @@ void PageInfo::PresentSiteIdentity() { std::vector PageInfo::GetAllPermissionsForTesting() { std::vector permission_list; for (size_t i = 0; i < arraysize(kPermissionType); ++i) {