diff --git a/app/brave_settings_strings.grdp b/app/brave_settings_strings.grdp index 1a3bf76def7..58b4becfb8c 100644 --- a/app/brave_settings_strings.grdp +++ b/app/brave_settings_strings.grdp @@ -788,25 +788,35 @@ Block sites from autoplaying videos - + Ethereum - + Ask when a site wants to access the Ethereum provider API - + Block sites from accessing the Ethereum provider API - + Solana - + Ask when a site wants to access the Solana provider API - + Block sites from accessing the Solana provider API + + + Cardano + + + Ask when a site wants to access the Cardano provider API + + + Block sites from accessing the Cardano provider API + Google Sign-In diff --git a/browser/resources/settings/brave_overrides/privacy_page.ts b/browser/resources/settings/brave_overrides/privacy_page.ts index fff53aa8204..dc0119e32a4 100644 --- a/browser/resources/settings/brave_overrides/privacy_page.ts +++ b/browser/resources/settings/brave_overrides/privacy_page.ts @@ -162,6 +162,36 @@ function InsertSolanaSubpage (pages: Element) `) } +function InsertCardanoSubpage (pages: Element) +{ + pages.appendChild( + html` + + `) +} + function InsertShieldsSubpage (pages: Element) { pages.appendChild( @@ -246,9 +276,14 @@ RegisterPolymerTemplateModifications({ InsertAutoplaySubpage(pages) const isNativeBraveWalletEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') + const isCardanoDappSupportFeatureEnabled = + loadTimeData.getBoolean('isCardanoDappSupportFeatureEnabled') if (isNativeBraveWalletEnabled) { InsertEthereumSubpage(pages) InsertSolanaSubpage(pages) + if (isCardanoDappSupportFeatureEnabled) { + InsertCardanoSubpage(pages) + } } InsertShieldsSubpage(pages) const permissionsLinkRow = diff --git a/browser/resources/settings/brave_overrides/site_details.ts b/browser/resources/settings/brave_overrides/site_details.ts index 66d34916ee1..fe083c185c8 100644 --- a/browser/resources/settings/brave_overrides/site_details.ts +++ b/browser/resources/settings/brave_overrides/site_details.ts @@ -119,6 +119,8 @@ RegisterPolymerTemplateModifications({ } const isNativeBraveWalletEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') + const isCardanoDappSupportFeatureEnabled = + loadTimeData.getBoolean('isCardanoDappSupportFeatureEnabled') if (isNativeBraveWalletEnabled) { insertBefore(firstPermissionItem, html` + `) + const cardanoSettings = templateContent.querySelector( + `div.list-frame > site-details-permission:nth-child(${curChild})`) + if (!cardanoSettings) { + console.error('[Settings] Couldn\'t find Cardano settings') + } else { + cardanoSettings.setAttribute( + 'label', loadTimeData.getString('siteSettingsCardano')) + } + } + const adPersonalization = templateContent.querySelector('#adPersonalization') if (!adPersonalization) { diff --git a/browser/resources/settings/brave_overrides/site_settings_page.ts b/browser/resources/settings/brave_overrides/site_settings_page.ts index 4725bdc8973..382d3a2a5b7 100644 --- a/browser/resources/settings/brave_overrides/site_settings_page.ts +++ b/browser/resources/settings/brave_overrides/site_settings_page.ts @@ -155,6 +155,8 @@ RegisterPolymerComponentReplacement( } const isNativeBraveWalletEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') + const isCardanoDappSupportFeatureEnabled = + loadTimeData.getBoolean('isCardanoDappSupportFeatureEnabled') if (isNativeBraveWalletEnabled) { currentIndex++ const ethereumItem = { @@ -176,6 +178,18 @@ RegisterPolymerComponentReplacement( disabledLabel: 'siteSettingsSolanaBlock' } lists.permissionsAdvanced.splice(currentIndex, 0, solanaItem) + if (isCardanoDappSupportFeatureEnabled) { + currentIndex++ + const cardanoItem = { + route: routes.SITE_SETTINGS_CARDANO, + id: ContentSettingsTypes.CARDANO, + label: 'siteSettingsCardano', + icon: 'cardano-on', + enabledLabel: 'siteSettingsCardanoAsk', + disabledLabel: 'siteSettingsCardanoBlock' + } + lists.permissionsAdvanced.splice(currentIndex, 0, cardanoItem) + } } } } diff --git a/browser/resources/settings/brave_routes.ts b/browser/resources/settings/brave_routes.ts index 28c082e104c..8759291a614 100644 --- a/browser/resources/settings/brave_routes.ts +++ b/browser/resources/settings/brave_routes.ts @@ -93,9 +93,14 @@ export default function addBraveRoutes(r: Partial) { } const isNativeBraveWalletFeatureEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') + const isCardanoDappSupportFeatureEnabled = + loadTimeData.getBoolean('isCardanoDappSupportFeatureEnabled') if (isNativeBraveWalletFeatureEnabled) { r.SITE_SETTINGS_ETHEREUM = r.SITE_SETTINGS.createChild('ethereum') r.SITE_SETTINGS_SOLANA = r.SITE_SETTINGS.createChild('solana') + if (isCardanoDappSupportFeatureEnabled) { + r.SITE_SETTINGS_CARDANO = r.SITE_SETTINGS.createChild('cardano') + } } r.SITE_SETTINGS_SHIELDS_STATUS = r.SITE_SETTINGS.createChild('braveShields') if (r.SITE_SETTINGS_ADS) { diff --git a/browser/ui/webui/brave_settings_ui.cc b/browser/ui/webui/brave_settings_ui.cc index 4483725b223..99f6c92950c 100644 --- a/browser/ui/webui/brave_settings_ui.cc +++ b/browser/ui/webui/brave_settings_ui.cc @@ -33,6 +33,7 @@ #include "brave/components/ai_chat/core/common/features.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_vpn/common/features.h" +#include "brave/components/brave_wallet/common/common_utils.h" #include "brave/components/brave_wallet/common/features.h" #include "brave/components/commander/common/features.h" #include "brave/components/commands/common/commands.mojom.h" @@ -162,6 +163,8 @@ void BraveSettingsUI::AddResources(content::WebUIDataSource* html_source, "isNativeBraveWalletFeatureEnabled", base::FeatureList::IsEnabled( brave_wallet::features::kNativeBraveWalletFeature)); + html_source->AddBoolean("isCardanoDappSupportFeatureEnabled", + brave_wallet::IsCardanoDAppSupportEnabled()); html_source->AddBoolean("isBraveWalletAllowed", brave_wallet::IsAllowedForContext(profile)); html_source->AddBoolean("isForgetFirstPartyStorageFeatureEnabled", diff --git a/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc b/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc index e0053e51725..61ea6e0f972 100644 --- a/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc +++ b/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc @@ -118,6 +118,9 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source, {"siteSettingsCategorySolana", IDS_SETTINGS_SITE_SETTINGS_SOLANA}, {"siteSettingsSolanaAsk", IDS_SETTINGS_SITE_SETTINGS_SOLANA_ASK}, {"siteSettingsSolanaBlock", IDS_SETTINGS_SITE_SETTINGS_SOLANA_BLOCK}, + {"siteSettingsCardano", IDS_SETTINGS_SITE_SETTINGS_CARDANO}, + {"siteSettingsCardanoAsk", IDS_SETTINGS_SITE_SETTINGS_CARDANO_ASK}, + {"siteSettingsCardanoBlock", IDS_SETTINGS_SITE_SETTINGS_CARDANO_BLOCK}, {"siteSettingsGoogleSignIn", IDS_SETTINGS_SITE_SETTINGS_GOOGLE_SIGN_IN}, {"siteSettingsCategoryGoogleSignIn", diff --git a/components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx b/components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx index 1d9308a3148..0774fdb4ec0 100644 --- a/components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx +++ b/components/brave_wallet_ui/components/desktop/wallet-menus/wallet_settings_menu.tsx @@ -85,8 +85,20 @@ export const WalletSettingsMenu = (props: Props) => { return } - const route = - selectedNetwork.coin === BraveWallet.CoinType.ETH ? 'ethereum' : 'solana' + let route: string + switch (selectedNetwork.coin) { + case BraveWallet.CoinType.ETH: + route = 'ethereum' + break + case BraveWallet.CoinType.SOL: + route = 'solana' + break + case BraveWallet.CoinType.ADA: + route = 'cardano' + break + default: + throw new Error('Coin not supported') + } chrome.tabs.create({ url: `brave://settings/content/${route}` }, () => { if (chrome.runtime.lastError) { diff --git a/patches/chrome-browser-resources-settings-router.ts.patch b/patches/chrome-browser-resources-settings-router.ts.patch index 54d3952b2cc..f54bad63f8a 100644 --- a/patches/chrome-browser-resources-settings-router.ts.patch +++ b/patches/chrome-browser-resources-settings-router.ts.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts -index 25270f0b11a5b29207154fba580fe98978f5035d..1e448ed15c9e4aa2b21242a9020fc93e5c2de79e 100644 +index 25270f0b11a5b29207154fba580fe98978f5035d..48de0ed914d8abad79ea2e2cdb61c1c4fbd7fb8f 100644 --- a/chrome/browser/resources/settings/router.ts +++ b/chrome/browser/resources/settings/router.ts @@ -121,6 +121,7 @@ export interface SettingsRoutes { IMPORT_DATA: Route; SIGN_OUT: Route; // -+ GET_STARTED: Route; SHIELDS: Route; SOCIAL_BLOCKING: Route; EXTENSIONS: Route; EXTENSIONS_V2: Route; BRAVE_SYNC: Route; BRAVE_SYNC_SETUP: Route; BRAVE_WALLET: Route; BRAVE_WEB3: Route; BRAVE_NEW_TAB: Route; THEMES: Route; SITE_SETTINGS_AUTOPLAY: Route; SITE_SETTINGS_GOOGLE_SIGN_IN: Route; SITE_SETTINGS_LOCALHOST_ACCESS: Route; SITE_SETTINGS_BRAVE_OPEN_AI_CHAT: Route; SITE_SETTINGS_ETHEREUM: Route; SITE_SETTINGS_SOLANA: Route; SITE_SETTINGS_SHIELDS_STATUS: Route; SHIELDS_ADBLOCK: Route; SHORTCUTS: Route; BRAVE_WALLET_NETWORKS: Route; BRAVE_LEO_ASSISTANT: Route; BRAVE_CONTENT: Route; BRAVE_SURVEY_PANELIST: Route; DEFAULT_SEARCH: Route; PRIVATE_SEARCH: Route; ++ GET_STARTED: Route; SHIELDS: Route; SOCIAL_BLOCKING: Route; EXTENSIONS: Route; EXTENSIONS_V2: Route; BRAVE_SYNC: Route; BRAVE_SYNC_SETUP: Route; BRAVE_WALLET: Route; BRAVE_WEB3: Route; BRAVE_NEW_TAB: Route; THEMES: Route; SITE_SETTINGS_AUTOPLAY: Route; SITE_SETTINGS_GOOGLE_SIGN_IN: Route; SITE_SETTINGS_LOCALHOST_ACCESS: Route; SITE_SETTINGS_BRAVE_OPEN_AI_CHAT: Route; SITE_SETTINGS_ETHEREUM: Route; SITE_SETTINGS_SOLANA: Route; SITE_SETTINGS_CARDANO: Route; SITE_SETTINGS_SHIELDS_STATUS: Route; SHIELDS_ADBLOCK: Route; SHORTCUTS: Route; BRAVE_WALLET_NETWORKS: Route; BRAVE_LEO_ASSISTANT: Route; BRAVE_CONTENT: Route; BRAVE_SURVEY_PANELIST: Route; DEFAULT_SEARCH: Route; PRIVATE_SEARCH: Route; } /** Class for navigable routes. */ diff --git a/patches/chrome-browser-resources-settings-site_settings-constants.ts.patch b/patches/chrome-browser-resources-settings-site_settings-constants.ts.patch index 43368613213..478bbe82812 100644 --- a/patches/chrome-browser-resources-settings-site_settings-constants.ts.patch +++ b/patches/chrome-browser-resources-settings-site_settings-constants.ts.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts -index edae5264609c46bfc498d45e569f9b441f5d13b6..fac1a362eb5b433731f6aca4e7adc8b15994957c 100644 +index edae5264609c46bfc498d45e569f9b441f5d13b6..cfb0ec586a814bb1caa268d838e9b6f1caa7eb58 100644 --- a/chrome/browser/resources/settings/site_settings/constants.ts +++ b/chrome/browser/resources/settings/site_settings/constants.ts @@ -68,6 +68,7 @@ export enum ContentSettingsTypes { PDF_DOCUMENTS = 'pdfDocuments', SITE_DATA = 'site-data', OFFER_WRITING_HELP = 'offer-writing-help', -+ AUTOPLAY = 'autoplay', ETHEREUM = 'ethereum', SOLANA = 'solana', BRAVE_SHIELDS = 'braveShields', GOOGLE_SIGN_IN = 'googleSignIn', LOCALHOST_ACCESS = 'localhostAccess', BRAVE_OPEN_AI_CHAT = 'braveOpenAIChat' ++ AUTOPLAY = 'autoplay', ETHEREUM = 'ethereum', SOLANA = 'solana', CARDANO = 'cardano', BRAVE_SHIELDS = 'braveShields', GOOGLE_SIGN_IN = 'googleSignIn', LOCALHOST_ACCESS = 'localhostAccess', BRAVE_OPEN_AI_CHAT = 'braveOpenAIChat' } /** diff --git a/patches/chrome-browser-resources-settings-site_settings-settings_category_default_radio_group.ts.patch b/patches/chrome-browser-resources-settings-site_settings-settings_category_default_radio_group.ts.patch index 57cd2b1ed18..880cebf22ab 100644 --- a/patches/chrome-browser-resources-settings-site_settings-settings_category_default_radio_group.ts.patch +++ b/patches/chrome-browser-resources-settings-site_settings-settings_category_default_radio_group.ts.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts -index 7714bc08dfa780dc3137b9c13596c07ce032fa06..38b4a2e47f6a5164dfe352bd6c6e1be60add3ce6 100644 +index 7714bc08dfa780dc3137b9c13596c07ce032fa06..05eed61464ddf53d98117b174e4b4256e3ecb056 100644 --- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts +++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts @@ -174,6 +174,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends case ContentSettingsTypes.WEB_PRINTING: // "Ask" vs "Blocked". return ContentSetting.ASK; -+ case ContentSettingsTypes.ETHEREUM: case ContentSettingsTypes.SOLANA: case ContentSettingsTypes.GOOGLE_SIGN_IN: case ContentSettingsTypes.LOCALHOST_ACCESS: case ContentSettingsTypes.BRAVE_OPEN_AI_CHAT: return ContentSetting.ASK; case ContentSettingsTypes.AUTOPLAY: return ContentSetting.ALLOW; ++ case ContentSettingsTypes.ETHEREUM: case ContentSettingsTypes.SOLANA: case ContentSettingsTypes.CARDANO: case ContentSettingsTypes.GOOGLE_SIGN_IN: case ContentSettingsTypes.LOCALHOST_ACCESS: case ContentSettingsTypes.BRAVE_OPEN_AI_CHAT: return ContentSetting.ASK; case ContentSettingsTypes.AUTOPLAY: return ContentSetting.ALLOW; default: assertNotReached('Invalid category: ' + this.category); } diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 81ee792ec3b..abc6e682473 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn @@ -199,6 +199,8 @@ leo_icons = [ "carat-left.svg", "carat-right.svg", "carat-up.svg", + "cardano-off.svg", + "cardano-on.svg", "check-circle-filled.svg", "check-circle-outline.svg", "check-normal.svg",