From b1857626477edd2885d9a317e96c2669b7ed01f8 Mon Sep 17 00:00:00 2001 From: Brandon-T Date: Mon, 4 Dec 2023 16:16:18 -0500 Subject: [PATCH] Fix #34240: Add WebUI & Expose WebViews to iOS (#20929) - Added WebUI implementation. - Exposed Chromium WebView Controller and WebView property to iOS. - Removed SyncInternals and Histogram controllers as the iOS side will use the WebView directly and supply its own URL. --- browser/ui/BUILD.gn | 1 + browser/ui/webui/brave_webui_source.cc | 814 +------------ chromium_src/chrome/browser/ui/webui/DEPS | 1 + .../chrome/browser/ui/webui/about_ui.cc | 56 +- chromium_src/ios/chrome/browser/ui/webui/DEPS | 5 + .../ios/chrome/browser/ui/webui/about_ui.cc | 13 + .../ios/chrome/browser/ui/webui/crashes_ui.cc | 11 + .../ios/chrome/browser/ui/webui/version_ui.mm | 11 + components/webui/BUILD.gn | 37 + components/webui/DEPS | 3 + components/webui/about_ui.cc | 60 + components/webui/about_ui.h | 17 + components/webui/webui_resources.cc | 1045 +++++++++++++++++ components/webui/webui_resources.h | 30 + ios/BUILD.gn | 3 +- ios/app/BUILD.gn | 1 + ios/app/brave_core_main.mm | 8 +- ios/browser/BUILD.gn | 6 + ios/browser/DEPS | 1 + ios/browser/api/p3a/BUILD.gn | 3 - .../p3a/brave_histograms_controller+private.h | 21 - .../api/p3a/brave_histograms_controller.h | 24 - .../api/p3a/brave_histograms_controller.mm | 118 -- ios/browser/api/p3a/brave_p3a_utils+private.h | 6 +- ios/browser/api/p3a/brave_p3a_utils.h | 3 - ios/browser/api/p3a/brave_p3a_utils.mm | 13 +- ios/browser/api/p3a/headers.gni | 5 +- ios/browser/api/sync/BUILD.gn | 16 +- ios/browser/api/sync/brave_sync_api.h | 2 - ios/browser/api/sync/brave_sync_api.mm | 10 - .../api/sync/brave_sync_internals+private.h | 23 - ios/browser/api/sync/brave_sync_internals.h | 22 - ios/browser/api/sync/brave_sync_internals.mm | 211 ---- ios/browser/api/web/BUILD.gn | 9 +- ios/browser/api/web/ui/BUILD.gn | 35 + ios/browser/api/web/ui/chrome_webview.h | 26 + ios/browser/api/web/ui/chrome_webview.mm | 133 +++ ios/browser/api/web/ui/headers.gni | 7 + ios/browser/brave_web_client.h | 3 + ios/browser/brave_web_client.mm | 18 + ios/browser/ui/webui/BUILD.gn | 36 + ios/browser/ui/webui/DEPS | 6 + .../webui/brave_web_ui_controller_factory.h | 44 + .../webui/brave_web_ui_controller_factory.mm | 103 ++ ios/browser/ui/webui/brave_webui_source.h | 35 + ios/browser/ui/webui/brave_webui_source.mm | 65 + 46 files changed, 1783 insertions(+), 1337 deletions(-) create mode 100644 chromium_src/ios/chrome/browser/ui/webui/DEPS create mode 100644 chromium_src/ios/chrome/browser/ui/webui/about_ui.cc create mode 100644 chromium_src/ios/chrome/browser/ui/webui/crashes_ui.cc create mode 100644 chromium_src/ios/chrome/browser/ui/webui/version_ui.mm create mode 100644 components/webui/BUILD.gn create mode 100644 components/webui/DEPS create mode 100644 components/webui/about_ui.cc create mode 100644 components/webui/about_ui.h create mode 100644 components/webui/webui_resources.cc create mode 100644 components/webui/webui_resources.h delete mode 100644 ios/browser/api/p3a/brave_histograms_controller+private.h delete mode 100644 ios/browser/api/p3a/brave_histograms_controller.h delete mode 100644 ios/browser/api/p3a/brave_histograms_controller.mm delete mode 100644 ios/browser/api/sync/brave_sync_internals+private.h delete mode 100644 ios/browser/api/sync/brave_sync_internals.h delete mode 100644 ios/browser/api/sync/brave_sync_internals.mm create mode 100644 ios/browser/api/web/ui/BUILD.gn create mode 100644 ios/browser/api/web/ui/chrome_webview.h create mode 100644 ios/browser/api/web/ui/chrome_webview.mm create mode 100644 ios/browser/api/web/ui/headers.gni create mode 100644 ios/browser/ui/webui/BUILD.gn create mode 100644 ios/browser/ui/webui/DEPS create mode 100644 ios/browser/ui/webui/brave_web_ui_controller_factory.h create mode 100644 ios/browser/ui/webui/brave_web_ui_controller_factory.mm create mode 100644 ios/browser/ui/webui/brave_webui_source.h create mode 100644 ios/browser/ui/webui/brave_webui_source.mm diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index fc64b4e195c0..1d03a92b1a99 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -564,6 +564,7 @@ source_set("ui") { "//brave/components/tor/buildflags", "//brave/components/url_sanitizer/browser", "//brave/components/vector_icons", + "//brave/components/webui", "//chrome/app:command_ids", "//chrome/app/vector_icons:vector_icons", "//chrome/browser:browser_process", diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index 4d995694f4d8..f861d4abff6a 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -5,14 +5,15 @@ #include "brave/browser/ui/webui/brave_webui_source.h" -#include -#include +#include #include +#include "base/containers/flat_map.h" #include "base/strings/utf_string_conversions.h" #include "brave/components/constants/url_constants.h" #include "brave/components/ipfs/buildflags/buildflags.h" #include "brave/components/tor/buildflags/buildflags.h" +#include "brave/components/webui/webui_resources.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "components/grit/brave_components_resources.h" @@ -22,6 +23,7 @@ #include "services/network/public/mojom/content_security_policy.mojom.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/webui/resource_path.h" +#include "ui/base/webui/web_ui_util.h" #if !BUILDFLAG(IS_ANDROID) #include "brave/browser/ui/webui/navigation_bar_data_provider.h" @@ -38,25 +40,6 @@ namespace { -struct WebUISimpleItem { - const char* name; - int id; -}; - -void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, - const std::vector& simple_items) { - for (auto simple_item : simple_items) { - html_source->AddLocalizedString(simple_item.name, simple_item.id); - } -} - -void AddResourcePaths(content::WebUIDataSource* html_source, - const std::vector& simple_items) { - for (auto simple_item : simple_items) { - html_source->AddResourcePath(simple_item.name, simple_item.id); - } -} - void CustomizeWebUIHTMLSource(content::WebUI* web_ui, const std::string& name, content::WebUIDataSource* source) { @@ -66,792 +49,9 @@ void CustomizeWebUIHTMLSource(content::WebUI* web_ui, } #endif - // clang-format off - static std::map > resources = { -#if !BUILDFLAG(IS_ANDROID) - { - std::string("newtab"), { - { "img/toolbar/menu_btn.svg", IDR_BRAVE_COMMON_TOOLBAR_IMG }, - // Hash path is the MD5 of the file contents, - // webpack image loader does this - { "fd85070af5114d6ac462c466e78448e4.svg", IDR_BRAVE_NEW_TAB_IMG1 }, - { "314e7529efec41c8867019815f4d8dad.svg", IDR_BRAVE_NEW_TAB_IMG4 }, - { "6c337c63662ee0ba4e57f6f8156d69ce.svg", IDR_BRAVE_NEW_TAB_IMG2 }, - // New tab Backgrounds - { "dylan-malval_sea-min.webp", IDR_BRAVE_NEW_TAB_BACKGROUND1 }, - // private tab - { "c168145d6bf1abf2c0322636366f7dbe.svg", IDR_BRAVE_PRIVATE_TAB_TOR_IMG }, // NOLINT - { "dbdc336ccc651b8a7c925b3482d6e65a.svg", IDR_BRAVE_PRIVATE_TAB_IMG } - } - }, { - std::string("rewards"), { - { "favicon.ico", IDR_BRAVE_REWARDS_FAVICON }, - } - }, { - std::string("welcome"), { - { "favicon.ico", IDR_BRAVE_WELCOME_PAGE_FAVICON } - } - }, -#endif - { - std::string("adblock"), {} - } - }; - AddResourcePaths(source, resources[name]); - - // clang-format off - static std::map > - localized_strings = { - { - std::string("newtab"), { - { "adsTrackersBlocked", IDS_BRAVE_NEW_TAB_TOTAL_ADS_TRACKERS_BLOCKED }, - { "httpsUpgraded", IDS_BRAVE_NEW_TAB_TOTAL_HTTPS_UPGRADES }, - { "estimatedTimeSaved", IDS_BRAVE_NEW_TAB_TOTAL_TIME_SAVED }, - { "estimatedBandwidthSaved", - IDS_BRAVE_NEW_TAB_ESTIMATED_BANDWIDTH_SAVED }, - { "thumbRemoved", IDS_BRAVE_NEW_TAB_THUMB_REMOVED }, - { "undoRemoved", IDS_BRAVE_NEW_TAB_UNDO_REMOVED }, - { "close", IDS_BRAVE_NEW_TAB_CLOSE }, - { "restoreAll", IDS_BRAVE_NEW_TAB_RESTORE_ALL }, - { "second", IDS_BRAVE_NEW_TAB_SECOND }, - { "seconds", IDS_BRAVE_NEW_TAB_SECONDS }, - { "minute", IDS_BRAVE_NEW_TAB_MINUTE }, - { "minutes", IDS_BRAVE_NEW_TAB_MINUTES }, - { "hour", IDS_BRAVE_NEW_TAB_HOUR }, - { "hours", IDS_BRAVE_NEW_TAB_HOURS }, - { "day", IDS_BRAVE_NEW_TAB_DAY }, - { "days", IDS_BRAVE_NEW_TAB_DAYS }, - { "B", IDS_BRAVE_NEW_TAB_BYTES }, - { "KB", IDS_BRAVE_NEW_TAB_KILOBYTES }, - { "MB", IDS_BRAVE_NEW_TAB_MEGABYTES }, - { "GB", IDS_BRAVE_NEW_TAB_GIGABYTES }, - { "photoBy", IDS_BRAVE_NEW_TAB_PHOTO_BY }, - { "hide", IDS_BRAVE_NEW_TAB_HIDE }, - { "preferencesPageTitle", IDS_BRAVE_NEW_TAB_PREFERENCES_PAGE_TITLE }, - { "bookmarksPageTitle", IDS_BRAVE_NEW_TAB_BOOKMARKS_PAGE_TITLE }, - { "historyPageTitle", IDS_BRAVE_NEW_TAB_HISTORY_PAGE_TITLE }, - { "dashboardSettingsTitle", - IDS_BRAVE_NEW_TAB_DASHBOARD_SETTINGS_TITLE }, - { "customize", IDS_BRAVE_NEW_TAB_CUSTOMIZE }, - { "showBackgroundImage", IDS_BRAVE_NEW_TAB_SHOW_BACKGROUND_IMAGE }, - { "braveBackgroundImageOptionTitle", IDS_BRAVE_NEW_TAB_BRAVE_BACKGROUND_IMAGE_OPTION_TITLE }, // NOLINT - { "customBackgroundImageOptionTitle", IDS_BRAVE_NEW_TAB_CUSTOM_BACKGROUND_IMAGE_OPTION_TITLE }, // NOLINT - { "customBackgroundImageOptionUploadLabel", IDS_BRAVE_NEW_TAB_CUSTOM_BACKGROUND_IMAGE_OPTION_UPLOAD_LABEL }, // NOLINT - { "showBraveStats", IDS_BRAVE_NEW_TAB_SHOW_BRAVE_STATS }, - { "showClock", IDS_BRAVE_NEW_TAB_SHOW_CLOCK }, - { "clockFormat", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT }, - { "clockFormatDefault", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_DEFAULT }, - { "clockFormat12", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_12 }, - { "clockFormat24", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_24 }, - { "addTopSiteDialogTitle", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_TITLE }, // NOLINT - { "editTopSiteDialogTitle", IDS_BRAVE_NEW_TAB_EDIT_TOP_SITE_DIALOG_TITLE }, // NOLINT - { "editSiteTileMenuItem", IDS_BRAVE_NEW_TAB_EDIT_SITE_TILE_MENU_ITEM }, - { "removeTileMenuItem", IDS_BRAVE_NEW_TAB_REMOVE_TILE_MENU_ITEM }, - { "addTopSiteDialogURLLabel", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_URL_LABEL }, // NOLINT - { "addTopSiteDialogURLInputPlaceHolder", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_URL_INPUT_PLACEHOLDER }, // NOLINT - { "addTopSiteDialogNameLabel", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_NAME_LABEL }, // NOLINT - { "addTopSiteDialogNameInputPlaceHolder", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_NAME_INPUT_PLACEHOLDER }, // NOLINT - { "addTopSiteDialogSaveButtonLabel", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_SAVE_BUTTON_LABEL }, // NOLINT - { "addTopSiteDialogCancelButtonLabel", IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_CANCEL_BUTTON_LABEL }, // NOLINT - { "showTopSites", IDS_BRAVE_NEW_TAB_SHOW_TOP_SITES }, - { "showFavoritesLabel", IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_LABEL }, - { "showFavoritesDesc", IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_DESC }, - { "showFrecencyLabel", IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_LABEL }, - { "showFrecencyDesc", IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_DESC }, - { "addSiteMenuLabel", IDS_BRAVE_NEW_TAB_ADD_SITE_MENU_LABEL }, - { "showFrecencyMenuLabel", IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_MENU_LABEL }, - { "showFavoritesMenuLabel", IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_MENU_LABEL }, // NOLINT - { "showRewards", IDS_BRAVE_NEW_TAB_SHOW_REWARDS }, - { "cards", IDS_BRAVE_NEW_TAB_SHOW_CARDS }, - { "brandedWallpaperOptIn", IDS_BRAVE_NEW_TAB_BRANDED_WALLPAPER_OPT_IN }, - { "sponsoredImageEarningTitle", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_EARNING_TITLE}, - { "sponsoredImageEnableRewards", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ENABLE_REWARDS}, - { "sponsoredImageNotEarningTitle", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_NOT_EARNING_TITLE}, - { "sponsoredImageOffRewardsOnDescription", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_OFF_REWARDS_ON_DESCRPTION}, // NOLINT - { "sponsoredImageOnDescription", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ON_DESCRIPTION}, // NOLINT - { "sponsoredImageOnRewardsOnNoCustodianDescription", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ON_REWARDS_ON_NO_CUSTODIAN_DESCRIPTION}, // NOLINT - { "sponsoredImageRewardsOffDescription", IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_REWARDS_OFF_DESCRIPTION}, // NOLINT - { "topSitesTitle", IDS_BRAVE_NEW_TAB_TOP_SITES }, - { "statsTitle", IDS_BRAVE_NEW_TAB_STATS }, - { "clockTitle", IDS_BRAVE_NEW_TAB_CLOCK }, - { "backgroundImageTitle", IDS_BRAVE_NEW_TAB_BACKGROUND_IMAGE }, - { "settingsNavigateBack", IDS_BRAVE_NEW_TAB_SETTINGS_BACK }, - { "braveBackgroundsTitle", IDS_BRAVE_NEW_TAB_BRAVE_BACKGROUND}, - { "solidColorTitle", IDS_BRAVE_NEW_TAB_SOLID_COLOR}, - { "gradientColorTitle", IDS_BRAVE_NEW_TAB_GRADIENT_COLOR}, - { "refreshBackgroundOnNewTab", IDS_BRAVE_NEW_TAB_REFRESH_BACKGROUND_ON_NEW_TAB}, // NOLINT - { "rewardsOpenPanel", IDS_BRAVE_NEW_TAB_REWARDS_OPEN_PANEL }, - - // search promotion - { "searchPromotionNTPPopupTitle1", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_TITLE_1}, // NOLINT - { "searchPromotionNTPPopupTitle2", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_TITLE_2}, // NOLINT - { "searchPromotionNTPPopupDesc", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_DESC}, // NOLINT - { "searchPromotionNTPPopupBottom", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_BOTTOM}, // NOLINT - { "searchPromotionSearchBoxPlaceholderLabel", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_SEARCH_BOX_PLACEHOLDER}, // NOLINT - - { "braveNewsTitle", IDS_BRAVE_NEWS_TITLE }, - { "braveNewsStatusFetching", IDS_BRAVE_NEWS_STATUS_FETCHING}, - { "braveNewsActionRefresh", IDS_BRAVE_NEWS_ACTION_REFRESH}, - { "braveNewsScrollHint", IDS_BRAVE_NEWS_SCROLL_HINT}, - { "braveNewsResetAction", IDS_BRAVE_NEWS_RESET_ACTION}, - { "braveNewsResetConfirm", IDS_BRAVE_NEWS_RESET_CONFIRM}, - { "braveNewsCategoryNameAll", IDS_BRAVE_NEWS_CATEGORY_NAME_ALL}, - { "braveNewsSourcesTitle", IDS_BRAVE_NEWS_SOURCES_TITLE}, - { "braveNewsDisableSourceCommand", - IDS_BRAVE_NEWS_DISABLE_SOURCE_COMMAND}, - { "promoted", IDS_BRAVE_NEWS_PROMOTED }, - { "ad", IDS_BRAVE_NEWS_DISPLAY_AD_LABEL }, - - { "braveNewsIntroTitle", IDS_BRAVE_NEWS_INTRO_TITLE }, - { "braveNewsIntroDescription", IDS_BRAVE_NEWS_INTRO_DESCRIPTION }, - { "braveNewsIntroDescriptionTwo", IDS_BRAVE_NEWS_INTRO_DESCRIPTION_TWO }, // NOLINT - { "braveNewsOptInActionLabel", IDS_BRAVE_NEWS_OPT_IN_ACTION_LABEL }, - { "braveNewsOptOutActionLabel", IDS_BRAVE_NEWS_OPT_OUT_ACTION_LABEL }, - { "braveNewsBackToDashboard", IDS_BRAVE_NEWS_BACK_TO_DASHBOARD }, - { "braveNewsBackButton", IDS_BRAVE_NEWS_BACK_BUTTON }, - { "braveNewsSearchPlaceholderLabel", IDS_BRAVE_NEWS_SEARCH_PLACEHOLDER_LABEL}, // NOLINT - { "braveNewsChannelsHeader", IDS_BRAVE_NEWS_BROWSE_CHANNELS_HEADER}, // NOLINT - { "braveNewsViewAllButton", IDS_BRAVE_NEWS_VIEW_ALL_BUTTON}, - { "braveNewsAllSourcesHeader", IDS_BRAVE_NEWS_ALL_SOURCES_HEADER}, - { "braveNewsFeedsHeading", IDS_BRAVE_NEWS_FEEDS_HEADING}, - { "braveNewsFollowButtonFollowing", IDS_BRAVE_NEWS_FOLLOW_BUTTON_FOLLOWING}, // NOLINT - { "braveNewsFollowButtonNotFollowing", IDS_BRAVE_NEWS_FOLLOW_BUTTON_NOT_FOLLOWING}, // NOLINT - { "braveNewsDirectSearchButton", IDS_BRAVE_NEWS_DIRECT_SEARCH_BUTTON}, // NOLINT - { "braveNewsDirectSearchNoResults", IDS_BRAVE_NEWS_DIRECT_SEARCH_NO_RESULTS}, // NOLINT - { "braveNewsSearchResultsNoResults", IDS_BRAVE_NEWS_SEARCH_RESULTS_NO_RESULTS}, // NOLINT - { "braveNewsSearchResultsLocalResults", IDS_BRAVE_NEWS_SEARCH_RESULTS_LOCAL_RESULTS}, // NOLINT - { "braveNewsSearchResultsDirectResults", IDS_BRAVE_NEWS_SEARCH_RESULTS_DIRECT_RESULTS}, // NOLINT - { "braveNewsSearchQueryTooShort", IDS_BRAVE_NEWS_SEARCH_QUERY_TOO_SHORT}, // NOLINT - { "braveNewsSuggestionsTitle", IDS_BRAVE_NEWS_SUGGESTIONS_TITLE}, - { "braveNewsSuggestionsSubtitle", IDS_BRAVE_NEWS_SUGGESTIONS_SUBTITLE}, - { "braveNewsErrorHeading", IDS_BRAVE_NEWS_ERROR_HEADING}, - { "braveNewsErrorMessage", IDS_BRAVE_NEWS_ERROR_MESSAGE}, - { "braveNewsErrorActionLabel", IDS_BRAVE_NEWS_ERROR_ACTION_LABEL}, - { "braveNewsNoContentHeading", IDS_BRAVE_NEWS_NO_CONTENT_HEADING}, - { "braveNewsNoContentMessage", IDS_BRAVE_NEWS_NO_CONTENT_MESSAGE}, - { "braveNewsNoContentActionLabel", IDS_BRAVE_NEWS_NO_CONTENT_ACTION_LABEL}, // NOLINT - { "braveNewsPopularTitle", IDS_BRAVE_NEWS_POPULAR_TITLE}, - { "braveNewsNewsPeek", IDS_BRAVE_NEWS_NEWS_PEEK}, - { "braveNewsMyFeedHeading", IDS_BRAVE_NEWS_MY_FEED_HEADING}, - { "braveNewsForYouFeed",IDS_BRAVE_NEWS_FOR_YOU_FEED}, - { "braveNewsFollowingFeed", IDS_BRAVE_NEWS_FOLLOWING_FEED}, - { "braveNewsAddChannelsOrPublishers",IDS_BRAVE_NEWS_ADD_CHANNELS_OR_PUBLISHERS}, - { "braveNewsPublishersHeading", IDS_BRAVE_NEWS_PUBLISHERS_HEADING}, - { "braveNewsShowAll", IDS_BRAVE_NEWS_SHOW_ALL}, - { "braveNewsShowLess", IDS_BRAVE_NEWS_SHOW_LESS}, - { "braveNewsAdvertBadge", IDS_BRAVE_NEWS_ADVERT_BADGE}, - { "braveNewsHideContentFrom", IDS_BRAVE_NEWS_HIDE_CONTENT_FROM}, - { "braveNewsSourcesRecommendation", IDS_BRAVE_NEWS_SOURCES_RECOMMENDATION}, - { "braveNewsNoArticles", IDS_BRAVE_NEWS_NO_ARTICLES}, - { "braveNewsCustomizeFeed", IDS_BRAVE_NEWS_CUSTOMIZE_FEED}, - - // Brave News Channels - { "braveNewsChannel-Brave", IDS_BRAVE_NEWS_CHANNEL_BRAVE}, - { "braveNewsChannel-Business", IDS_BRAVE_NEWS_CHANNEL_BUSINESS}, - { "braveNewsChannel-Cars", IDS_BRAVE_NEWS_CHANNEL_CARS}, - { "braveNewsChannel-Crypto", IDS_BRAVE_NEWS_CHANNEL_CRYPTO}, - { "braveNewsChannel-Culture", IDS_BRAVE_NEWS_CHANNEL_CULTURE}, - { "braveNewsChannel-Entertainment", IDS_BRAVE_NEWS_CHANNEL_ENTERTAINMENT}, // NOLINT - { "braveNewsChannel-Entertainment News", IDS_BRAVE_NEWS_CHANNEL_ENTERTAINMENT_NEWS}, // NOLINT - { "braveNewsChannel-Fashion", IDS_BRAVE_NEWS_CHANNEL_FASHION}, - { "braveNewsChannel-Film and TV", IDS_BRAVE_NEWS_CHANNEL_FILM_AND_TV}, - { "braveNewsChannel-Food", IDS_BRAVE_NEWS_CHANNEL_FOOD}, - { "braveNewsChannel-Fun", IDS_BRAVE_NEWS_CHANNEL_FUN}, - { "braveNewsChannel-Gaming", IDS_BRAVE_NEWS_CHANNEL_GAMING}, - { "braveNewsChannel-Health", IDS_BRAVE_NEWS_CHANNEL_HEALTH}, - { "braveNewsChannel-Home", IDS_BRAVE_NEWS_CHANNEL_HOME}, - { "braveNewsChannel-Music", IDS_BRAVE_NEWS_CHANNEL_MUSIC}, - { "braveNewsChannel-Politics", IDS_BRAVE_NEWS_CHANNEL_POLITICS}, - { "braveNewsChannel-Regional News", IDS_BRAVE_NEWS_CHANNEL_REGIONAL_NEWS}, - { "braveNewsChannel-Science", IDS_BRAVE_NEWS_CHANNEL_SCIENCE}, - { "braveNewsChannel-Sports", IDS_BRAVE_NEWS_CHANNEL_SPORTS}, - { "braveNewsChannel-Travel", IDS_BRAVE_NEWS_CHANNEL_TRAVEL}, - { "braveNewsChannel-Technology", IDS_BRAVE_NEWS_CHANNEL_TECHNOLOGY}, - { "braveNewsChannel-Tech News", IDS_BRAVE_NEWS_CHANNEL_TECH_NEWS}, - { "braveNewsChannel-Tech Reviews", IDS_BRAVE_NEWS_CHANNEL_TECH_REVIEWS}, - { "braveNewsChannel-Top News", IDS_BRAVE_NEWS_CHANNEL_TOP_NEWS}, - { "braveNewsChannel-Top Sources", IDS_BRAVE_NEWS_CHANNEL_TOP_SOURCES}, - { "braveNewsChannel-US News", IDS_BRAVE_NEWS_CHANNEL_US_NEWS}, - { "braveNewsChannel-Weather", IDS_BRAVE_NEWS_CHANNEL_WEATHER}, - { "braveNewsChannel-World News", IDS_BRAVE_NEWS_CHANNEL_WORLD_NEWS}, - - { "addWidget", IDS_BRAVE_NEW_TAB_WIDGET_ADD }, - { "hideWidget", IDS_BRAVE_NEW_TAB_WIDGET_HIDE }, - { "rewardsWidgetDesc", IDS_BRAVE_NEW_TAB_REWARDS_WIDGET_DESC }, - { "cardsToggleTitle", IDS_BRAVE_NEW_TAB_CARDS_TITLE }, - { "cardsToggleDesc", IDS_BRAVE_NEW_TAB_CARDS_DESC }, - { "editCardsTitle", IDS_EDIT_CARDS_TITLE }, - { "braveRewardsTitle", IDS_BRAVE_NEW_TAB_BRAVE_REWARDS_TITLE }, -#if !BUILDFLAG(IS_ANDROID) - // Private Tab - General - { "learnMore", IDS_BRAVE_PRIVATE_NEW_TAB_LEARN_MORE }, - { "done", IDS_BRAVE_PRIVATE_NEW_TAB_DONE }, - { "headerLabel", IDS_BRAVE_PRIVATE_NEW_TAB_THIS_IS_A }, - - // Private Tab - Header Private Window - { "headerTitle", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW }, - { "headerText", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC }, - { "headerText1", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC1 }, - { "headerText2", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC2 }, - { "headerButton", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_BUTTON }, - - // Private Tab - Header Private Window with Tor - { "headerTorTitle", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_TOR }, - { "headerTorText", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_TOR_DESC }, - - // Private Tab - Box for DDG - { "boxDdgButton", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_DDG_BUTTON }, - - // Private Tab - Box for Tor - { "boxTorLabel", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_LABEL }, - { "boxTorLabel2", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_LABEL_2 }, - { "boxTorTitle", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TITLE }, - - // Private Tab - Private Window with Tor - Tor Box - { "boxTorText", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TEXT_1 }, - - // Private Tab - Private Window - Tor Box - { "boxTorText2", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TEXT_2 }, - { "boxTorButton", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_BUTTON }, -#endif // !BUILDFLAG(IS_ANDROID) - - // Brave Talk shortcut - { "braveTalkPromptTitle", IDS_BRAVE_TALK_PROMPT_TITLE }, - - // Rewards widget - { "rewardsAboutRewards", IDS_REWARDS_WIDGET_ABOUT_REWARDS }, - { "rewardsAdGrantAmount", IDS_REWARDS_WIDGET_AD_GRANT_AMOUNT }, - { "rewardsAdGrantTitle", IDS_REWARDS_WIDGET_AD_GRANT_TITLE }, - { "rewardsBraveRewards", IDS_REWARDS_WIDGET_BRAVE_REWARDS }, - { "rewardsClaimRewards", IDS_REWARDS_WIDGET_CLAIM_REWARDS }, - { "rewardsClaimTokens", IDS_REWARDS_WIDGET_CLAIM_TOKENS }, - { "rewardsConnectAccount", IDS_REWARDS_CONNECT_ACCOUNT }, - { "rewardsConnectAccountNoProviders", IDS_REWARDS_CONNECT_ACCOUNT_NO_PROVIDERS }, // NOLINT - { "rewardsConnectAccountText", IDS_REWARDS_CONNECT_ACCOUNT_TEXT }, - { "rewardsContinue", IDS_REWARDS_WIDGET_CONTINUE}, - { "rewardsEarningsTitle", IDS_REWARDS_ESTIMATED_EARNINGS_TITLE }, - { "rewardsEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT }, - { "rewardsHowDoesItWork", IDS_REWARDS_WIDGET_HOW_DOES_IT_WORK}, - { "rewardsGrantDaysRemaining", IDS_REWARDS_WIDGET_GRANT_DAYS_REMAINING }, // NOLINT - { "rewardsLearnMore", IDS_REWARDS_LEARN_MORE }, - { "rewardsManageAds", IDS_REWARDS_WALLET_MANAGE_ADS }, - { "rewardsOptInHeader", IDS_REWARDS_WIDGET_OPT_IN_HEADER }, - { "rewardsOptInTerms", IDS_BRAVE_REWARDS_ONBOARDING_TERMS }, - { "rewardsOptInText", IDS_REWARDS_WIDGET_OPT_IN_TEXT }, - { "rewardsLogInToSeeBalance", IDS_REWARDS_LOG_IN_TO_SEE_BALANCE }, - { "rewardsPaymentCheckStatus", IDS_REWARDS_PAYMENT_CHECK_STATUS }, - { "rewardsPaymentCompleted", IDS_REWARDS_PAYMENT_COMPLETED }, - { "rewardsPaymentPending", IDS_REWARDS_PAYMENT_PENDING }, - { "rewardsPaymentProcessing", IDS_REWARDS_PAYMENT_PROCESSING }, - { "rewardsPaymentSupport", IDS_REWARDS_PAYMENT_SUPPORT }, - { "rewardsSelectCountryHeader", IDS_REWARDS_WIDGET_SELECT_COUNTRY_HEADER}, // NOLINT - { "rewardsSelectCountryText", IDS_REWARDS_WIDGET_SELECT_COUNTRY_TEXT}, - { "rewardsSettings", IDS_REWARDS_WIDGET_SETTINGS }, - { "rewardsStartUsingRewards", IDS_REWARDS_WIDGET_START_USING_REWARDS }, - { "rewardsBalanceTitle", IDS_REWARDS_WIDGET_BALANCE_TITLE }, - { "rewardsTokenGrantTitle", IDS_REWARDS_WIDGET_TOKEN_GRANT_TITLE }, - { "rewardsWidgetBraveRewards", IDS_BRAVE_UI_BRAVE_REWARDS }, - { "rewardsBrowserCannotReceiveAds", IDS_REWARDS_BROWSER_CANNOT_RECEIVE_ADS }, // NOLINT - { "rewardsBrowserNeedsUpdateToSeeAds", IDS_REWARDS_BROWSER_NEEDS_UPDATE_TO_SEE_ADS }, // NOLINT - { "rewardsUnsupportedRegionNoticeHeader", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_HEADER}, // NOLINT - { "rewardsUnsupportedRegionNoticeSubheader", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_SUBHEADER}, // NOLINT - { "rewardsUnsupportedRegionNoticeLearnMore", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_LEARN_MORE}, // NOLINT - { "rewardsUnsupportedRegionNoticeText1", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_1}, // NOLINT - { "rewardsUnsupportedRegionNoticeText2", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_2}, // NOLINT - {"rewardsVBATNoticeText1", IDS_REWARDS_VBAT_NOTICE_TEXT1}, - {"rewardsVBATNoticeText2", IDS_REWARDS_VBAT_NOTICE_TEXT2}, - {"rewardsVBATNoticeTitle1", IDS_REWARDS_VBAT_NOTICE_TITLE1}, - {"rewardsVBATNoticeTitle2", IDS_REWARDS_VBAT_NOTICE_TITLE2}, - - { "loading", IDS_BRAVE_REWARDS_LOADING_LABEL }, - - // Brave Talk Widget - { "braveTalkWidgetTitle", IDS_BRAVE_TALK_WIDGET_TITLE }, - { "braveTalkWidgetWelcomeTitle", IDS_BRAVE_TALK_WIDGET_WELCOME_TITLE }, - { "braveTalkWidgetStartButton", IDS_BRAVE_TALK_WIDGET_START_BUTTON }, - { "braveTalkWidgetAboutData", IDS_BRAVE_TALK_WIDGET_ABOUT_DATA }, - } - }, { - std::string("wallet"), { - { "cryptoWalletsWelcome", IDS_BRAVE_WALLET_WELCOME }, - { "cryptoWalletsDisclosureOne", IDS_BRAVE_WALLET_DISCLOSURE_ONE }, - { "cryptoWalletsDisclosureTwo", IDS_BRAVE_WALLET_DISCLOSURE_TWO }, - { "cryptoWalletsDisclosureThree", IDS_BRAVE_WALLET_DISCLOSURE_THREE }, - { "cryptoWalletsDisclosureFour", IDS_BRAVE_WALLET_DISCLOSURE_FOUR }, - { "cryptoWalletsBraveRewards", IDS_BRAVE_WALLET_BRAVE_REWARDS }, - { "cryptoWalletsDownloading", IDS_BRAVE_WALLET_DOWNLOADING }, - { "cryptoWalletsDisclosureConfirm", IDS_BRAVE_WALLET_DISCLOSURE_CONFIRM } // NOLINT - } - }, { - std::string("rewards"), { - { "adsCurrentEarnings", IDS_BRAVE_REWARDS_LOCAL_ADS_CURRENT_EARNINGS }, - { "adsDescription", IDS_BRAVE_REWARDS_LOCAL_ADS_DESCRIPTION }, - { "adsDescriptionEarn", IDS_BRAVE_REWARDS_LOCAL_ADS_DESCRIPTION_EARN }, - { "adsTotalReceivedLabel", IDS_BRAVE_REWARDS_LOCAL_ADS_TOTAL_RECEIVED }, // NOLINT - { "adsNotSupportedRegion", IDS_BRAVE_REWARDS_LOCAL_ADS_NOT_SUPPORTED_REGION }, // NOLINT - { "adsNotSupportedDevice", IDS_BRAVE_REWARDS_LOCAL_ADS_NOT_SUPPORTED_DEVICE }, // NOLINT - { "adsPaymentDate", IDS_BRAVE_REWARDS_LOCAL_ADS_PAYMENT_DATE }, - { "adsPerHour", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR }, - { "adsPerHour0", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_0 }, - { "adsPerHour1", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_1 }, - { "adsPerHour2", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_2 }, - { "adsPerHour3", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_3 }, - { "adsPerHour4", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_4 }, - { "adsPerHour5", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_5 }, - { "adsPerHour10", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_10 }, - { "adsSubdivisionTargetingTitle", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_TITLE }, // NOLINT - { "adsSubdivisionTargetingDescription", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DESCRIPTION }, // NOLINT - { "adsSubdivisionTargetingLearn", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_LEARN }, // NOLINT - { "adsSubdivisionTargetingAutoDetectedAs", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_AUTO_DETECTED_AS }, // NOLINT - { "adsSubdivisionTargetingAutoDetect", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_AUTO_DETECT }, // NOLINT - { "adsSubdivisionTargetingDisable", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DISABLE }, // NOLINT - { "adsSubdivisionTargetingDisabled", IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DISABLED }, // NOLINT - { "adsTitle", IDS_BRAVE_REWARDS_LOCAL_ADS_TITLE }, - { "newTabAdCountLabel", IDS_BRAVE_REWARDS_NEW_TAB_AD_COUNT_LABEL}, - { "notificationAdCountLabel", IDS_BRAVE_REWARDS_NOTIFICATION_AD_COUNT_LABEL}, // NOLINT - { "newsAdCountLabel", IDS_BRAVE_REWARDS_NEWS_AD_COUNT_LABEL}, - { "newsAdInfo", IDS_BRAVE_REWARDS_NEWS_AD_INFO }, - { "newsAdInfoDisabled", IDS_BRAVE_REWARDS_NEWS_AD_INFO_DISABLED }, - { "appErrorTitle", IDS_REWARDS_APP_ERROR_TITLE }, - - { "bat", IDS_BRAVE_UI_BAT_REWARDS_TEXT }, - { "contributionTitle", IDS_BRAVE_REWARDS_LOCAL_CONTR_TITLE }, - { "contributionDesc", IDS_BRAVE_REWARDS_LOCAL_CONTR_DESC }, - { "contributionMonthly", IDS_BRAVE_REWARDS_LOCAL_CONTR_MONTHLY }, - { "contributionNextDate", IDS_BRAVE_REWARDS_LOCAL_CONTR_NEXT_DATE }, - { "contributionSites", IDS_BRAVE_REWARDS_LOCAL_CONTR_SITES }, - { "contributionVisitSome", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_SOME }, - { "contributionMinTime", IDS_BRAVE_REWARDS_LOCAL_CONTR_MIN_TIME }, - { "contributionMinVisits", IDS_BRAVE_REWARDS_LOCAL_CONTR_MIN_VISITS }, - { "contributionOther", IDS_BRAVE_REWARDS_LOCAL_CONTR_OTHER }, - { "contributionVisit1", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_1 }, - { "contributionVisit5", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_5 }, - { "contributionVisit10", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_10 }, - { "contributionTime5", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_5 }, - { "contributionTime8", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_8 }, - { "contributionTime60", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_60 }, - { "contributionUpTo", IDS_BRAVE_REWARDS_LOCAL_CONTR_UP_TO }, - - { "disconnectWalletFailed", IDS_BRAVE_REWARDS_LOCAL_SERVER_DISCONNECT_FAILED }, // NOLINT - { "donationTitle", IDS_BRAVE_REWARDS_LOCAL_DONAT_TITLE }, - { "donationDesc", IDS_BRAVE_REWARDS_LOCAL_DONAT_DESC }, - { "donationDescLearnMore", IDS_BRAVE_REWARDS_LOCAL_DONAT_DESC_LEARN_MORE }, // NOLINT - { "donationTotalDonations", IDS_BRAVE_REWARDS_LOCAL_DONAT_TOTAL_DONATIONS }, // NOLINT - { "donationVisitSome", IDS_BRAVE_REWARDS_LOCAL_DONAT_VISIT_SOME }, - { "monthlyTipsTitle", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_TITLE }, - { "monthlyTipsDesc", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_DESC }, - { "monthlyTipsEmpty", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_EMPTY }, - { "nextContribution", IDS_BRAVE_REWARDS_LOCAL_NEXT_CONTRIBUTION }, - { "redirectModalError", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_ERROR }, - { "redirectModalClose", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_CLOSE }, - { "redirectModalDeviceLimitReachedText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_DEVICE_LIMIT_REACHED_TEXT}, // NOLINT - { "redirectModalDeviceLimitReachedTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_DEVICE_LIMIT_REACHED_TITLE}, // NOLINT - { "redirectModalFlaggedWalletText1", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_1}, // NOLINT - { "redirectModalFlaggedWalletText2", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_2}, // NOLINT - { "redirectModalFlaggedWalletText3", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_3}, // NOLINT - { "redirectModalFlaggedWalletText4", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_4}, // NOLINT - { "redirectModalFlaggedWalletTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TITLE}, // NOLINT - { "redirectModalKYCRequiredTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_KYC_REQUIRED_TITLE }, // NOLINT - { "redirectModalKYCRequiredText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_KYC_REQUIRED_TEXT }, // NOLINT - { "redirectModalMismatchedCountriesText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_COUNTRIES_TEXT}, // NOLINT - { "redirectModalMismatchedCountriesTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_COUNTRIES_TITLE}, // NOLINT - { "redirectModalMismatchedProviderAccountsText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_PROVIDER_ACCOUNTS_TEXT}, // NOLINT - { "redirectModalMismatchedProviderAccountsTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_PROVIDER_ACCOUNTS_TITLE}, // NOLINT - { "redirectModalProviderUnavailableText1", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TEXT_1}, // NOLINT - { "redirectModalProviderUnavailableText2", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TEXT_2}, // NOLINT - { "redirectModalProviderUnavailableTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TITLE}, // NOLINT - { "redirectModalRegionNotSupportedText1", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TEXT_1}, // NOLINT - { "redirectModalRegionNotSupportedText2", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TEXT_2}, // NOLINT - { "redirectModalRegionNotSupportedTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TITLE}, // NOLINT - { "redirectModalUpholdBATNotAllowedText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_BAT_NOT_ALLOWED_TEXT}, // NOLINT - { "redirectModalUpholdBATNotAllowedTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_BAT_NOT_ALLOWED_TITLE}, // NOLINT - { "redirectModalUpholdInsufficientCapabilitiesText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_INSUFFICIENT_CAPABILITIES_TEXT}, // NOLINT - { "redirectModalUpholdInsufficientCapabilitiesTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_INSUFFICIENT_CAPABILITIES_TITLE}, // NOLINT - { "redirectModalWalletOwnershipVerificationFailureText", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_WALLET_OWNERSHIP_VERIFICATION_FAILURE_TEXT}, // NOLINT - { "redirectModalWalletOwnershipVerificationFailureTitle", IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_WALLET_OWNERSHIP_VERIFICATION_FAILURE_TITLE}, // NOLINT - { "tosAndPp", IDS_BRAVE_REWARDS_LOCAL_TOS_AND_PP}, // NOLINT - - { "click", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_CLICK }, - { "dismiss", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_DISMISS }, - { "landed", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_LANDED }, - { "view", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_VIEW }, - - { "rewardsBrowserCannotReceiveAds", IDS_REWARDS_BROWSER_CANNOT_RECEIVE_ADS }, // NOLINT - { "rewardsBrowserNeedsUpdateToSeeAds", IDS_REWARDS_BROWSER_NEEDS_UPDATE_TO_SEE_ADS }, // NOLINT - - { "activityCopy", IDS_BRAVE_UI_ACTIVITY_COPY }, - { "activityNote", IDS_BRAVE_UI_ACTIVITY_NOTE }, - { "ads", IDS_BRAVE_UI_ADS}, - { "adsCurrentlyViewing", IDS_BRAVE_UI_ADS_CURRENTLY_VIEWING }, - { "adsHistoryNone", IDS_BRAVE_UI_ADS_HISTORY_NONE }, - { "adsHistorySubTitle", IDS_BRAVE_UI_ADS_HISTORY_SUBTITLE }, - { "adsHistoryTitle", IDS_BRAVE_UI_ADS_HISTORY_TITLE }, - { "adsGrantReceived", IDS_BRAVE_UI_ADS_GRANT_RECEIVED }, - { "all", IDS_BRAVE_UI_ADS_ALL }, - { "amount", IDS_BRAVE_UI_AMOUNT }, - { "autoContribute", IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TITLE }, - { "autoContributeTransaction", IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TRANSACTION }, // NOLINT - { "braveRewards", IDS_BRAVE_UI_BRAVE_REWARDS }, - { "cancel", IDS_BRAVE_UI_CANCEL }, - { "captchaDrag", IDS_BRAVE_UI_CAPTCHA_DRAG }, - { "captchaTarget", IDS_BRAVE_UI_CAPTCHA_TARGET }, - { "category", IDS_BRAVE_UI_ADS_CATEGORY }, - { "claim", IDS_BRAVE_UI_CLAIM }, - { "contribute", IDS_BRAVE_UI_CONTRIBUTE }, - { "date", IDS_BRAVE_UI_DATE }, - { "deposits", IDS_BRAVE_UI_DEPOSITS }, - { "description", IDS_BRAVE_UI_DESCRIPTION }, - { "donation", IDS_BRAVE_UI_DONATION }, - { "done", IDS_BRAVE_UI_DONE }, - { "earningsAds", IDS_BRAVE_UI_EARNINGS_ADS }, - { "earningsViewDepositHistory", IDS_BRAVE_UI_EARNINGS_VIEW_DEPOSIT_HISTORY }, // NOLINT - { "excludeSite", IDS_BRAVE_UI_EXCLUDE_SITE }, - { "excludedSitesText", IDS_BRAVE_UI_EXCLUDED_SITES }, - { "grantDisclaimer", IDS_BRAVE_UI_GRANT_DISCLAIMER }, - { "grantTitleUGP", IDS_BRAVE_UI_GRANT_TITLE_UGP }, - { "grantSubtitleUGP", IDS_BRAVE_UI_GRANT_SUBTITLE_UGP }, - { "grantAmountTitleUGP", IDS_BRAVE_UI_GRANT_AMOUNT_TITLE_UGP }, - { "grantDateTitleUGP", IDS_BRAVE_UI_GRANT_DATE_TITLE_UGP }, - { "grantTitleAds", IDS_BRAVE_UI_GRANT_TITLE_ADS }, - { "grantSubtitleAds", IDS_BRAVE_UI_GRANT_SUBTITLE_ADS }, - { "grantAmountTitleAds", IDS_BRAVE_UI_GRANT_AMOUNT_TITLE_ADS }, - { "grantDateTitleAds", IDS_BRAVE_UI_GRANT_DATE_TITLE_ADS }, - { "grantExpire", IDS_BRAVE_UI_GRANT_EXPIRE }, - { "import", IDS_BRAVE_UI_IMPORT }, - { "learnMore", IDS_BRAVE_UI_LEARN_MORE }, - { "markAsInappropriate", IDS_BRAVE_UI_ADS_MARK_AS_INAPPROPRIATE }, - { "markAsInappropriateChecked", IDS_BRAVE_UI_ADS_MARK_AS_INAPPROPRIATE_CHECKED }, // NOLINT - { "monthlyTipsBang", IDS_BRAVE_UI_MONTHLY_TIPS_BANG }, - { "monthlyTips", IDS_BRAVE_UI_MONTHLY_TIPS }, - { "noActivity", IDS_BRAVE_UI_NO_ACTIVITY }, - { "noAdsHistory", IDS_BRAVE_UI_ADS_NO_ADS_HISTORY }, - { "off", IDS_BRAVE_UI_OFF }, - { "ok", IDS_BRAVE_UI_OK }, - { "on", IDS_BRAVE_UI_ON }, - { "onboardingEarnHeader", IDS_BRAVE_REWARDS_ONBOARDING_EARN_HEADER }, - { "onboardingEarnText", IDS_BRAVE_REWARDS_ONBOARDING_EARN_TEXT }, - { "onboardingStartUsingRewards", IDS_BRAVE_REWARDS_ONBOARDING_START_USING_REWARDS }, // NOLINT - { "onboardingStartUsingRewardsTextOnly", IDS_BRAVE_REWARDS_ONBOARDING_START_USING_REWARDS_TEXT_ONLY }, // NOLINT - { "onboardingTerms", IDS_BRAVE_REWARDS_ONBOARDING_TERMS }, - { "oneTimeDonation", IDS_BRAVE_UI_ONE_TIME_DONATION }, - { "openAdsHistory", IDS_BRAVE_UI_OPEN_ADS_HISTORY }, - { "optOutTooltip", IDS_BRAVE_UI_ADS_OPT_OUT_TOOLTIP }, - { "payment", IDS_BRAVE_UI_PAYMENT }, - { "pinnedSitesHeader", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_HEADER }, - { "pinnedSitesMsg", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_MSG }, - { "pinnedSitesOne", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_ONE }, - { "pinnedSitesTwo", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_TWO }, - { "pinnedSitesThree", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_THREE }, - { "pinnedSitesFour", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_FOUR }, - { "pleaseNote", IDS_BRAVE_UI_PLEASE_NOTE }, - { "print", IDS_BRAVE_UI_PRINT }, - { "processingRequest", IDS_BRAVE_UI_PROCESSING_REQUEST }, - { "processingRequestButton", IDS_BRAVE_UI_PROCESSING_REQUEST_BUTTON }, - { "processorBraveTokens", IDS_BRAVE_UI_PROCESSOR_BRAVE_TOKENS }, - { "processorUphold", IDS_BRAVE_UI_PROCESSOR_UPHOLD }, - { "processorBitflyer", IDS_BRAVE_UI_PROCESSOR_BITFLYER }, - { "processorGemini", IDS_BRAVE_UI_PROCESSOR_GEMINI }, - { "recurring", IDS_BRAVE_UI_RECURRING }, - { "recurringDonations", IDS_BRAVE_UI_RECURRING_DONATIONS }, - { "relaunch", IDS_BRAVE_UI_RELAUNCH }, - { "remove", IDS_BRAVE_UI_REMOVE }, - { "removeAdFromSaved", IDS_BRAVE_UI_REMOVE_AD_FROM_SAVED }, - { "reset", IDS_BRAVE_UI_RESET }, - { "resetWallet", IDS_BRAVE_UI_RESET_WALLET }, - { "clearExcludeList", IDS_BRAVE_UI_CLEAR_EXCLUDE_LIST }, - { "reviewSitesMsg", IDS_BRAVE_UI_REVIEW_SITE_MSG }, - { "rewardsAdGrantAmount", IDS_REWARDS_WIDGET_AD_GRANT_AMOUNT }, - { "rewardsAdGrantTitle", IDS_REWARDS_WIDGET_AD_GRANT_TITLE }, - { "rewardsClaimRewards", IDS_REWARDS_WIDGET_CLAIM_REWARDS }, - { "rewardsClaimTokens", IDS_REWARDS_WIDGET_CLAIM_TOKENS }, - { "rewardsConnectAccount", IDS_REWARDS_CONNECT_ACCOUNT }, - { "rewardsContribute", IDS_BRAVE_UI_REWARDS_CONTRIBUTE }, - { "rewardsContributeAttention", IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION }, // NOLINT - { "rewardsGrantDaysRemaining", IDS_REWARDS_WIDGET_GRANT_DAYS_REMAINING }, // NOLINT - { "rewardsLearnMore", IDS_REWARDS_LEARN_MORE }, - { "rewardsLogInToSeeBalance", IDS_REWARDS_LOG_IN_TO_SEE_BALANCE }, - { "rewardsPaymentCheckStatus", IDS_REWARDS_PAYMENT_CHECK_STATUS }, - { "rewardsPaymentCompleted", IDS_REWARDS_PAYMENT_COMPLETED }, - { "rewardsPaymentPending", IDS_REWARDS_PAYMENT_PENDING }, - { "rewardsPaymentProcessing", IDS_REWARDS_PAYMENT_PROCESSING }, - { "rewardsPaymentSupport", IDS_REWARDS_PAYMENT_SUPPORT }, - { "rewardsResetConsent", IDS_BRAVE_UI_REWARDS_RESET_CONSENT }, - { "rewardsResetText", IDS_BRAVE_UI_REWARDS_RESET_TEXT }, - { "rewardsTokenGrantTitle", IDS_REWARDS_WIDGET_TOKEN_GRANT_TITLE }, - { "rewardsSummary", IDS_BRAVE_UI_REWARDS_SUMMARY }, - { "rewardsVBATNoticeText1", IDS_REWARDS_VBAT_NOTICE_TEXT1 }, - { "rewardsVBATNoticeText2", IDS_REWARDS_VBAT_NOTICE_TEXT2 }, - { "rewardsVBATNoticeTitle1", IDS_REWARDS_VBAT_NOTICE_TITLE1 }, - { "rewardsVBATNoticeTitle2", IDS_REWARDS_VBAT_NOTICE_TITLE2 }, - { "saved", IDS_BRAVE_UI_ADS_SAVED }, - { "saveAd", IDS_BRAVE_UI_ADS_SAVE_AD }, - { "seeAllItems", IDS_BRAVE_UI_SEE_ALL_ITEMS }, - { "sendTip", IDS_BRAVE_UI_SEND_TIP }, - { "settings", IDS_BRAVE_UI_SETTINGS }, - { "site", IDS_BRAVE_UI_SITE }, - { "tipOnLike", IDS_BRAVE_UI_TIP_ON_LIKE }, - { "tokenGrantReceived", IDS_BRAVE_UI_TOKEN_GRANT_RECEIVED }, - { "token", IDS_BRAVE_UI_TOKEN }, - { "tokens", IDS_BRAVE_UI_TOKENS }, - { "total", IDS_BRAVE_UI_TOTAL }, - { "transactions", IDS_BRAVE_UI_TRANSACTIONS }, - { "type", IDS_BRAVE_UI_TYPE }, - { "unsupportedRegionNoticeHeader", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_HEADER}, // NOLINT - { "unsupportedRegionNoticeSubheader", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_SUBHEADER}, // NOLINT - { "unsupportedRegionNoticeLearnMore", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_LEARN_MORE}, // NOLINT - { "unsupportedRegionNoticeText1", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_1}, // NOLINT - { "unsupportedRegionNoticeText2", IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_2}, // NOLINT - { "verifiedPublisher", IDS_BRAVE_UI_VERIFIED_PUBLISHER }, - { "viewDetails" , IDS_BRAVE_UI_VIEW_DETAILS }, - { "viewMonthly", IDS_BRAVE_UI_VIEW_MONTHLY }, - { "walletActivity", IDS_BRAVE_UI_WALLET_ACTIVITY }, - { "walletBalance", IDS_BRAVE_UI_WALLET_BALANCE }, - { "yourWallet", IDS_BRAVE_UI_YOUR_WALLET }, - - { "excludedSites", IDS_BRAVE_UI_EXCLUDED_SITES_TEXT }, - { "removeFromExcluded", IDS_BRAVE_UI_REMOVE_FROM_EXCLUDED }, - { "rewardsExcludedText1", IDS_BRAVE_UI_REWARDS_EXCLUDED_TEXT_1 }, - { "rewardsExcludedText2", IDS_BRAVE_UI_REWARDS_EXCLUDED_TEXT_2 }, - { "showAll", IDS_BRAVE_UI_SHOW_ALL }, - { "viewedSites", IDS_BRAVE_UI_VIEWED_SITES }, - - { "promoLearnMore", IDS_BRAVE_UI_PROMO_LEARN_MORE }, - { "promoDismiss", IDS_BRAVE_UI_PROMO_DISMISS }, - - { "bitflyerVerificationPromoTitle", IDS_BRAVE_UI_BITFLYER_VERIFICATION_PROMO_TITLE }, // NOLINT - { "bitflyerVerificationPromoInfo", IDS_BRAVE_UI_BITFLYER_VERIFICATION_PROMO_INFO }, // NOLINT - - { "braveCreatorsPromoTitle", IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_TITLE }, - { "braveCreatorsPromoInfo1", IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_INFO_1 }, - { "braveCreatorsPromoInfo2", IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_INFO_2 }, - - { "tapNetworkTitle", IDS_BRAVE_UI_TAP_NETWORK_TITLE }, - { "tapNetworkInfo", IDS_BRAVE_UI_TAP_NETWORK_INFO }, - { "tapNetworkDisclaimer", IDS_BRAVE_UI_TAP_NETWORK_DISCLAIMER }, - - { "upholdPromoTitle", IDS_BRAVE_UI_UPHOLD_PROMO_TITLE }, - { "upholdPromoInfo", IDS_BRAVE_UI_UPHOLD_PROMO_INFO }, - - { "connectAccountNoProviders", IDS_REWARDS_CONNECT_ACCOUNT_NO_PROVIDERS }, // NOLINT - { "connectAccountText", IDS_REWARDS_CONNECT_ACCOUNT_TEXT }, - { "learnMore", IDS_REWARDS_LEARN_MORE }, - { "connectWalletCustodialHeader", IDS_BRAVE_REWARDS_CONNECT_WALLET_CUSTODIAL_HEADER }, // NOLINT - { "connectWalletCustodialTooltip", IDS_BRAVE_REWARDS_CONNECT_WALLET_CUSTODIAL_TOOLTIP }, // NOLINT - { "connectWalletHeader", IDS_BRAVE_REWARDS_CONNECT_WALLET_HEADER }, - { "connectWalletLearnMore", IDS_BRAVE_REWARDS_CONNECT_WALLET_LEARN_MORE }, // NOLINT - { "connectWalletProviderNotAvailable", IDS_BRAVE_REWARDS_CONNECT_WALLET_PROVIDER_NOT_AVAILABLE }, // NOLINT - { "connectWalletText", IDS_BRAVE_REWARDS_CONNECT_WALLET_TEXT }, - { "contributionPendingUntil", IDS_BRAVE_REWARDS_CONTRIBUTION_PENDING_UNTIL }, // NOLINT - - { "walletAccountLink", IDS_REWARDS_WALLET_ACCOUNT_LINK }, - { "walletAutoContribute", IDS_REWARDS_WALLET_AUTO_CONTRIBUTE }, - { "walletDisconnected", IDS_REWARDS_WALLET_DISCONNECTED }, - { "walletEstimatedEarnings", IDS_REWARDS_ESTIMATED_EARNINGS_TITLE }, - { "walletLogIntoYourAccount", IDS_REWARDS_WALLET_LOG_INTO_YOUR_ACCOUNT }, // NOLINT - { "walletMonthlyTips", IDS_REWARDS_WALLET_MONTHLY_TIPS }, - { "walletOneTimeTips", IDS_REWARDS_WALLET_ONE_TIME_TIPS }, - { "walletRewardsFromAds", IDS_REWARDS_WALLET_REWARDS_FROM_ADS }, - { "walletRewardsSummary", IDS_REWARDS_WALLET_REWARDS_SUMMARY }, - { "walletUnverified", IDS_REWARDS_WALLET_UNVERIFIED }, - { "walletViewStatement", IDS_REWARDS_WALLET_VIEW_STATEMENT }, - { "walletVerified", IDS_REWARDS_WALLET_VERIFIED }, - { "walletBalanceTitle", IDS_REWARDS_WALLET_BALANCE_TITLE }, - { "walletEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT }, - - { "loading", IDS_BRAVE_REWARDS_LOADING_LABEL }, - } - }, { - std::string("adblock"), { - { "additionalFiltersTitle", IDS_ADBLOCK_ADDITIONAL_FILTERS_TITLE }, - { "additionalFiltersWarning", IDS_ADBLOCK_ADDITIONAL_FILTERS_WARNING }, // NOLINT - { "adsBlocked", IDS_ADBLOCK_TOTAL_ADS_BLOCKED }, - { "customFiltersTitle", IDS_ADBLOCK_CUSTOM_FILTERS_TITLE }, - { "customFiltersInstructions", IDS_ADBLOCK_CUSTOM_FILTERS_INSTRUCTIONS }, // NOLINT - { "customListSubscriptionsTitle", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TITLE }, // NOLINT - { "customListSubscriptionsInstructions", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_INSTRUCTIONS }, // NOLINT - { "customListSubscriptionsDisclaimer", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_DISCLAIMER }, // NOLINT - - { "customListSubscriptionsEnterSubscriptionUrlPlaceholder", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_ENTER_SUBSCRIPTION_URL_PLACEHOLDER }, // NOLINT - { "customListSubscriptionsSubmitNewSubscription", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_SUBMIT_NEW_SUBSCRIPTION }, // NOLINT - { "customListSubscriptionsCancelAddSubscription", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_CANCEL_ADD_SUBSCRIPTION }, // NOLINT - { "customListSubscriptionsAddNewFilterList", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_ADD_NEW_FILTER_LIST }, // NOLINT - { "customListSubscriptionsTableFilterListColumn", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TABLE_FILTER_LIST_COLUMN }, // NOLINT - { "customListSubscriptionsTableLastUpdatedColumn", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TABLE_LAST_UPDATED_COLUMN }, // NOLINT - { "customListSubscriptionsTriggerUpdate", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TRIGGER_UPDATE }, // NOLINT - { "customListSubscriptionsViewListSource", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_VIEW_LIST_SOURCE }, // NOLINT - { "customListSubscriptionsUnsubscribe", IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_UNSUBSCRIBE }, // NOLINT - } - }, { -#if BUILDFLAG(ENABLE_IPFS_INTERNALS_WEBUI) - std::string("ipfs-internals"), { - { "connectedPeersTitle", IDS_IPFS_CONNECTED_PEERS_TITLE }, - { "addressesConfigTitle", IDS_IPFS_ADDRESSES_CONFIG_TITLE }, - { "repoStatsTitle", IDS_IPFS_REPO_STATS_TITLE }, - { "daemonStatusTitle", IDS_IPFS_DAEMON_STATUS_TITLE }, - { "api", IDS_IPFS_API }, - { "gateway", IDS_IPFS_GATEWAY }, - { "swarm", IDS_IPFS_SWARM }, - { "objects", IDS_IPFS_REPO_OBJECTS }, - { "size", IDS_IPFS_REPO_SIZE }, - { "storage", IDS_IPFS_REPO_STORAGE }, - { "path", IDS_IPFS_REPO_PATH }, - { "version", IDS_IPFS_REPO_VERSION }, - { "launched", IDS_IPFS_LAUNCHED }, - { "notLaunched", IDS_IPFS_NOT_LAUNCHED }, - { "launch", IDS_IPFS_LAUNCH }, - { "shutdown", IDS_IPFS_SHUTDOWN }, - { "notInstalled", IDS_IPFS_NOT_INSTALLED }, - { "nodeInfoTitle", IDS_IPFS_NODE_INFO_TITLE }, - { "id", IDS_IPFS_NODE_INFO_ID }, - { "agentVersion", IDS_IPFS_NODE_INFO_VERSION }, - { "restart", IDS_IPFS_RESTART }, - { "learnMore", IDS_IPFS_LEARN_MORE }, - { "installAndLaunch", IDS_IPFS_INSTALL_AND_LAUNCH }, - { "openWebUI", IDS_IPFS_OPEN_WEBUI }, - { "peerDetailsLink", IDS_IPFS_PEERS_DETAILS_LINK }, - { "installing", IDS_IPFS_INSTALLING }, - { "runGarbageCollectionTitle", IDS_IPFS_RUN_GC_BUTTON }, - { "gcError", IDS_IPFS_GC_ERROR }, - { "rotateIdentity", IDS_IPFS_ROTATE_IDENTITY_TITLE } - } - }, { -#endif - std::string("rewards-internals"), { - { "adDiagnosticId", IDS_BRAVE_REWARDS_INTERNALS_AD_DIAGNOSTIC_ID }, - { "adDiagnosticInfo", IDS_BRAVE_REWARDS_INTERNALS_AD_DIAGNOSTIC_INFO }, // NOLINT - { "adsNotInitialized", IDS_BRAVE_REWARDS_INTERNALS_ADS_NOT_INITIALIZED }, // NOLINT - { "amount", IDS_BRAVE_REWARDS_INTERNALS_AMOUNT }, - { "autoRefresh", IDS_BRAVE_REWARDS_INTERNALS_AUTO_REFRESH }, - { "balanceInfo", IDS_BRAVE_REWARDS_INTERNALS_BALANCE_INFO }, - { "bat", IDS_BRAVE_UI_BAT_TEXT }, - { "bootStamp", IDS_BRAVE_REWARDS_INTERNALS_BOOT_STAMP }, - { "clearButton", IDS_BRAVE_REWARDS_INTERNALS_CLEAR_BUTTON }, - { "contributedAmount", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTED_AMOUNT }, - { "contributionCreatedAt", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTED_CREATED_AT }, // NOLINT - { "contribution", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION }, - { "contributionProcessor", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_PROCESSOR }, // NOLINT - { "contributionStep", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP }, - { "contributionStepAutoContributeTableEmpty", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_AUTO_CONTRIBUTE_TABLE_EMPTY }, // NOLINT - { "contributionStepNotEnoughFunds", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_NOT_ENOUGH_FUNDS }, // NOLINT - { "contributionStepFailed", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_FAILED }, // NOLINT - { "contributionStepCompleted", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_COMPLETED },// NOLINT - { "contributionStepNo", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_NO }, // NOLINT - { "contributionStepStart", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_START }, // NOLINT - { "contributionStepPrepare", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_PREPARE }, // NOLINT - { "contributionStepReserve", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_RESERVE }, // NOLINT - { "contributionStepExternalTransaction", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_EXTERNAL_TRANSACTION }, // NOLINT - { "contributionStepCreds", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_CREDS }, // NOLINT - { "contributionStepRewardsOff", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_REWARDS_OFF }, // NOLINT - { "contributionStepAutoContributeOff", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_AUTO_CONTRIBUTE_OFF }, // NOLINT - { "contributionStepRetryCount", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_RETRY_COUNT }, // NOLINT - { "eventLogKey", IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_KEY }, - { "eventLogValue", IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_VALUE }, - { "eventLogTime", IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_TIME }, - { "mainDisclaimer", IDS_BRAVE_REWARDS_INTERNALS_MAIN_DISCLAIMER }, - { "logDisclaimer", IDS_BRAVE_REWARDS_INTERNALS_LOG_DISCLAIMER }, - { "rewardsTypeAuto", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_AUTO }, // NOLINT - { "rewardsTypeOneTimeTip", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_ONE_TIME_TIP }, // NOLINT - { "rewardsTypeRecurringTip", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_RECURRING_TIP }, // NOLINT - { "contributionType", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_TYPE }, - { "contributions", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTIONS }, - { "custodian", IDS_BRAVE_REWARDS_INTERNALS_CUSTODIAN }, - { "custodianMemberId", IDS_BRAVE_REWARDS_INTERNALS_CUSTODIAN_MEMBER_ID }, // NOLINT - { "downloadButton", IDS_BRAVE_REWARDS_INTERNALS_DOWNLOAD_BUTTON }, - { "externalWallet", IDS_BRAVE_REWARDS_INTERNALS_EXTERNAL_WALLET }, - { "invalid", IDS_BRAVE_REWARDS_INTERNALS_INVALID }, - { "keyInfoSeed", IDS_BRAVE_REWARDS_INTERNALS_KEY_INFO_SEED }, - { "logNotice", IDS_BRAVE_REWARDS_INTERNALS_LOG_NOTICE }, - { "mainTitle", IDS_BRAVE_REWARDS_INTERNALS_MAIN_TITLE }, - { "notSet", IDS_BRAVE_REWARDS_INTERNALS_NOT_SET }, - { "personaId", IDS_BRAVE_REWARDS_INTERNALS_PERSONA_ID }, - { "processorBraveTokens", IDS_BRAVE_UI_PROCESSOR_BRAVE_TOKENS }, - { "processorUphold", IDS_BRAVE_UI_PROCESSOR_UPHOLD }, - { "processorBitflyer", IDS_BRAVE_UI_PROCESSOR_BITFLYER }, - { "processorGemini", IDS_BRAVE_UI_PROCESSOR_GEMINI }, - { "processorZebPay", IDS_BRAVE_UI_PROCESSOR_ZEBPAY }, - { "promotionAds", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_ADS }, - { "promotionAmount", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_AMOUNT }, - { "promotionClaimedAt", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_CLAIMED_AT }, // NOLINT - { "promotionClaimId", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_CLAIM_ID }, - { "promotionExpiresAt", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_EXPIRES_AT }, // NOLINT - { "promotionId", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_ID }, - { "promotionLegacyClaimed", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_CLAIMED }, // NOLINT - { "promotionLegacyNo", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_NO }, // NOLINT - { "promotionLegacyYes", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_YES }, // NOLINT - { "promotions", IDS_BRAVE_REWARDS_INTERNALS_PROMOTIONS }, - { "promotionStatus", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS }, - { "promotionStatusActive", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_ACTIVE }, // NOLINT - { "promotionStatusAttested", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_ATTESTED }, // NOLINT - { "promotionStatusFinished", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_FINISHED }, // NOLINT - { "promotionStatusOver", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_OVER }, // NOLINT - { "promotionType", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_TYPE }, - { "promotionUGP", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_UGP }, - { "promotionVersion", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_VERSION }, - { "refreshButton", IDS_BRAVE_REWARDS_INTERNALS_REFRESH_BUTTON }, - { "retryCount", IDS_BRAVE_REWARDS_INTERNALS_RETRY_COUNT }, - { "rewardsCountry", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_COUNTRY }, - { "tabAdDiagnostics", IDS_BRAVE_REWARDS_INTERNALS_TAB_AD_DIAGNOSTICS }, - { "tabGeneralInfo", IDS_BRAVE_REWARDS_INTERNALS_TAB_GENERAL_INFO }, - { "tabLogs", IDS_BRAVE_REWARDS_INTERNALS_TAB_LOGS }, - { "tabPromotions", IDS_BRAVE_REWARDS_INTERNALS_TAB_PROMOTIONS }, - { "tabContributions", IDS_BRAVE_REWARDS_INTERNALS_TAB_CONTRIBUTIONS }, - { "tabEventLogs", IDS_BRAVE_REWARDS_INTERNALS_TAB_EVENT_LOGS }, - { "totalAmount", IDS_BRAVE_REWARDS_INTERNALS_TOTAL_AMOUNT }, - { "totalBalance", IDS_BRAVE_REWARDS_INTERNALS_TOTAL_BALANCE }, - { "userId", IDS_BRAVE_REWARDS_INTERNALS_USER_ID }, - { "valid", IDS_BRAVE_REWARDS_INTERNALS_VALID }, - { "walletAddress", IDS_BRAVE_REWARDS_INTERNALS_WALLET_ADDRESS }, - { "walletHistory", IDS_BRAVE_REWARDS_INTERNALS_WALLET_HISTORY }, - { "walletInfo", IDS_BRAVE_REWARDS_INTERNALS_WALLET_INFO }, - { "walletNotCreated", IDS_BRAVE_REWARDS_INTERNALS_WALLET_NOT_CREATED }, - { "walletPaymentId", IDS_BRAVE_REWARDS_INTERNALS_WALLET_PAYMENT_ID }, - { "walletStatus", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS }, - { "walletStatusNotConnected", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_NOT_CONNECTED }, // NOLINT - { "walletStatusVerified", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_VERIFIED }, // NOLINT - { "walletStatusDisconnectedVerified", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_DISCONNECTED_VERIFIED }, // NOLINT - { "walletCreationEnvironment", IDS_BRAVE_REWARDS_INTERNALS_WALLET_CREATION_ENVIRONMENT }, // NOLINT - { "currentEnvironment", IDS_BRAVE_REWARDS_INTERNALS_CURRENT_ENVIRONMENT}, // NOLINT - - { "loading", IDS_BRAVE_REWARDS_LOADING_LABEL }, - } - }, { -#if BUILDFLAG(ENABLE_TOR) - std::string("tor-internals"), { - { "tabGeneralInfo", IDS_TOR_INTERNALS_TAB_GENERAL_INFO }, - { "tabLogs", IDS_TOR_INTERNALS_TAB_LOGS }, - { "torControlEvents", IDS_TOR_INTERNALS_TOR_CONTROL_EVENTS }, - { "torVersion", IDS_TOR_INTERNALS_TOR_VERSION }, - { "torPid", IDS_TOR_INTERNALS_TOR_PID }, - { "torProxyURI", IDS_TOR_INTERNALS_TOR_PROXY_URI }, - { "torConnectionStatus", IDS_TOR_INTERNALS_TOR_CONNECTION_STATUS }, - { "torInitProgress", IDS_TOR_INTERNALS_TOR_INIT_PROGRESS }, - } - }, { -#endif -#if !BUILDFLAG(IS_ANDROID) - std::string("webcompat"), { - // Report modal - { "reportModalTitle", IDS_BRAVE_WEBCOMPATREPORTER_REPORT_MODAL_TITLE }, - { "reportExplanation", IDS_BRAVE_WEBCOMPATREPORTER_REPORT_EXPLANATION }, - { "reportDisclaimer", IDS_BRAVE_WEBCOMPATREPORTER_REPORT_DISCLAIMER }, - { "reportDetails", IDS_BRAVE_WEBCOMPATREPORTER_REPORT_DETAILS }, - { "reportContactPlaceholder", - IDS_BRAVE_WEBCOMPATREPORTER_REPORT_CONTACT_PLACEHOLDER }, - { "reportContactLabel", - IDS_BRAVE_WEBCOMPATREPORTER_REPORT_CONTACT_LABEL }, - { "cancel", IDS_BRAVE_WEBCOMPATREPORTER_CANCEL }, - { "submit", IDS_BRAVE_WEBCOMPATREPORTER_SUBMIT }, - // Confirmation modal - { "thankYou", IDS_BRAVE_WEBCOMPATREPORTER_THANK_YOU }, - { "confirmationNotice", - IDS_BRAVE_WEBCOMPATREPORTER_CONFIRMATION_NOTICE }, - } -#endif - } - }; - // clang-format on - AddLocalizedStringsBulk(source, localized_strings[name]); -} // NOLINT(readability/fn_size) + source->AddResourcePaths(brave::GetWebUIResources(name)); + source->AddLocalizedStrings(brave::GetWebUILocalizedStrings(name)); +} content::WebUIDataSource* CreateWebUIDataSource( content::WebUI* web_ui, diff --git a/chromium_src/chrome/browser/ui/webui/DEPS b/chromium_src/chrome/browser/ui/webui/DEPS index 0de07bbaf088..5e6dbb1486c3 100644 --- a/chromium_src/chrome/browser/ui/webui/DEPS +++ b/chromium_src/chrome/browser/ui/webui/DEPS @@ -1,3 +1,4 @@ include_rules = [ + "+brave/components/webui/about_ui.h", "+third_party/re2", ] diff --git a/chromium_src/chrome/browser/ui/webui/about_ui.cc b/chromium_src/chrome/browser/ui/webui/about_ui.cc index f8f437a00d37..b513f90ad2d2 100644 --- a/chromium_src/chrome/browser/ui/webui/about_ui.cc +++ b/chromium_src/chrome/browser/ui/webui/about_ui.cc @@ -1,55 +1,11 @@ -/* Copyright (c) 2021 The Brave Authors. All rights reserved. - * 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 - -#include "base/containers/contains.h" -#include "base/strings/string_split.h" -#include "third_party/re2/src/re2/re2.h" +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. +#include "brave/components/webui/about_ui.h" // IWYU pragma: export #include "src/chrome/browser/ui/webui/about_ui.cc" std::string AboutUIHTMLSource::ChromeURLs() const { - std::string chrome_urls = ::ChromeURLs(); - - // Replace Chrome -> Brave. - const std::string chrome_header = "Chrome URLs"; - const std::string brave_header = "Brave URLs"; - const std::string chrome_pages_header = "List of Chrome URLs"; - const std::string brave_pages_header = "List of Brave URLs"; - const std::string chrome_internal_pages_header = - "List of chrome://internals pages"; - const std::string brave_internal_pages_header = - "List of brave://internals pages"; - const std::string chrome_url_list = ">chrome://"; - const std::string brave_url_list = ">brave://"; - RE2::GlobalReplace(&chrome_urls, chrome_header, brave_header); - RE2::GlobalReplace(&chrome_urls, chrome_pages_header, brave_pages_header); - RE2::GlobalReplace(&chrome_urls, chrome_internal_pages_header, - brave_internal_pages_header); - RE2::GlobalReplace(&chrome_urls, chrome_url_list, brave_url_list); - - // Remove some URLs. - auto html_lines = base::SplitStringPiece( - chrome_urls, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - const base::flat_set kURLsToRemove{ - "brave://memories", - }; - // URLs in html should be sorted so it's okay to iterate over sorted - // kURLsToRemove. - auto html_line_it = html_lines.begin(); - auto url_to_remove_it = kURLsToRemove.begin(); - while (html_line_it != html_lines.end() && - url_to_remove_it != kURLsToRemove.end()) { - if (base::Contains(*html_line_it, *url_to_remove_it)) { - html_line_it = html_lines.erase(html_line_it); - ++url_to_remove_it; - } else { - ++html_line_it; - } - } - - return base::JoinString(html_lines, "\n"); + return brave::ReplaceAboutUIChromeURLs(::ChromeURLs()); } diff --git a/chromium_src/ios/chrome/browser/ui/webui/DEPS b/chromium_src/ios/chrome/browser/ui/webui/DEPS new file mode 100644 index 000000000000..7c0e6ba7485a --- /dev/null +++ b/chromium_src/ios/chrome/browser/ui/webui/DEPS @@ -0,0 +1,5 @@ +include_rules = [ + "+brave/components/version_info/version_info.h", + "+brave/components/webui/about_ui.h", + "+brave/ios/browser/ui/webui/brave_web_ui_controller_factory.h", +] \ No newline at end of file diff --git a/chromium_src/ios/chrome/browser/ui/webui/about_ui.cc b/chromium_src/ios/chrome/browser/ui/webui/about_ui.cc new file mode 100644 index 000000000000..1b10dce91415 --- /dev/null +++ b/chromium_src/ios/chrome/browser/ui/webui/about_ui.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/components/webui/about_ui.h" // IWYU pragma: keep +#include "ios/chrome/browser/shared/model/url/chrome_url_constants.h" // IWYU pragma: keep + +#define kChromeUIChromeURLsHost kChromeUIChromeURLsHost) { \ + response = brave::ReplaceAboutUIChromeURLs(ChromeURLs()); \ + } else if (false // NOLINT[readability/braces] + +#include "src/ios/chrome/browser/ui/webui/about_ui.cc" diff --git a/chromium_src/ios/chrome/browser/ui/webui/crashes_ui.cc b/chromium_src/ios/chrome/browser/ui/webui/crashes_ui.cc new file mode 100644 index 000000000000..4987181f2e03 --- /dev/null +++ b/chromium_src/ios/chrome/browser/ui/webui/crashes_ui.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/components/version_info/version_info.h" +#include "components/version_info/version_info.h" + +#define GetVersionNumber GetBraveVersionNumberForDisplay +#include "src/ios/chrome/browser/ui/webui/crashes_ui.cc" +#undef GetVersionNumber diff --git a/chromium_src/ios/chrome/browser/ui/webui/version_ui.mm b/chromium_src/ios/chrome/browser/ui/webui/version_ui.mm new file mode 100644 index 000000000000..0085294d1689 --- /dev/null +++ b/chromium_src/ios/chrome/browser/ui/webui/version_ui.mm @@ -0,0 +1,11 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/components/version_info/version_info.h" +#include "components/version_info/version_info.h" + +#define GetVersionNumber GetBraveVersionNumberForDisplay +#include "src/ios/chrome/browser/ui/webui/version_ui.mm" +#undef GetVersionNumber diff --git a/components/webui/BUILD.gn b/components/webui/BUILD.gn new file mode 100644 index 000000000000..c31947385242 --- /dev/null +++ b/components/webui/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# 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 https://mozilla.org/MPL/2.0/. + +import("//brave/build/config.gni") +import("//build/buildflag_header.gni") + +static_library("webui") { + visibility = [ + "//brave/browser/ui", + "//brave/ios/browser/ui/webui", + ] + + sources = [ + "about_ui.cc", + "about_ui.h", + "webui_resources.cc", + "webui_resources.h", + ] + + deps = [ + "//base", + "//brave/components/ai_chat/core/common/buildflags", + "//brave/components/brave_rewards/resources:static_resources", + "//brave/components/constants", + "//brave/components/ipfs/buildflags", + "//brave/components/l10n/common", + "//brave/components/resources:static_resources", + "//brave/components/resources:strings_grit", + "//brave/components/tor/buildflags", + "//components/resources:components_resources_grit", + "//components/strings:components_strings", + "//third_party/re2", + "//ui/base:base", + ] +} diff --git a/components/webui/DEPS b/components/webui/DEPS new file mode 100644 index 000000000000..5314cab856e8 --- /dev/null +++ b/components/webui/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+third_party/re2", +] \ No newline at end of file diff --git a/components/webui/about_ui.cc b/components/webui/about_ui.cc new file mode 100644 index 000000000000..6c06bb974e79 --- /dev/null +++ b/components/webui/about_ui.cc @@ -0,0 +1,60 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/components/webui/about_ui.h" + +#include + +#include "base/containers/contains.h" +#include "base/containers/fixed_flat_set.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "third_party/re2/src/re2/re2.h" + +namespace brave { + +std::string ReplaceAboutUIChromeURLs(std::string chrome_urls) { + // Replace Chrome -> Brave. + constexpr std::string_view kChromeHeader = "Chrome URLs"; + constexpr std::string_view kBraveHeader = "Brave URLs"; + constexpr std::string_view kChromePagesHeader = "List of Chrome URLs"; + constexpr std::string_view kBravePagesHeader = "List of Brave URLs"; + constexpr std::string_view kChromeInternalPagesHeader = + "List of chrome://internals pages"; + constexpr std::string_view kBraveInternalPagesHeader = + "List of brave://internals pages"; + constexpr std::string_view kChromeURLList = ">chrome://"; + constexpr std::string_view kBraveURLList = ">brave://"; + + RE2::GlobalReplace(&chrome_urls, kChromeHeader, kBraveHeader); + RE2::GlobalReplace(&chrome_urls, kChromePagesHeader, kBravePagesHeader); + RE2::GlobalReplace(&chrome_urls, kChromeInternalPagesHeader, + kBraveInternalPagesHeader); + RE2::GlobalReplace(&chrome_urls, kChromeURLList, kBraveURLList); + + // Remove some URLs. + auto html_lines = base::SplitStringPiece( + chrome_urls, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + constexpr auto kURLsToRemove = base::MakeFixedFlatSet({ + "brave://memories", + }); + // URLs in html should be sorted so it's okay to iterate over sorted + // kURLsToRemove. + auto html_line_it = html_lines.begin(); + auto* url_to_remove_it = kURLsToRemove.begin(); + while (html_line_it != html_lines.end() && + url_to_remove_it != kURLsToRemove.end()) { + if (base::Contains(*html_line_it, *url_to_remove_it)) { + html_line_it = html_lines.erase(html_line_it); + ++url_to_remove_it; + } else { + ++html_line_it; + } + } + + return base::JoinString(html_lines, "\n"); +} + +} // namespace brave diff --git a/components/webui/about_ui.h b/components/webui/about_ui.h new file mode 100644 index 000000000000..16ebf4554283 --- /dev/null +++ b/components/webui/about_ui.h @@ -0,0 +1,17 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_COMPONENTS_WEBUI_ABOUT_UI_H_ +#define BRAVE_COMPONENTS_WEBUI_ABOUT_UI_H_ + +#include + +namespace brave { + +std::string ReplaceAboutUIChromeURLs(std::string chrome_urls); + +} // namespace brave + +#endif // BRAVE_COMPONENTS_WEBUI_ABOUT_UI_H_ diff --git a/components/webui/webui_resources.cc b/components/webui/webui_resources.cc new file mode 100644 index 000000000000..6fb6d41d3dcc --- /dev/null +++ b/components/webui/webui_resources.cc @@ -0,0 +1,1045 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/components/webui/webui_resources.h" + +#include + +#include "base/containers/flat_map.h" +#include "base/no_destructor.h" +#include "base/strings/utf_string_conversions.h" +#include "brave/components/constants/url_constants.h" +#include "brave/components/ipfs/buildflags/buildflags.h" +#include "brave/components/tor/buildflags/buildflags.h" +#include "build/build_config.h" +#include "components/grit/brave_components_resources.h" +#include "components/grit/brave_components_strings.h" +#include "components/grit/components_resources.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/webui/resource_path.h" +#include "ui/base/webui/web_ui_util.h" + +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) +#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h" +#endif + +namespace brave { + +base::span GetWebUIResources( + std::string_view webui_name) { + static const base::NoDestructor< + base::flat_map>> + kResources{{ +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) + {"newtab", + {{"img/toolbar/menu_btn.svg", IDR_BRAVE_COMMON_TOOLBAR_IMG}, + // Hash path is the MD5 of the file contents, + // webpack image loader does this + {"fd85070af5114d6ac462c466e78448e4.svg", IDR_BRAVE_NEW_TAB_IMG1}, + {"314e7529efec41c8867019815f4d8dad.svg", IDR_BRAVE_NEW_TAB_IMG4}, + {"6c337c63662ee0ba4e57f6f8156d69ce.svg", IDR_BRAVE_NEW_TAB_IMG2}, + // New tab Backgrounds + {"dylan-malval_sea-min.webp", IDR_BRAVE_NEW_TAB_BACKGROUND1}, + // private tab + {"c168145d6bf1abf2c0322636366f7dbe.svg", + IDR_BRAVE_PRIVATE_TAB_TOR_IMG}, + {"dbdc336ccc651b8a7c925b3482d6e65a.svg", + IDR_BRAVE_PRIVATE_TAB_IMG}}}, + {"rewards", + { + {"favicon.ico", IDR_BRAVE_REWARDS_FAVICON}, + }}, + {"welcome", {{"favicon.ico", IDR_BRAVE_WELCOME_PAGE_FAVICON}}}, +#endif + {"adblock", {}}, + }}; + + if (auto it = kResources->find(webui_name); it != kResources->end()) { + return it->second; + } + return {}; +} // NO-LINT (readability/fn_size) + +base::span GetWebUILocalizedStrings( + std::string_view webui_name) { + static const base::NoDestructor>> + kLocalizedStrings{{ + {"newtab", + { + {"adsTrackersBlocked", + IDS_BRAVE_NEW_TAB_TOTAL_ADS_TRACKERS_BLOCKED}, + {"httpsUpgraded", IDS_BRAVE_NEW_TAB_TOTAL_HTTPS_UPGRADES}, + {"estimatedTimeSaved", IDS_BRAVE_NEW_TAB_TOTAL_TIME_SAVED}, + {"estimatedBandwidthSaved", + IDS_BRAVE_NEW_TAB_ESTIMATED_BANDWIDTH_SAVED}, + {"thumbRemoved", IDS_BRAVE_NEW_TAB_THUMB_REMOVED}, + {"undoRemoved", IDS_BRAVE_NEW_TAB_UNDO_REMOVED}, + {"close", IDS_BRAVE_NEW_TAB_CLOSE}, + {"restoreAll", IDS_BRAVE_NEW_TAB_RESTORE_ALL}, + {"second", IDS_BRAVE_NEW_TAB_SECOND}, + {"seconds", IDS_BRAVE_NEW_TAB_SECONDS}, + {"minute", IDS_BRAVE_NEW_TAB_MINUTE}, + {"minutes", IDS_BRAVE_NEW_TAB_MINUTES}, + {"hour", IDS_BRAVE_NEW_TAB_HOUR}, + {"hours", IDS_BRAVE_NEW_TAB_HOURS}, + {"day", IDS_BRAVE_NEW_TAB_DAY}, + {"days", IDS_BRAVE_NEW_TAB_DAYS}, + {"B", IDS_BRAVE_NEW_TAB_BYTES}, + {"KB", IDS_BRAVE_NEW_TAB_KILOBYTES}, + {"MB", IDS_BRAVE_NEW_TAB_MEGABYTES}, + {"GB", IDS_BRAVE_NEW_TAB_GIGABYTES}, + {"photoBy", IDS_BRAVE_NEW_TAB_PHOTO_BY}, + {"hide", IDS_BRAVE_NEW_TAB_HIDE}, + {"preferencesPageTitle", + IDS_BRAVE_NEW_TAB_PREFERENCES_PAGE_TITLE}, + {"bookmarksPageTitle", IDS_BRAVE_NEW_TAB_BOOKMARKS_PAGE_TITLE}, + {"historyPageTitle", IDS_BRAVE_NEW_TAB_HISTORY_PAGE_TITLE}, + {"dashboardSettingsTitle", + IDS_BRAVE_NEW_TAB_DASHBOARD_SETTINGS_TITLE}, + {"customize", IDS_BRAVE_NEW_TAB_CUSTOMIZE}, + {"showBackgroundImage", IDS_BRAVE_NEW_TAB_SHOW_BACKGROUND_IMAGE}, + {"braveBackgroundImageOptionTitle", + IDS_BRAVE_NEW_TAB_BRAVE_BACKGROUND_IMAGE_OPTION_TITLE}, + {"customBackgroundImageOptionTitle", + IDS_BRAVE_NEW_TAB_CUSTOM_BACKGROUND_IMAGE_OPTION_TITLE}, + {"customBackgroundImageOptionUploadLabel", + IDS_BRAVE_NEW_TAB_CUSTOM_BACKGROUND_IMAGE_OPTION_UPLOAD_LABEL}, + {"showBraveStats", IDS_BRAVE_NEW_TAB_SHOW_BRAVE_STATS}, + {"showClock", IDS_BRAVE_NEW_TAB_SHOW_CLOCK}, + {"clockFormat", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT}, + {"clockFormatDefault", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_DEFAULT}, + {"clockFormat12", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_12}, + {"clockFormat24", IDS_BRAVE_NEW_TAB_CLOCK_FORMAT_24}, + {"addTopSiteDialogTitle", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_TITLE}, + {"editTopSiteDialogTitle", + IDS_BRAVE_NEW_TAB_EDIT_TOP_SITE_DIALOG_TITLE}, + {"editSiteTileMenuItem", + IDS_BRAVE_NEW_TAB_EDIT_SITE_TILE_MENU_ITEM}, + {"removeTileMenuItem", IDS_BRAVE_NEW_TAB_REMOVE_TILE_MENU_ITEM}, + {"addTopSiteDialogURLLabel", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_URL_LABEL}, + {"addTopSiteDialogURLInputPlaceHolder", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_URL_INPUT_PLACEHOLDER}, + {"addTopSiteDialogNameLabel", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_NAME_LABEL}, + {"addTopSiteDialogNameInputPlaceHolder", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_NAME_INPUT_PLACEHOLDER}, + {"addTopSiteDialogSaveButtonLabel", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_SAVE_BUTTON_LABEL}, + {"addTopSiteDialogCancelButtonLabel", + IDS_BRAVE_NEW_TAB_ADD_TOP_SITE_DIALOG_CANCEL_BUTTON_LABEL}, + {"showTopSites", IDS_BRAVE_NEW_TAB_SHOW_TOP_SITES}, + {"showFavoritesLabel", IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_LABEL}, + {"showFavoritesDesc", IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_DESC}, + {"showFrecencyLabel", IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_LABEL}, + {"showFrecencyDesc", IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_DESC}, + {"addSiteMenuLabel", IDS_BRAVE_NEW_TAB_ADD_SITE_MENU_LABEL}, + {"showFrecencyMenuLabel", + IDS_BRAVE_NEW_TAB_SHOW_FRECENCY_MENU_LABEL}, + {"showFavoritesMenuLabel", + IDS_BRAVE_NEW_TAB_SHOW_FAVORITES_MENU_LABEL}, + {"showRewards", IDS_BRAVE_NEW_TAB_SHOW_REWARDS}, + {"cards", IDS_BRAVE_NEW_TAB_SHOW_CARDS}, + {"brandedWallpaperOptIn", + IDS_BRAVE_NEW_TAB_BRANDED_WALLPAPER_OPT_IN}, + {"sponsoredImageEarningTitle", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_EARNING_TITLE}, + {"sponsoredImageEnableRewards", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ENABLE_REWARDS}, + {"sponsoredImageNotEarningTitle", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_NOT_EARNING_TITLE}, + {"sponsoredImageOffRewardsOnDescription", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_OFF_REWARDS_ON_DESCRPTION}, + {"sponsoredImageOnDescription", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ON_DESCRIPTION}, + {"sponsoredImageOnRewardsOnNoCustodianDescription", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_ON_REWARDS_ON_NO_CUSTODIAN_DESCRIPTION}, + {"sponsoredImageRewardsOffDescription", + IDS_BRAVE_NEW_TAB_SPONSORED_IMAGE_REWARDS_OFF_DESCRIPTION}, + {"topSitesTitle", IDS_BRAVE_NEW_TAB_TOP_SITES}, + {"statsTitle", IDS_BRAVE_NEW_TAB_STATS}, + {"clockTitle", IDS_BRAVE_NEW_TAB_CLOCK}, + {"backgroundImageTitle", IDS_BRAVE_NEW_TAB_BACKGROUND_IMAGE}, + {"settingsNavigateBack", IDS_BRAVE_NEW_TAB_SETTINGS_BACK}, + {"braveBackgroundsTitle", IDS_BRAVE_NEW_TAB_BRAVE_BACKGROUND}, + {"solidColorTitle", IDS_BRAVE_NEW_TAB_SOLID_COLOR}, + {"gradientColorTitle", IDS_BRAVE_NEW_TAB_GRADIENT_COLOR}, + {"refreshBackgroundOnNewTab", + IDS_BRAVE_NEW_TAB_REFRESH_BACKGROUND_ON_NEW_TAB}, + {"rewardsOpenPanel", IDS_BRAVE_NEW_TAB_REWARDS_OPEN_PANEL}, + + // search promotion + {"searchPromotionNTPPopupTitle1", + IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_TITLE_1}, + {"searchPromotionNTPPopupTitle2", + IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_TITLE_2}, + {"searchPromotionNTPPopupDesc", + IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_DESC}, + {"searchPromotionNTPPopupBottom", + IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_POPUP_BOTTOM}, + {"searchPromotionSearchBoxPlaceholderLabel", + IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_SEARCH_BOX_PLACEHOLDER}, + + {"braveNewsTitle", IDS_BRAVE_NEWS_TITLE}, + {"braveNewsStatusFetching", IDS_BRAVE_NEWS_STATUS_FETCHING}, + {"braveNewsActionRefresh", IDS_BRAVE_NEWS_ACTION_REFRESH}, + {"braveNewsScrollHint", IDS_BRAVE_NEWS_SCROLL_HINT}, + {"braveNewsResetAction", IDS_BRAVE_NEWS_RESET_ACTION}, + {"braveNewsResetConfirm", IDS_BRAVE_NEWS_RESET_CONFIRM}, + {"braveNewsCategoryNameAll", IDS_BRAVE_NEWS_CATEGORY_NAME_ALL}, + {"braveNewsSourcesTitle", IDS_BRAVE_NEWS_SOURCES_TITLE}, + {"braveNewsDisableSourceCommand", + IDS_BRAVE_NEWS_DISABLE_SOURCE_COMMAND}, + {"promoted", IDS_BRAVE_NEWS_PROMOTED}, + {"ad", IDS_BRAVE_NEWS_DISPLAY_AD_LABEL}, + + {"braveNewsIntroTitle", IDS_BRAVE_NEWS_INTRO_TITLE}, + {"braveNewsIntroDescription", IDS_BRAVE_NEWS_INTRO_DESCRIPTION}, + {"braveNewsIntroDescriptionTwo", + IDS_BRAVE_NEWS_INTRO_DESCRIPTION_TWO}, + {"braveNewsOptInActionLabel", + IDS_BRAVE_NEWS_OPT_IN_ACTION_LABEL}, + {"braveNewsOptOutActionLabel", + IDS_BRAVE_NEWS_OPT_OUT_ACTION_LABEL}, + {"braveNewsBackToDashboard", IDS_BRAVE_NEWS_BACK_TO_DASHBOARD}, + {"braveNewsBackButton", IDS_BRAVE_NEWS_BACK_BUTTON}, + {"braveNewsSearchPlaceholderLabel", + IDS_BRAVE_NEWS_SEARCH_PLACEHOLDER_LABEL}, + {"braveNewsChannelsHeader", + IDS_BRAVE_NEWS_BROWSE_CHANNELS_HEADER}, + {"braveNewsViewAllButton", IDS_BRAVE_NEWS_VIEW_ALL_BUTTON}, + {"braveNewsAllSourcesHeader", IDS_BRAVE_NEWS_ALL_SOURCES_HEADER}, + {"braveNewsFeedsHeading", IDS_BRAVE_NEWS_FEEDS_HEADING}, + {"braveNewsFollowButtonFollowing", + IDS_BRAVE_NEWS_FOLLOW_BUTTON_FOLLOWING}, + {"braveNewsFollowButtonNotFollowing", + IDS_BRAVE_NEWS_FOLLOW_BUTTON_NOT_FOLLOWING}, + {"braveNewsDirectSearchButton", + IDS_BRAVE_NEWS_DIRECT_SEARCH_BUTTON}, + {"braveNewsDirectSearchNoResults", + IDS_BRAVE_NEWS_DIRECT_SEARCH_NO_RESULTS}, + {"braveNewsSearchResultsNoResults", + IDS_BRAVE_NEWS_SEARCH_RESULTS_NO_RESULTS}, + {"braveNewsSearchResultsLocalResults", + IDS_BRAVE_NEWS_SEARCH_RESULTS_LOCAL_RESULTS}, + {"braveNewsSearchResultsDirectResults", + IDS_BRAVE_NEWS_SEARCH_RESULTS_DIRECT_RESULTS}, + {"braveNewsSearchQueryTooShort", + IDS_BRAVE_NEWS_SEARCH_QUERY_TOO_SHORT}, + {"braveNewsSuggestionsTitle", IDS_BRAVE_NEWS_SUGGESTIONS_TITLE}, + {"braveNewsSuggestionsSubtitle", + IDS_BRAVE_NEWS_SUGGESTIONS_SUBTITLE}, + {"braveNewsErrorHeading", IDS_BRAVE_NEWS_ERROR_HEADING}, + {"braveNewsErrorMessage", IDS_BRAVE_NEWS_ERROR_MESSAGE}, + {"braveNewsErrorActionLabel", IDS_BRAVE_NEWS_ERROR_ACTION_LABEL}, + {"braveNewsNoContentHeading", IDS_BRAVE_NEWS_NO_CONTENT_HEADING}, + {"braveNewsNoContentMessage", IDS_BRAVE_NEWS_NO_CONTENT_MESSAGE}, + {"braveNewsNoContentActionLabel", + IDS_BRAVE_NEWS_NO_CONTENT_ACTION_LABEL}, + {"braveNewsPopularTitle", IDS_BRAVE_NEWS_POPULAR_TITLE}, + {"braveNewsNewsPeek", IDS_BRAVE_NEWS_NEWS_PEEK}, + {"braveNewsMyFeedHeading", IDS_BRAVE_NEWS_MY_FEED_HEADING}, + {"braveNewsForYouFeed", IDS_BRAVE_NEWS_FOR_YOU_FEED}, + {"braveNewsFollowingFeed", IDS_BRAVE_NEWS_FOLLOWING_FEED}, + {"braveNewsAddChannelsOrPublishers", + IDS_BRAVE_NEWS_ADD_CHANNELS_OR_PUBLISHERS}, + {"braveNewsPublishersHeading", + IDS_BRAVE_NEWS_PUBLISHERS_HEADING}, + {"braveNewsShowAll", IDS_BRAVE_NEWS_SHOW_ALL}, + {"braveNewsShowLess", IDS_BRAVE_NEWS_SHOW_LESS}, + {"braveNewsAdvertBadge", IDS_BRAVE_NEWS_ADVERT_BADGE}, + {"braveNewsHideContentFrom", IDS_BRAVE_NEWS_HIDE_CONTENT_FROM}, + {"braveNewsSourcesRecommendation", + IDS_BRAVE_NEWS_SOURCES_RECOMMENDATION}, + {"braveNewsNoArticles", IDS_BRAVE_NEWS_NO_ARTICLES}, + {"braveNewsCustomizeFeed", IDS_BRAVE_NEWS_CUSTOMIZE_FEED}, + + // Brave News Channels + {"braveNewsChannel-Brave", IDS_BRAVE_NEWS_CHANNEL_BRAVE}, + {"braveNewsChannel-Business", IDS_BRAVE_NEWS_CHANNEL_BUSINESS}, + {"braveNewsChannel-Cars", IDS_BRAVE_NEWS_CHANNEL_CARS}, + {"braveNewsChannel-Crypto", IDS_BRAVE_NEWS_CHANNEL_CRYPTO}, + {"braveNewsChannel-Culture", IDS_BRAVE_NEWS_CHANNEL_CULTURE}, + {"braveNewsChannel-Entertainment", + IDS_BRAVE_NEWS_CHANNEL_ENTERTAINMENT}, + {"braveNewsChannel-Entertainment News", + IDS_BRAVE_NEWS_CHANNEL_ENTERTAINMENT_NEWS}, + {"braveNewsChannel-Fashion", IDS_BRAVE_NEWS_CHANNEL_FASHION}, + {"braveNewsChannel-Film and TV", + IDS_BRAVE_NEWS_CHANNEL_FILM_AND_TV}, + {"braveNewsChannel-Food", IDS_BRAVE_NEWS_CHANNEL_FOOD}, + {"braveNewsChannel-Fun", IDS_BRAVE_NEWS_CHANNEL_FUN}, + {"braveNewsChannel-Gaming", IDS_BRAVE_NEWS_CHANNEL_GAMING}, + {"braveNewsChannel-Health", IDS_BRAVE_NEWS_CHANNEL_HEALTH}, + {"braveNewsChannel-Home", IDS_BRAVE_NEWS_CHANNEL_HOME}, + {"braveNewsChannel-Music", IDS_BRAVE_NEWS_CHANNEL_MUSIC}, + {"braveNewsChannel-Politics", IDS_BRAVE_NEWS_CHANNEL_POLITICS}, + {"braveNewsChannel-Regional News", + IDS_BRAVE_NEWS_CHANNEL_REGIONAL_NEWS}, + {"braveNewsChannel-Science", IDS_BRAVE_NEWS_CHANNEL_SCIENCE}, + {"braveNewsChannel-Sports", IDS_BRAVE_NEWS_CHANNEL_SPORTS}, + {"braveNewsChannel-Travel", IDS_BRAVE_NEWS_CHANNEL_TRAVEL}, + {"braveNewsChannel-Technology", + IDS_BRAVE_NEWS_CHANNEL_TECHNOLOGY}, + {"braveNewsChannel-Tech News", IDS_BRAVE_NEWS_CHANNEL_TECH_NEWS}, + {"braveNewsChannel-Tech Reviews", + IDS_BRAVE_NEWS_CHANNEL_TECH_REVIEWS}, + {"braveNewsChannel-Top News", IDS_BRAVE_NEWS_CHANNEL_TOP_NEWS}, + {"braveNewsChannel-Top Sources", + IDS_BRAVE_NEWS_CHANNEL_TOP_SOURCES}, + {"braveNewsChannel-US News", IDS_BRAVE_NEWS_CHANNEL_US_NEWS}, + {"braveNewsChannel-Weather", IDS_BRAVE_NEWS_CHANNEL_WEATHER}, + {"braveNewsChannel-World News", + IDS_BRAVE_NEWS_CHANNEL_WORLD_NEWS}, + + {"addWidget", IDS_BRAVE_NEW_TAB_WIDGET_ADD}, + {"hideWidget", IDS_BRAVE_NEW_TAB_WIDGET_HIDE}, + {"rewardsWidgetDesc", IDS_BRAVE_NEW_TAB_REWARDS_WIDGET_DESC}, + {"cardsToggleTitle", IDS_BRAVE_NEW_TAB_CARDS_TITLE}, + {"cardsToggleDesc", IDS_BRAVE_NEW_TAB_CARDS_DESC}, + {"editCardsTitle", IDS_EDIT_CARDS_TITLE}, + {"braveRewardsTitle", IDS_BRAVE_NEW_TAB_BRAVE_REWARDS_TITLE}, +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) + // Private Tab - General + {"learnMore", IDS_BRAVE_PRIVATE_NEW_TAB_LEARN_MORE}, + {"done", IDS_BRAVE_PRIVATE_NEW_TAB_DONE}, + {"headerLabel", IDS_BRAVE_PRIVATE_NEW_TAB_THIS_IS_A}, + + // Private Tab - Header Private Window + {"headerTitle", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW}, + {"headerText", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC}, + {"headerText1", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC1}, + {"headerText2", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_DESC2}, + {"headerButton", + IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_BUTTON}, + + // Private Tab - Header Private Window with Tor + {"headerTorTitle", IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_TOR}, + {"headerTorText", + IDS_BRAVE_PRIVATE_NEW_TAB_PRIVATE_WINDOW_TOR_DESC}, + + // Private Tab - Box for DDG + {"boxDdgButton", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_DDG_BUTTON}, + + // Private Tab - Box for Tor + {"boxTorLabel", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_LABEL}, + {"boxTorLabel2", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_LABEL_2}, + {"boxTorTitle", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TITLE}, + + // Private Tab - Private Window with Tor - Tor Box + {"boxTorText", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TEXT_1}, + + // Private Tab - Private Window - Tor Box + {"boxTorText2", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_TEXT_2}, + {"boxTorButton", IDS_BRAVE_PRIVATE_NEW_TAB_BOX_TOR_BUTTON}, +#endif // !BUILDFLAG(IS_ANDROID) + + // Brave Talk shortcut + {"braveTalkPromptTitle", IDS_BRAVE_TALK_PROMPT_TITLE}, + + // Rewards widget + {"rewardsAboutRewards", IDS_REWARDS_WIDGET_ABOUT_REWARDS}, + {"rewardsAdGrantAmount", IDS_REWARDS_WIDGET_AD_GRANT_AMOUNT}, + {"rewardsAdGrantTitle", IDS_REWARDS_WIDGET_AD_GRANT_TITLE}, + {"rewardsBraveRewards", IDS_REWARDS_WIDGET_BRAVE_REWARDS}, + {"rewardsClaimRewards", IDS_REWARDS_WIDGET_CLAIM_REWARDS}, + {"rewardsClaimTokens", IDS_REWARDS_WIDGET_CLAIM_TOKENS}, + {"rewardsConnectAccount", IDS_REWARDS_CONNECT_ACCOUNT}, + {"rewardsConnectAccountNoProviders", + IDS_REWARDS_CONNECT_ACCOUNT_NO_PROVIDERS}, + {"rewardsConnectAccountText", IDS_REWARDS_CONNECT_ACCOUNT_TEXT}, + {"rewardsContinue", IDS_REWARDS_WIDGET_CONTINUE}, + {"rewardsEarningsTitle", IDS_REWARDS_ESTIMATED_EARNINGS_TITLE}, + {"rewardsEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT}, + {"rewardsHowDoesItWork", IDS_REWARDS_WIDGET_HOW_DOES_IT_WORK}, + {"rewardsGrantDaysRemaining", + IDS_REWARDS_WIDGET_GRANT_DAYS_REMAINING}, + {"rewardsLearnMore", IDS_REWARDS_LEARN_MORE}, + {"rewardsManageAds", IDS_REWARDS_WALLET_MANAGE_ADS}, + {"rewardsOptInHeader", IDS_REWARDS_WIDGET_OPT_IN_HEADER}, + {"rewardsOptInTerms", IDS_BRAVE_REWARDS_ONBOARDING_TERMS}, + {"rewardsOptInText", IDS_REWARDS_WIDGET_OPT_IN_TEXT}, + {"rewardsLogInToSeeBalance", IDS_REWARDS_LOG_IN_TO_SEE_BALANCE}, + {"rewardsPaymentCheckStatus", IDS_REWARDS_PAYMENT_CHECK_STATUS}, + {"rewardsPaymentCompleted", IDS_REWARDS_PAYMENT_COMPLETED}, + {"rewardsPaymentPending", IDS_REWARDS_PAYMENT_PENDING}, + {"rewardsPaymentProcessing", IDS_REWARDS_PAYMENT_PROCESSING}, + {"rewardsPaymentSupport", IDS_REWARDS_PAYMENT_SUPPORT}, + {"rewardsSelectCountryHeader", + IDS_REWARDS_WIDGET_SELECT_COUNTRY_HEADER}, + {"rewardsSelectCountryText", + IDS_REWARDS_WIDGET_SELECT_COUNTRY_TEXT}, + {"rewardsSettings", IDS_REWARDS_WIDGET_SETTINGS}, + {"rewardsStartUsingRewards", + IDS_REWARDS_WIDGET_START_USING_REWARDS}, + {"rewardsBalanceTitle", IDS_REWARDS_WIDGET_BALANCE_TITLE}, + {"rewardsTokenGrantTitle", IDS_REWARDS_WIDGET_TOKEN_GRANT_TITLE}, + {"rewardsWidgetBraveRewards", IDS_BRAVE_UI_BRAVE_REWARDS}, + {"rewardsBrowserCannotReceiveAds", + IDS_REWARDS_BROWSER_CANNOT_RECEIVE_ADS}, + {"rewardsBrowserNeedsUpdateToSeeAds", + IDS_REWARDS_BROWSER_NEEDS_UPDATE_TO_SEE_ADS}, + {"rewardsUnsupportedRegionNoticeHeader", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_HEADER}, + {"rewardsUnsupportedRegionNoticeSubheader", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_SUBHEADER}, + {"rewardsUnsupportedRegionNoticeLearnMore", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_LEARN_MORE}, + {"rewardsUnsupportedRegionNoticeText1", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_1}, + {"rewardsUnsupportedRegionNoticeText2", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_2}, + {"rewardsVBATNoticeText1", IDS_REWARDS_VBAT_NOTICE_TEXT1}, + {"rewardsVBATNoticeText2", IDS_REWARDS_VBAT_NOTICE_TEXT2}, + {"rewardsVBATNoticeTitle1", IDS_REWARDS_VBAT_NOTICE_TITLE1}, + {"rewardsVBATNoticeTitle2", IDS_REWARDS_VBAT_NOTICE_TITLE2}, + + {"loading", IDS_BRAVE_REWARDS_LOADING_LABEL}, + + // Brave Talk Widget + {"braveTalkWidgetTitle", IDS_BRAVE_TALK_WIDGET_TITLE}, + {"braveTalkWidgetWelcomeTitle", + IDS_BRAVE_TALK_WIDGET_WELCOME_TITLE}, + {"braveTalkWidgetStartButton", + IDS_BRAVE_TALK_WIDGET_START_BUTTON}, + {"braveTalkWidgetAboutData", IDS_BRAVE_TALK_WIDGET_ABOUT_DATA}, + }}, + {"wallet", + {{"cryptoWalletsWelcome", IDS_BRAVE_WALLET_WELCOME}, + {"cryptoWalletsDisclosureOne", IDS_BRAVE_WALLET_DISCLOSURE_ONE}, + {"cryptoWalletsDisclosureTwo", IDS_BRAVE_WALLET_DISCLOSURE_TWO}, + {"cryptoWalletsDisclosureThree", IDS_BRAVE_WALLET_DISCLOSURE_THREE}, + {"cryptoWalletsDisclosureFour", IDS_BRAVE_WALLET_DISCLOSURE_FOUR}, + {"cryptoWalletsBraveRewards", IDS_BRAVE_WALLET_BRAVE_REWARDS}, + {"cryptoWalletsDownloading", IDS_BRAVE_WALLET_DOWNLOADING}, + {"cryptoWalletsDisclosureConfirm", + IDS_BRAVE_WALLET_DISCLOSURE_CONFIRM}}}, + {"rewards", + { + {"adsCurrentEarnings", + IDS_BRAVE_REWARDS_LOCAL_ADS_CURRENT_EARNINGS}, + {"adsDescription", IDS_BRAVE_REWARDS_LOCAL_ADS_DESCRIPTION}, + {"adsDescriptionEarn", + IDS_BRAVE_REWARDS_LOCAL_ADS_DESCRIPTION_EARN}, + {"adsTotalReceivedLabel", + IDS_BRAVE_REWARDS_LOCAL_ADS_TOTAL_RECEIVED}, + {"adsNotSupportedRegion", + IDS_BRAVE_REWARDS_LOCAL_ADS_NOT_SUPPORTED_REGION}, + {"adsNotSupportedDevice", + IDS_BRAVE_REWARDS_LOCAL_ADS_NOT_SUPPORTED_DEVICE}, + {"adsPaymentDate", IDS_BRAVE_REWARDS_LOCAL_ADS_PAYMENT_DATE}, + {"adsPerHour", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR}, + {"adsPerHour0", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_0}, + {"adsPerHour1", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_1}, + {"adsPerHour2", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_2}, + {"adsPerHour3", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_3}, + {"adsPerHour4", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_4}, + {"adsPerHour5", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_5}, + {"adsPerHour10", IDS_BRAVE_REWARDS_LOCAL_ADS_PER_HOUR_10}, + {"adsSubdivisionTargetingTitle", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_TITLE}, + {"adsSubdivisionTargetingDescription", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DESCRIPTION}, + {"adsSubdivisionTargetingLearn", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_LEARN}, + {"adsSubdivisionTargetingAutoDetectedAs", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_AUTO_DETECTED_AS}, + {"adsSubdivisionTargetingAutoDetect", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_AUTO_DETECT}, + {"adsSubdivisionTargetingDisable", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DISABLE}, + {"adsSubdivisionTargetingDisabled", + IDS_BRAVE_REWARDS_LOCAL_ADS_SUBDIVISION_TARGETING_DISABLED}, + {"adsTitle", IDS_BRAVE_REWARDS_LOCAL_ADS_TITLE}, + {"newTabAdCountLabel", IDS_BRAVE_REWARDS_NEW_TAB_AD_COUNT_LABEL}, + {"notificationAdCountLabel", + IDS_BRAVE_REWARDS_NOTIFICATION_AD_COUNT_LABEL}, + {"newsAdCountLabel", IDS_BRAVE_REWARDS_NEWS_AD_COUNT_LABEL}, + {"newsAdInfo", IDS_BRAVE_REWARDS_NEWS_AD_INFO}, + {"newsAdInfoDisabled", IDS_BRAVE_REWARDS_NEWS_AD_INFO_DISABLED}, + {"appErrorTitle", IDS_REWARDS_APP_ERROR_TITLE}, + + {"bat", IDS_BRAVE_UI_BAT_REWARDS_TEXT}, + {"contributionTitle", IDS_BRAVE_REWARDS_LOCAL_CONTR_TITLE}, + {"contributionDesc", IDS_BRAVE_REWARDS_LOCAL_CONTR_DESC}, + {"contributionMonthly", IDS_BRAVE_REWARDS_LOCAL_CONTR_MONTHLY}, + {"contributionNextDate", + IDS_BRAVE_REWARDS_LOCAL_CONTR_NEXT_DATE}, + {"contributionSites", IDS_BRAVE_REWARDS_LOCAL_CONTR_SITES}, + {"contributionVisitSome", + IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_SOME}, + {"contributionMinTime", IDS_BRAVE_REWARDS_LOCAL_CONTR_MIN_TIME}, + {"contributionMinVisits", + IDS_BRAVE_REWARDS_LOCAL_CONTR_MIN_VISITS}, + {"contributionOther", IDS_BRAVE_REWARDS_LOCAL_CONTR_OTHER}, + {"contributionVisit1", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_1}, + {"contributionVisit5", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_5}, + {"contributionVisit10", IDS_BRAVE_REWARDS_LOCAL_CONTR_VISIT_10}, + {"contributionTime5", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_5}, + {"contributionTime8", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_8}, + {"contributionTime60", IDS_BRAVE_REWARDS_LOCAL_CONTR_TIME_60}, + {"contributionUpTo", IDS_BRAVE_REWARDS_LOCAL_CONTR_UP_TO}, + + {"disconnectWalletFailed", + IDS_BRAVE_REWARDS_LOCAL_SERVER_DISCONNECT_FAILED}, + {"donationTitle", IDS_BRAVE_REWARDS_LOCAL_DONAT_TITLE}, + {"donationDesc", IDS_BRAVE_REWARDS_LOCAL_DONAT_DESC}, + {"donationDescLearnMore", + IDS_BRAVE_REWARDS_LOCAL_DONAT_DESC_LEARN_MORE}, + {"donationTotalDonations", + IDS_BRAVE_REWARDS_LOCAL_DONAT_TOTAL_DONATIONS}, + {"donationVisitSome", IDS_BRAVE_REWARDS_LOCAL_DONAT_VISIT_SOME}, + {"monthlyTipsTitle", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_TITLE}, + {"monthlyTipsDesc", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_DESC}, + {"monthlyTipsEmpty", IDS_BRAVE_REWARDS_LOCAL_MONTHLY_TIPS_EMPTY}, + {"nextContribution", IDS_BRAVE_REWARDS_LOCAL_NEXT_CONTRIBUTION}, + {"redirectModalError", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_ERROR}, + {"redirectModalClose", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_CLOSE}, + {"redirectModalDeviceLimitReachedText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_DEVICE_LIMIT_REACHED_TEXT}, + {"redirectModalDeviceLimitReachedTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_DEVICE_LIMIT_REACHED_TITLE}, + {"redirectModalFlaggedWalletText1", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_1}, + {"redirectModalFlaggedWalletText2", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_2}, + {"redirectModalFlaggedWalletText3", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_3}, + {"redirectModalFlaggedWalletText4", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TEXT_4}, + {"redirectModalFlaggedWalletTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_FLAGGED_WALLET_TITLE}, + {"redirectModalKYCRequiredTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_KYC_REQUIRED_TITLE}, + {"redirectModalKYCRequiredText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_KYC_REQUIRED_TEXT}, + {"redirectModalMismatchedCountriesText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_COUNTRIES_TEXT}, + {"redirectModalMismatchedCountriesTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_COUNTRIES_TITLE}, + {"redirectModalMismatchedProviderAccountsText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_PROVIDER_ACCOUNTS_TEXT}, + {"redirectModalMismatchedProviderAccountsTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_MISMATCHED_PROVIDER_ACCOUNTS_TITLE}, + {"redirectModalProviderUnavailableText1", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TEXT_1}, + {"redirectModalProviderUnavailableText2", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TEXT_2}, + {"redirectModalProviderUnavailableTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_PROVIDER_UNAVAILABLE_TITLE}, + {"redirectModalRegionNotSupportedText1", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TEXT_1}, + {"redirectModalRegionNotSupportedText2", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TEXT_2}, + {"redirectModalRegionNotSupportedTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_REGION_NOT_SUPPORTED_TITLE}, + {"redirectModalUpholdBATNotAllowedText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_BAT_NOT_ALLOWED_TEXT}, + {"redirectModalUpholdBATNotAllowedTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_BAT_NOT_ALLOWED_TITLE}, + {"redirectModalUpholdInsufficientCapabilitiesText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_INSUFFICIENT_CAPABILITIES_TEXT}, + {"redirectModalUpholdInsufficientCapabilitiesTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_UPHOLD_INSUFFICIENT_CAPABILITIES_TITLE}, + {"redirectModalWalletOwnershipVerificationFailureText", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_WALLET_OWNERSHIP_VERIFICATION_FAILURE_TEXT}, + {"redirectModalWalletOwnershipVerificationFailureTitle", + IDS_BRAVE_REWARDS_LOCAL_REDIRECT_MODAL_WALLET_OWNERSHIP_VERIFICATION_FAILURE_TITLE}, + {"tosAndPp", IDS_BRAVE_REWARDS_LOCAL_TOS_AND_PP}, + + {"click", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_CLICK}, + {"dismiss", + IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_DISMISS}, + {"landed", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_LANDED}, + {"view", IDS_BRAVE_REWARDS_LOCAL_ADS_CONFIRMATION_TYPE_VIEW}, + + {"rewardsBrowserCannotReceiveAds", + IDS_REWARDS_BROWSER_CANNOT_RECEIVE_ADS}, + {"rewardsBrowserNeedsUpdateToSeeAds", + IDS_REWARDS_BROWSER_NEEDS_UPDATE_TO_SEE_ADS}, + + {"activityCopy", IDS_BRAVE_UI_ACTIVITY_COPY}, + {"activityNote", IDS_BRAVE_UI_ACTIVITY_NOTE}, + {"ads", IDS_BRAVE_UI_ADS}, + {"adsCurrentlyViewing", IDS_BRAVE_UI_ADS_CURRENTLY_VIEWING}, + {"adsHistoryNone", IDS_BRAVE_UI_ADS_HISTORY_NONE}, + {"adsHistorySubTitle", IDS_BRAVE_UI_ADS_HISTORY_SUBTITLE}, + {"adsHistoryTitle", IDS_BRAVE_UI_ADS_HISTORY_TITLE}, + {"adsGrantReceived", IDS_BRAVE_UI_ADS_GRANT_RECEIVED}, + {"all", IDS_BRAVE_UI_ADS_ALL}, + {"amount", IDS_BRAVE_UI_AMOUNT}, + {"autoContribute", IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TITLE}, + {"autoContributeTransaction", + IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TRANSACTION}, + {"braveRewards", IDS_BRAVE_UI_BRAVE_REWARDS}, + {"cancel", IDS_BRAVE_UI_CANCEL}, + {"captchaDrag", IDS_BRAVE_UI_CAPTCHA_DRAG}, + {"captchaTarget", IDS_BRAVE_UI_CAPTCHA_TARGET}, + {"category", IDS_BRAVE_UI_ADS_CATEGORY}, + {"claim", IDS_BRAVE_UI_CLAIM}, + {"contribute", IDS_BRAVE_UI_CONTRIBUTE}, + {"date", IDS_BRAVE_UI_DATE}, + {"deposits", IDS_BRAVE_UI_DEPOSITS}, + {"description", IDS_BRAVE_UI_DESCRIPTION}, + {"donation", IDS_BRAVE_UI_DONATION}, + {"done", IDS_BRAVE_UI_DONE}, + {"earningsAds", IDS_BRAVE_UI_EARNINGS_ADS}, + {"earningsViewDepositHistory", + IDS_BRAVE_UI_EARNINGS_VIEW_DEPOSIT_HISTORY}, + {"excludeSite", IDS_BRAVE_UI_EXCLUDE_SITE}, + {"excludedSitesText", IDS_BRAVE_UI_EXCLUDED_SITES}, + {"grantDisclaimer", IDS_BRAVE_UI_GRANT_DISCLAIMER}, + {"grantTitleUGP", IDS_BRAVE_UI_GRANT_TITLE_UGP}, + {"grantSubtitleUGP", IDS_BRAVE_UI_GRANT_SUBTITLE_UGP}, + {"grantAmountTitleUGP", IDS_BRAVE_UI_GRANT_AMOUNT_TITLE_UGP}, + {"grantDateTitleUGP", IDS_BRAVE_UI_GRANT_DATE_TITLE_UGP}, + {"grantTitleAds", IDS_BRAVE_UI_GRANT_TITLE_ADS}, + {"grantSubtitleAds", IDS_BRAVE_UI_GRANT_SUBTITLE_ADS}, + {"grantAmountTitleAds", IDS_BRAVE_UI_GRANT_AMOUNT_TITLE_ADS}, + {"grantDateTitleAds", IDS_BRAVE_UI_GRANT_DATE_TITLE_ADS}, + {"grantExpire", IDS_BRAVE_UI_GRANT_EXPIRE}, + {"import", IDS_BRAVE_UI_IMPORT}, + {"learnMore", IDS_BRAVE_UI_LEARN_MORE}, + {"markAsInappropriate", IDS_BRAVE_UI_ADS_MARK_AS_INAPPROPRIATE}, + {"markAsInappropriateChecked", + IDS_BRAVE_UI_ADS_MARK_AS_INAPPROPRIATE_CHECKED}, + {"monthlyTipsBang", IDS_BRAVE_UI_MONTHLY_TIPS_BANG}, + {"monthlyTips", IDS_BRAVE_UI_MONTHLY_TIPS}, + {"noActivity", IDS_BRAVE_UI_NO_ACTIVITY}, + {"noAdsHistory", IDS_BRAVE_UI_ADS_NO_ADS_HISTORY}, + {"off", IDS_BRAVE_UI_OFF}, + {"ok", IDS_BRAVE_UI_OK}, + {"on", IDS_BRAVE_UI_ON}, + {"onboardingEarnHeader", + IDS_BRAVE_REWARDS_ONBOARDING_EARN_HEADER}, + {"onboardingEarnText", IDS_BRAVE_REWARDS_ONBOARDING_EARN_TEXT}, + {"onboardingStartUsingRewards", + IDS_BRAVE_REWARDS_ONBOARDING_START_USING_REWARDS}, + {"onboardingStartUsingRewardsTextOnly", + IDS_BRAVE_REWARDS_ONBOARDING_START_USING_REWARDS_TEXT_ONLY}, + {"onboardingTerms", IDS_BRAVE_REWARDS_ONBOARDING_TERMS}, + {"oneTimeDonation", IDS_BRAVE_UI_ONE_TIME_DONATION}, + {"openAdsHistory", IDS_BRAVE_UI_OPEN_ADS_HISTORY}, + {"optOutTooltip", IDS_BRAVE_UI_ADS_OPT_OUT_TOOLTIP}, + {"payment", IDS_BRAVE_UI_PAYMENT}, + {"pinnedSitesHeader", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_HEADER}, + {"pinnedSitesMsg", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_MSG}, + {"pinnedSitesOne", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_ONE}, + {"pinnedSitesTwo", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_TWO}, + {"pinnedSitesThree", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_THREE}, + {"pinnedSitesFour", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_FOUR}, + {"pleaseNote", IDS_BRAVE_UI_PLEASE_NOTE}, + {"print", IDS_BRAVE_UI_PRINT}, + {"processingRequest", IDS_BRAVE_UI_PROCESSING_REQUEST}, + {"processingRequestButton", + IDS_BRAVE_UI_PROCESSING_REQUEST_BUTTON}, + {"processorBraveTokens", IDS_BRAVE_UI_PROCESSOR_BRAVE_TOKENS}, + {"processorUphold", IDS_BRAVE_UI_PROCESSOR_UPHOLD}, + {"processorBitflyer", IDS_BRAVE_UI_PROCESSOR_BITFLYER}, + {"processorGemini", IDS_BRAVE_UI_PROCESSOR_GEMINI}, + {"recurring", IDS_BRAVE_UI_RECURRING}, + {"recurringDonations", IDS_BRAVE_UI_RECURRING_DONATIONS}, + {"relaunch", IDS_BRAVE_UI_RELAUNCH}, + {"remove", IDS_BRAVE_UI_REMOVE}, + {"removeAdFromSaved", IDS_BRAVE_UI_REMOVE_AD_FROM_SAVED}, + {"reset", IDS_BRAVE_UI_RESET}, + {"resetWallet", IDS_BRAVE_UI_RESET_WALLET}, + {"clearExcludeList", IDS_BRAVE_UI_CLEAR_EXCLUDE_LIST}, + {"reviewSitesMsg", IDS_BRAVE_UI_REVIEW_SITE_MSG}, + {"rewardsAdGrantAmount", IDS_REWARDS_WIDGET_AD_GRANT_AMOUNT}, + {"rewardsAdGrantTitle", IDS_REWARDS_WIDGET_AD_GRANT_TITLE}, + {"rewardsClaimRewards", IDS_REWARDS_WIDGET_CLAIM_REWARDS}, + {"rewardsClaimTokens", IDS_REWARDS_WIDGET_CLAIM_TOKENS}, + {"rewardsConnectAccount", IDS_REWARDS_CONNECT_ACCOUNT}, + {"rewardsContribute", IDS_BRAVE_UI_REWARDS_CONTRIBUTE}, + {"rewardsContributeAttention", + IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION}, + {"rewardsGrantDaysRemaining", + IDS_REWARDS_WIDGET_GRANT_DAYS_REMAINING}, + {"rewardsLearnMore", IDS_REWARDS_LEARN_MORE}, + {"rewardsLogInToSeeBalance", IDS_REWARDS_LOG_IN_TO_SEE_BALANCE}, + {"rewardsPaymentCheckStatus", IDS_REWARDS_PAYMENT_CHECK_STATUS}, + {"rewardsPaymentCompleted", IDS_REWARDS_PAYMENT_COMPLETED}, + {"rewardsPaymentPending", IDS_REWARDS_PAYMENT_PENDING}, + {"rewardsPaymentProcessing", IDS_REWARDS_PAYMENT_PROCESSING}, + {"rewardsPaymentSupport", IDS_REWARDS_PAYMENT_SUPPORT}, + {"rewardsResetConsent", IDS_BRAVE_UI_REWARDS_RESET_CONSENT}, + {"rewardsResetText", IDS_BRAVE_UI_REWARDS_RESET_TEXT}, + {"rewardsTokenGrantTitle", IDS_REWARDS_WIDGET_TOKEN_GRANT_TITLE}, + {"rewardsSummary", IDS_BRAVE_UI_REWARDS_SUMMARY}, + {"rewardsVBATNoticeText1", IDS_REWARDS_VBAT_NOTICE_TEXT1}, + {"rewardsVBATNoticeText2", IDS_REWARDS_VBAT_NOTICE_TEXT2}, + {"rewardsVBATNoticeTitle1", IDS_REWARDS_VBAT_NOTICE_TITLE1}, + {"rewardsVBATNoticeTitle2", IDS_REWARDS_VBAT_NOTICE_TITLE2}, + {"saved", IDS_BRAVE_UI_ADS_SAVED}, + {"saveAd", IDS_BRAVE_UI_ADS_SAVE_AD}, + {"seeAllItems", IDS_BRAVE_UI_SEE_ALL_ITEMS}, + {"sendTip", IDS_BRAVE_UI_SEND_TIP}, + {"settings", IDS_BRAVE_UI_SETTINGS}, + {"site", IDS_BRAVE_UI_SITE}, + {"tipOnLike", IDS_BRAVE_UI_TIP_ON_LIKE}, + {"tokenGrantReceived", IDS_BRAVE_UI_TOKEN_GRANT_RECEIVED}, + {"token", IDS_BRAVE_UI_TOKEN}, + {"tokens", IDS_BRAVE_UI_TOKENS}, + {"total", IDS_BRAVE_UI_TOTAL}, + {"transactions", IDS_BRAVE_UI_TRANSACTIONS}, + {"type", IDS_BRAVE_UI_TYPE}, + {"unsupportedRegionNoticeHeader", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_HEADER}, + {"unsupportedRegionNoticeSubheader", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_SUBHEADER}, + {"unsupportedRegionNoticeLearnMore", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_LEARN_MORE}, + {"unsupportedRegionNoticeText1", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_1}, + {"unsupportedRegionNoticeText2", + IDS_BRAVE_REWARDS_UNSUPPORTED_REGION_NOTICE_TEXT_2}, + {"verifiedPublisher", IDS_BRAVE_UI_VERIFIED_PUBLISHER}, + {"viewDetails", IDS_BRAVE_UI_VIEW_DETAILS}, + {"viewMonthly", IDS_BRAVE_UI_VIEW_MONTHLY}, + {"walletActivity", IDS_BRAVE_UI_WALLET_ACTIVITY}, + {"walletBalance", IDS_BRAVE_UI_WALLET_BALANCE}, + {"yourWallet", IDS_BRAVE_UI_YOUR_WALLET}, + + {"excludedSites", IDS_BRAVE_UI_EXCLUDED_SITES_TEXT}, + {"removeFromExcluded", IDS_BRAVE_UI_REMOVE_FROM_EXCLUDED}, + {"rewardsExcludedText1", IDS_BRAVE_UI_REWARDS_EXCLUDED_TEXT_1}, + {"rewardsExcludedText2", IDS_BRAVE_UI_REWARDS_EXCLUDED_TEXT_2}, + {"showAll", IDS_BRAVE_UI_SHOW_ALL}, + {"viewedSites", IDS_BRAVE_UI_VIEWED_SITES}, + + {"promoLearnMore", IDS_BRAVE_UI_PROMO_LEARN_MORE}, + {"promoDismiss", IDS_BRAVE_UI_PROMO_DISMISS}, + + {"bitflyerVerificationPromoTitle", + IDS_BRAVE_UI_BITFLYER_VERIFICATION_PROMO_TITLE}, + {"bitflyerVerificationPromoInfo", + IDS_BRAVE_UI_BITFLYER_VERIFICATION_PROMO_INFO}, + + {"braveCreatorsPromoTitle", + IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_TITLE}, + {"braveCreatorsPromoInfo1", + IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_INFO_1}, + {"braveCreatorsPromoInfo2", + IDS_BRAVE_UI_BRAVE_CREATORS_PROMO_INFO_2}, + + {"tapNetworkTitle", IDS_BRAVE_UI_TAP_NETWORK_TITLE}, + {"tapNetworkInfo", IDS_BRAVE_UI_TAP_NETWORK_INFO}, + {"tapNetworkDisclaimer", IDS_BRAVE_UI_TAP_NETWORK_DISCLAIMER}, + + {"upholdPromoTitle", IDS_BRAVE_UI_UPHOLD_PROMO_TITLE}, + {"upholdPromoInfo", IDS_BRAVE_UI_UPHOLD_PROMO_INFO}, + + {"connectAccountNoProviders", + IDS_REWARDS_CONNECT_ACCOUNT_NO_PROVIDERS}, + {"connectAccountText", IDS_REWARDS_CONNECT_ACCOUNT_TEXT}, + {"learnMore", IDS_REWARDS_LEARN_MORE}, + {"connectWalletCustodialHeader", + IDS_BRAVE_REWARDS_CONNECT_WALLET_CUSTODIAL_HEADER}, + {"connectWalletCustodialTooltip", + IDS_BRAVE_REWARDS_CONNECT_WALLET_CUSTODIAL_TOOLTIP}, + {"connectWalletHeader", IDS_BRAVE_REWARDS_CONNECT_WALLET_HEADER}, + {"connectWalletLearnMore", + IDS_BRAVE_REWARDS_CONNECT_WALLET_LEARN_MORE}, + {"connectWalletProviderNotAvailable", + IDS_BRAVE_REWARDS_CONNECT_WALLET_PROVIDER_NOT_AVAILABLE}, + {"connectWalletText", IDS_BRAVE_REWARDS_CONNECT_WALLET_TEXT}, + {"contributionPendingUntil", + IDS_BRAVE_REWARDS_CONTRIBUTION_PENDING_UNTIL}, + + {"walletAccountLink", IDS_REWARDS_WALLET_ACCOUNT_LINK}, + {"walletAutoContribute", IDS_REWARDS_WALLET_AUTO_CONTRIBUTE}, + {"walletDisconnected", IDS_REWARDS_WALLET_DISCONNECTED}, + {"walletEstimatedEarnings", + IDS_REWARDS_ESTIMATED_EARNINGS_TITLE}, + {"walletLogIntoYourAccount", + IDS_REWARDS_WALLET_LOG_INTO_YOUR_ACCOUNT}, + {"walletMonthlyTips", IDS_REWARDS_WALLET_MONTHLY_TIPS}, + {"walletOneTimeTips", IDS_REWARDS_WALLET_ONE_TIME_TIPS}, + {"walletRewardsFromAds", IDS_REWARDS_WALLET_REWARDS_FROM_ADS}, + {"walletRewardsSummary", IDS_REWARDS_WALLET_REWARDS_SUMMARY}, + {"walletUnverified", IDS_REWARDS_WALLET_UNVERIFIED}, + {"walletViewStatement", IDS_REWARDS_WALLET_VIEW_STATEMENT}, + {"walletVerified", IDS_REWARDS_WALLET_VERIFIED}, + {"walletBalanceTitle", IDS_REWARDS_WALLET_BALANCE_TITLE}, + {"walletEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT}, + + {"loading", IDS_BRAVE_REWARDS_LOADING_LABEL}, + }}, + {"adblock", + { + {"additionalFiltersTitle", IDS_ADBLOCK_ADDITIONAL_FILTERS_TITLE}, + {"additionalFiltersWarning", + IDS_ADBLOCK_ADDITIONAL_FILTERS_WARNING}, + {"adsBlocked", IDS_ADBLOCK_TOTAL_ADS_BLOCKED}, + {"customFiltersTitle", IDS_ADBLOCK_CUSTOM_FILTERS_TITLE}, + {"customFiltersInstructions", + IDS_ADBLOCK_CUSTOM_FILTERS_INSTRUCTIONS}, + {"customListSubscriptionsTitle", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TITLE}, + {"customListSubscriptionsInstructions", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_INSTRUCTIONS}, + {"customListSubscriptionsDisclaimer", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_DISCLAIMER}, + + {"customListSubscriptionsEnterSubscriptionUrlPlaceholder", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_ENTER_SUBSCRIPTION_URL_PLACEHOLDER}, + {"customListSubscriptionsSubmitNewSubscription", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_SUBMIT_NEW_SUBSCRIPTION}, + {"customListSubscriptionsCancelAddSubscription", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_CANCEL_ADD_SUBSCRIPTION}, + {"customListSubscriptionsAddNewFilterList", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_ADD_NEW_FILTER_LIST}, + {"customListSubscriptionsTableFilterListColumn", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TABLE_FILTER_LIST_COLUMN}, + {"customListSubscriptionsTableLastUpdatedColumn", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TABLE_LAST_UPDATED_COLUMN}, + {"customListSubscriptionsTriggerUpdate", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_TRIGGER_UPDATE}, + {"customListSubscriptionsViewListSource", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_VIEW_LIST_SOURCE}, + {"customListSubscriptionsUnsubscribe", + IDS_ADBLOCK_CUSTOM_LIST_SUBSCRIPTIONS_UNSUBSCRIBE}, + }}, + { +#if BUILDFLAG(ENABLE_IPFS_INTERNALS_WEBUI) + "ipfs-internals", + {{"connectedPeersTitle", IDS_IPFS_CONNECTED_PEERS_TITLE}, + {"addressesConfigTitle", IDS_IPFS_ADDRESSES_CONFIG_TITLE}, + {"repoStatsTitle", IDS_IPFS_REPO_STATS_TITLE}, + {"daemonStatusTitle", IDS_IPFS_DAEMON_STATUS_TITLE}, + {"api", IDS_IPFS_API}, + {"gateway", IDS_IPFS_GATEWAY}, + {"swarm", IDS_IPFS_SWARM}, + {"objects", IDS_IPFS_REPO_OBJECTS}, + {"size", IDS_IPFS_REPO_SIZE}, + {"storage", IDS_IPFS_REPO_STORAGE}, + {"path", IDS_IPFS_REPO_PATH}, + {"version", IDS_IPFS_REPO_VERSION}, + {"launched", IDS_IPFS_LAUNCHED}, + {"notLaunched", IDS_IPFS_NOT_LAUNCHED}, + {"launch", IDS_IPFS_LAUNCH}, + {"shutdown", IDS_IPFS_SHUTDOWN}, + {"notInstalled", IDS_IPFS_NOT_INSTALLED}, + {"nodeInfoTitle", IDS_IPFS_NODE_INFO_TITLE}, + {"id", IDS_IPFS_NODE_INFO_ID}, + {"agentVersion", IDS_IPFS_NODE_INFO_VERSION}, + {"restart", IDS_IPFS_RESTART}, + {"learnMore", IDS_IPFS_LEARN_MORE}, + {"installAndLaunch", IDS_IPFS_INSTALL_AND_LAUNCH}, + {"openWebUI", IDS_IPFS_OPEN_WEBUI}, + {"peerDetailsLink", IDS_IPFS_PEERS_DETAILS_LINK}, + {"installing", IDS_IPFS_INSTALLING}, + {"runGarbageCollectionTitle", IDS_IPFS_RUN_GC_BUTTON}, + {"gcError", IDS_IPFS_GC_ERROR}, + {"rotateIdentity", IDS_IPFS_ROTATE_IDENTITY_TITLE}}}, + { +#endif + "rewards-internals", + { + {"adDiagnosticId", + IDS_BRAVE_REWARDS_INTERNALS_AD_DIAGNOSTIC_ID}, + {"adDiagnosticInfo", + IDS_BRAVE_REWARDS_INTERNALS_AD_DIAGNOSTIC_INFO}, + {"adsNotInitialized", + IDS_BRAVE_REWARDS_INTERNALS_ADS_NOT_INITIALIZED}, + {"amount", IDS_BRAVE_REWARDS_INTERNALS_AMOUNT}, + {"autoRefresh", IDS_BRAVE_REWARDS_INTERNALS_AUTO_REFRESH}, + {"balanceInfo", IDS_BRAVE_REWARDS_INTERNALS_BALANCE_INFO}, + {"bat", IDS_BRAVE_UI_BAT_TEXT}, + {"bootStamp", IDS_BRAVE_REWARDS_INTERNALS_BOOT_STAMP}, + {"clearButton", IDS_BRAVE_REWARDS_INTERNALS_CLEAR_BUTTON}, + {"contributedAmount", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTED_AMOUNT}, + {"contributionCreatedAt", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTED_CREATED_AT}, + {"contribution", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION}, + {"contributionProcessor", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_PROCESSOR}, + {"contributionStep", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP}, + {"contributionStepAutoContributeTableEmpty", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_AUTO_CONTRIBUTE_TABLE_EMPTY}, + {"contributionStepNotEnoughFunds", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_NOT_ENOUGH_FUNDS}, + {"contributionStepFailed", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_FAILED}, + {"contributionStepCompleted", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_COMPLETED}, + {"contributionStepNo", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_NO}, + {"contributionStepStart", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_START}, + {"contributionStepPrepare", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_PREPARE}, + {"contributionStepReserve", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_RESERVE}, + {"contributionStepExternalTransaction", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_EXTERNAL_TRANSACTION}, + {"contributionStepCreds", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_CREDS}, + {"contributionStepRewardsOff", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_REWARDS_OFF}, + {"contributionStepAutoContributeOff", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_AUTO_CONTRIBUTE_OFF}, + {"contributionStepRetryCount", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_RETRY_COUNT}, + {"eventLogKey", IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_KEY}, + {"eventLogValue", + IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_VALUE}, + {"eventLogTime", IDS_BRAVE_REWARDS_INTERNALS_EVENT_LOG_TIME}, + {"mainDisclaimer", + IDS_BRAVE_REWARDS_INTERNALS_MAIN_DISCLAIMER}, + {"logDisclaimer", IDS_BRAVE_REWARDS_INTERNALS_LOG_DISCLAIMER}, + {"rewardsTypeAuto", + IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_AUTO}, + {"rewardsTypeOneTimeTip", + IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_ONE_TIME_TIP}, + {"rewardsTypeRecurringTip", + IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_RECURRING_TIP}, + {"contributionType", + IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_TYPE}, + {"contributions", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTIONS}, + {"custodian", IDS_BRAVE_REWARDS_INTERNALS_CUSTODIAN}, + {"custodianMemberId", + IDS_BRAVE_REWARDS_INTERNALS_CUSTODIAN_MEMBER_ID}, + {"downloadButton", + IDS_BRAVE_REWARDS_INTERNALS_DOWNLOAD_BUTTON}, + {"externalWallet", + IDS_BRAVE_REWARDS_INTERNALS_EXTERNAL_WALLET}, + {"invalid", IDS_BRAVE_REWARDS_INTERNALS_INVALID}, + {"keyInfoSeed", IDS_BRAVE_REWARDS_INTERNALS_KEY_INFO_SEED}, + {"logNotice", IDS_BRAVE_REWARDS_INTERNALS_LOG_NOTICE}, + {"mainTitle", IDS_BRAVE_REWARDS_INTERNALS_MAIN_TITLE}, + {"notSet", IDS_BRAVE_REWARDS_INTERNALS_NOT_SET}, + {"personaId", IDS_BRAVE_REWARDS_INTERNALS_PERSONA_ID}, + {"processorBraveTokens", IDS_BRAVE_UI_PROCESSOR_BRAVE_TOKENS}, + {"processorUphold", IDS_BRAVE_UI_PROCESSOR_UPHOLD}, + {"processorBitflyer", IDS_BRAVE_UI_PROCESSOR_BITFLYER}, + {"processorGemini", IDS_BRAVE_UI_PROCESSOR_GEMINI}, + {"processorZebPay", IDS_BRAVE_UI_PROCESSOR_ZEBPAY}, + {"promotionAds", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_ADS}, + {"promotionAmount", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_AMOUNT}, + {"promotionClaimedAt", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_CLAIMED_AT}, + {"promotionClaimId", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_CLAIM_ID}, + {"promotionExpiresAt", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_EXPIRES_AT}, + {"promotionId", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_ID}, + {"promotionLegacyClaimed", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_CLAIMED}, + {"promotionLegacyNo", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_NO}, + {"promotionLegacyYes", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_LEGACY_YES}, + {"promotions", IDS_BRAVE_REWARDS_INTERNALS_PROMOTIONS}, + {"promotionStatus", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS}, + {"promotionStatusActive", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_ACTIVE}, + {"promotionStatusAttested", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_ATTESTED}, + {"promotionStatusFinished", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_FINISHED}, + {"promotionStatusOver", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_STATUS_OVER}, + {"promotionType", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_TYPE}, + {"promotionUGP", IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_UGP}, + {"promotionVersion", + IDS_BRAVE_REWARDS_INTERNALS_PROMOTION_VERSION}, + {"refreshButton", IDS_BRAVE_REWARDS_INTERNALS_REFRESH_BUTTON}, + {"retryCount", IDS_BRAVE_REWARDS_INTERNALS_RETRY_COUNT}, + {"rewardsCountry", + IDS_BRAVE_REWARDS_INTERNALS_REWARDS_COUNTRY}, + {"tabAdDiagnostics", + IDS_BRAVE_REWARDS_INTERNALS_TAB_AD_DIAGNOSTICS}, + {"tabGeneralInfo", + IDS_BRAVE_REWARDS_INTERNALS_TAB_GENERAL_INFO}, + {"tabLogs", IDS_BRAVE_REWARDS_INTERNALS_TAB_LOGS}, + {"tabPromotions", IDS_BRAVE_REWARDS_INTERNALS_TAB_PROMOTIONS}, + {"tabContributions", + IDS_BRAVE_REWARDS_INTERNALS_TAB_CONTRIBUTIONS}, + {"tabEventLogs", IDS_BRAVE_REWARDS_INTERNALS_TAB_EVENT_LOGS}, + {"totalAmount", IDS_BRAVE_REWARDS_INTERNALS_TOTAL_AMOUNT}, + {"totalBalance", IDS_BRAVE_REWARDS_INTERNALS_TOTAL_BALANCE}, + {"userId", IDS_BRAVE_REWARDS_INTERNALS_USER_ID}, + {"valid", IDS_BRAVE_REWARDS_INTERNALS_VALID}, + {"walletAddress", IDS_BRAVE_REWARDS_INTERNALS_WALLET_ADDRESS}, + {"walletHistory", IDS_BRAVE_REWARDS_INTERNALS_WALLET_HISTORY}, + {"walletInfo", IDS_BRAVE_REWARDS_INTERNALS_WALLET_INFO}, + {"walletNotCreated", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_NOT_CREATED}, + {"walletPaymentId", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_PAYMENT_ID}, + {"walletStatus", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS}, + {"walletStatusNotConnected", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_NOT_CONNECTED}, + {"walletStatusVerified", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_VERIFIED}, + {"walletStatusDisconnectedVerified", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_DISCONNECTED_VERIFIED}, + {"walletCreationEnvironment", + IDS_BRAVE_REWARDS_INTERNALS_WALLET_CREATION_ENVIRONMENT}, + {"currentEnvironment", + IDS_BRAVE_REWARDS_INTERNALS_CURRENT_ENVIRONMENT}, + + {"loading", IDS_BRAVE_REWARDS_LOADING_LABEL}, + }}, + { +#if BUILDFLAG(ENABLE_TOR) + "tor-internals", + { + {"tabGeneralInfo", IDS_TOR_INTERNALS_TAB_GENERAL_INFO}, + {"tabLogs", IDS_TOR_INTERNALS_TAB_LOGS}, + {"torControlEvents", IDS_TOR_INTERNALS_TOR_CONTROL_EVENTS}, + {"torVersion", IDS_TOR_INTERNALS_TOR_VERSION}, + {"torPid", IDS_TOR_INTERNALS_TOR_PID}, + {"torProxyURI", IDS_TOR_INTERNALS_TOR_PROXY_URI}, + {"torConnectionStatus", + IDS_TOR_INTERNALS_TOR_CONNECTION_STATUS}, + {"torInitProgress", IDS_TOR_INTERNALS_TOR_INIT_PROGRESS}, + }}, + { +#endif +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) + "webcompat", + { + // Report modal + {"reportModalTitle", + IDS_BRAVE_WEBCOMPATREPORTER_REPORT_MODAL_TITLE}, + {"reportExplanation", + IDS_BRAVE_WEBCOMPATREPORTER_REPORT_EXPLANATION}, + {"reportDisclaimer", + IDS_BRAVE_WEBCOMPATREPORTER_REPORT_DISCLAIMER}, + {"reportDetails", IDS_BRAVE_WEBCOMPATREPORTER_REPORT_DETAILS}, + {"reportContactPlaceholder", + IDS_BRAVE_WEBCOMPATREPORTER_REPORT_CONTACT_PLACEHOLDER}, + {"reportContactLabel", + IDS_BRAVE_WEBCOMPATREPORTER_REPORT_CONTACT_LABEL}, + {"cancel", IDS_BRAVE_WEBCOMPATREPORTER_CANCEL}, + {"submit", IDS_BRAVE_WEBCOMPATREPORTER_SUBMIT}, + // Confirmation modal + {"thankYou", IDS_BRAVE_WEBCOMPATREPORTER_THANK_YOU}, + {"confirmationNotice", + IDS_BRAVE_WEBCOMPATREPORTER_CONFIRMATION_NOTICE}, + } +#endif + }, + }}; + + if (auto it = kLocalizedStrings->find(webui_name); + it != kLocalizedStrings->end()) { + return it->second; + } + return {}; +} // NOLINT (readability/fn_size) + +} // namespace brave diff --git a/components/webui/webui_resources.h b/components/webui/webui_resources.h new file mode 100644 index 000000000000..e4c7f5766755 --- /dev/null +++ b/components/webui/webui_resources.h @@ -0,0 +1,30 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_COMPONENTS_WEBUI_WEBUI_RESOURCES_H_ +#define BRAVE_COMPONENTS_WEBUI_WEBUI_RESOURCES_H_ + +#include + +#include "base/containers/span.h" + +namespace webui { + +struct LocalizedString; +struct ResourcePath; + +} // namespace webui + +namespace brave { + +base::span GetWebUIResources( + std::string_view webui_name); + +base::span GetWebUILocalizedStrings( + std::string_view webui_name); + +} // namespace brave + +#endif // BRAVE_COMPONENTS_WEBUI_WEBUI_RESOURCES_H_ diff --git a/ios/BUILD.gn b/ios/BUILD.gn index 9c2f6504fa9b..c0b3f06025f6 100644 --- a/ios/BUILD.gn +++ b/ios/BUILD.gn @@ -20,6 +20,7 @@ import("//brave/ios/browser/api/session_restore/headers.gni") import("//brave/ios/browser/api/skus/headers.gni") import("//brave/ios/browser/api/url/headers.gni") import("//brave/ios/browser/api/url_sanitizer/headers.gni") +import("//brave/ios/browser/api/web/ui/headers.gni") import("//brave/ios/browser/api/web/web_state/headers.gni") import("//brave/ios/browser/url_sanitizer/headers.gni") import("//build/config/compiler/compiler.gni") @@ -61,7 +62,6 @@ brave_core_public_headers = [ "//brave/ios/browser/api/password/brave_password_api.h", "//brave/ios/browser/api/password/brave_password_observer.h", "//brave/ios/browser/api/sync/brave_sync_api.h", - "//brave/ios/browser/api/sync/brave_sync_internals.h", "//brave/ios/browser/api/sync/driver/brave_sync_profile_service.h", "//brave/ios/browser/api/web_image/web_image.h", "//brave/ios/browser/keyed_service/keyed_service_factory_wrapper.h", @@ -87,6 +87,7 @@ brave_core_public_headers += brave_p3a_public_headers brave_core_public_headers += browser_api_web_webstate_public_headers brave_core_public_headers += ipfs_public_headers brave_core_public_headers += ntp_background_images_public_headers +brave_core_public_headers += browser_api_web_ui_public_headers action("brave_core_umbrella_header") { script = "//build/config/ios/generate_umbrella_header.py" diff --git a/ios/app/BUILD.gn b/ios/app/BUILD.gn index 5847b8002505..d55175143550 100644 --- a/ios/app/BUILD.gn +++ b/ios/app/BUILD.gn @@ -55,6 +55,7 @@ source_set("app") { "//brave/ios/browser/api/web_image", "//brave/ios/browser/component_updater", "//brave/ios/browser/skus", + "//brave/ios/browser/ui/webui", "//components/browser_sync", "//components/component_updater", "//components/component_updater/installer_policies", diff --git a/ios/app/brave_core_main.mm b/ios/app/brave_core_main.mm index 6612a2b8c0f0..02ad00799153 100644 --- a/ios/app/brave_core_main.mm +++ b/ios/app/brave_core_main.mm @@ -43,6 +43,7 @@ #include "brave/ios/browser/api/web_image/web_image+private.h" #include "brave/ios/browser/brave_web_client.h" #include "brave/ios/browser/component_updater/component_updater_utils.h" +#include "brave/ios/browser/ui/webui/brave_web_ui_controller_factory.h" #include "components/component_updater/component_updater_paths.h" #include "components/component_updater/installer_policies/safety_tips_component_installer.h" #include "components/history/core/browser/history_service.h" @@ -220,7 +221,7 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent // Setup WebUI (Sync Internals and other WebViews) web::WebUIIOSControllerFactory::RegisterFactory( - ChromeWebUIIOSControllerFactory::GetInstance()); + BraveWebUIControllerFactory::GetInstance()); // Setup Component Updater component_updater::ComponentUpdateService* cus = @@ -470,9 +471,8 @@ - (void)initializeP3AServiceForChannel:(NSString*)channel - (BraveP3AUtils*)p3aUtils { if (!_p3aUtils) { _p3aUtils = [[BraveP3AUtils alloc] - initWithBrowserState:_mainBrowserState - localState:GetApplicationContext()->GetLocalState() - p3aService:_p3a_service]; + initWithLocalState:GetApplicationContext()->GetLocalState() + p3aService:_p3a_service]; } return _p3aUtils; } diff --git a/ios/browser/BUILD.gn b/ios/browser/BUILD.gn index 0247defea6be..5fe2df934ddc 100644 --- a/ios/browser/BUILD.gn +++ b/ios/browser/BUILD.gn @@ -39,8 +39,11 @@ source_set("browser") { "//base", "//brave/browser/sync", "//brave/chromium_src/ios/chrome/browser/shared/model/prefs", + "//brave/components/constants", "//brave/ios/browser/application_context", + "//brave/ios/browser/brave_wallet", "//brave/ios/browser/browser_state", + "//brave/ios/browser/ui/webui", "//components/flags_ui", "//components/metrics", "//components/metrics_services_manager", @@ -55,9 +58,12 @@ source_set("browser") { "//ios/chrome/browser/shared/model/url:constants", "//ios/chrome/browser/web:web_internal", "//ios/components/webui:url_constants", + "//ios/public/provider/chrome/browser/url_rewriters:url_rewriters_api", "//ios/web/public", "//ios/web/public/init", + "//ios/web/public/navigation", "//ios/web/public/thread", "//ui/base", + "//url", ] } diff --git a/ios/browser/DEPS b/ios/browser/DEPS index 448906f2ff73..91232cc9a9b0 100644 --- a/ios/browser/DEPS +++ b/ios/browser/DEPS @@ -9,5 +9,6 @@ include_rules = [ "+ios/web/js_messaging", "+ios/web/web_state", "+ios/web/webui", + "+ios/public/provider/chrome/browser/url_rewriters", "+services/network/public/cpp", ] diff --git a/ios/browser/api/p3a/BUILD.gn b/ios/browser/api/p3a/BUILD.gn index f014e778f261..a4e100da2a45 100644 --- a/ios/browser/api/p3a/BUILD.gn +++ b/ios/browser/api/p3a/BUILD.gn @@ -5,9 +5,6 @@ source_set("p3a") { sources = [ - "brave_histograms_controller+private.h", - "brave_histograms_controller.h", - "brave_histograms_controller.mm", "brave_p3a_utils+private.h", "brave_p3a_utils.h", "brave_p3a_utils.mm", diff --git a/ios/browser/api/p3a/brave_histograms_controller+private.h b/ios/browser/api/p3a/brave_histograms_controller+private.h deleted file mode 100644 index 1b1d23b0060f..000000000000 --- a/ios/browser/api/p3a/brave_histograms_controller+private.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2022 The Brave Authors. All rights reserved. - * 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/. */ - -#ifndef BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_PRIVATE_H_ -#define BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_PRIVATE_H_ - -#include "brave/ios/browser/api/p3a/brave_histograms_controller.h" - -class ChromeBrowserState; - -NS_ASSUME_NONNULL_BEGIN - -@interface BraveHistogramsController (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; -@end - -NS_ASSUME_NONNULL_END - -#endif // BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_PRIVATE_H_ diff --git a/ios/browser/api/p3a/brave_histograms_controller.h b/ios/browser/api/p3a/brave_histograms_controller.h deleted file mode 100644 index f4b40b472d62..000000000000 --- a/ios/browser/api/p3a/brave_histograms_controller.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2022 The Brave Authors. All rights reserved. - * 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/. */ - -#ifndef BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_H_ -#define BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_H_ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/// Displays the `chrome://histograms` web page to verify P3A histograms -OBJC_EXPORT -@interface BraveHistogramsController : UIViewController -@property(readonly) WKWebView* webView; -- (instancetype)init NS_UNAVAILABLE; -@end - -NS_ASSUME_NONNULL_END - -#endif // BRAVE_IOS_BROWSER_API_P3A_BRAVE_HISTOGRAMS_CONTROLLER_H_ diff --git a/ios/browser/api/p3a/brave_histograms_controller.mm b/ios/browser/api/p3a/brave_histograms_controller.mm deleted file mode 100644 index 0a373b863afd..000000000000 --- a/ios/browser/api/p3a/brave_histograms_controller.mm +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (c) 2022 The Brave Authors. All rights reserved. - * 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 "brave/ios/browser/api/p3a/brave_histograms_controller.h" - -#include "base/strings/sys_string_conversions.h" -#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" -#import "ios/chrome/browser/shared/model/url/chrome_url_constants.h" -#include "ios/components/webui/web_ui_url_constants.h" -#include "ios/web/public/browser_state.h" -#include "ios/web/public/navigation/navigation_manager.h" -#include "ios/web/public/web_state.h" -#include "ios/web/public/web_state_delegate_bridge.h" -#include "ios/web/public/web_state_observer_bridge.h" -#include "ios/web/public/webui/web_ui_ios.h" -#include "ios/web/web_state/ui/crw_web_controller.h" -#include "ios/web/web_state/ui/wk_web_view_configuration_provider.h" -#include "ios/web/web_state/web_state_impl.h" -#include "ios/web/webui/web_ui_ios_impl.h" -#include "net/base/mac/url_conversions.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -@interface BraveHistogramsController () { - std::unique_ptr _webState; - std::unique_ptr _webStateObserver; - std::unique_ptr _webStateDelegate; - - WKWebView* _webView; - CRWWebController* _webController; -} -@end - -@implementation BraveHistogramsController - -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { - if ((self = [super init])) { - web::WebState::CreateParams webStateCreateParams(mainBrowserState); - _webState = web::WebState::Create(webStateCreateParams); - - _webStateObserver = std::make_unique(self); - _webState->AddObserver(_webStateObserver.get()); - - _webStateDelegate = std::make_unique(self); - _webState->SetDelegate(_webStateDelegate.get()); - - _webController = - static_cast(_webState.get())->GetWebController(); - _webView = [_webController ensureWebViewCreated]; - } - return self; -} - -- (WKWebView*)webView { - return _webView; -} - -- (void)dealloc { - [[_webController view] removeFromSuperview]; - _webController = nullptr; - _webView = nullptr; - _webState->RemoveObserver(_webStateObserver.get()); - _webStateObserver.reset(); - _webState.reset(); -} - -- (void)loadView { - self.view = [_webController view]; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - [self loadURL:[NSString stringWithFormat:@"%s://%s", kChromeUIScheme, - kChromeUIHistogramHost]]; -} - -- (void)loadURL:(NSString*)urlString { - GURL url = net::GURLWithNSURL([NSURL URLWithString:urlString]); - web::NavigationManager::WebLoadParams params(url); - params.transition_type = ui::PAGE_TRANSITION_TYPED; - _webState->GetNavigationManager()->LoadURLWithParams(params); -} - -- (void)webState:(web::WebState*)webState - didStartNavigation:(web::NavigationContext*)navigation { -} - -- (void)webState:(web::WebState*)webState - didFinishNavigation:(web::NavigationContext*)navigation { -} - -- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { - DCHECK_EQ(_webState.get(), webState); -} - -// MARK: - WebStateDelegate implementation. - -- (void)webState:(web::WebState*)webView - contextMenuConfigurationForParams:(const web::ContextMenuParams&)params - completionHandler:(void (^)(UIContextMenuConfiguration*)) - completionHandler { - completionHandler(nil); -} - -- (void)webStateDestroyed:(web::WebState*)webState { - // The WebState is owned by the current instance, and the observer bridge - // is unregistered before the WebState is destroyed, so this event should - // never happen. - NOTREACHED(); -} - -@end diff --git a/ios/browser/api/p3a/brave_p3a_utils+private.h b/ios/browser/api/p3a/brave_p3a_utils+private.h index 7eec312a1f87..5237e8738c9c 100644 --- a/ios/browser/api/p3a/brave_p3a_utils+private.h +++ b/ios/browser/api/p3a/brave_p3a_utils+private.h @@ -8,7 +8,6 @@ #include "brave/ios/browser/api/p3a/brave_p3a_utils.h" -class ChromeBrowserState; class PrefService; namespace p3a { @@ -18,9 +17,8 @@ class P3AService; NS_ASSUME_NONNULL_BEGIN @interface BraveP3AUtils (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState - localState:(PrefService*)localState - p3aService:(scoped_refptr)p3aService; +- (instancetype)initWithLocalState:(PrefService*)localState + p3aService:(scoped_refptr)p3aService; @end NS_ASSUME_NONNULL_END diff --git a/ios/browser/api/p3a/brave_p3a_utils.h b/ios/browser/api/p3a/brave_p3a_utils.h index 4f614e111200..d2458961850e 100644 --- a/ios/browser/api/p3a/brave_p3a_utils.h +++ b/ios/browser/api/p3a/brave_p3a_utils.h @@ -8,8 +8,6 @@ #import -@class BraveHistogramsController; - NS_ASSUME_NONNULL_BEGIN typedef NSInteger P3AMetricLogType NS_TYPED_ENUM; @@ -37,7 +35,6 @@ OBJC_EXPORT logType:(P3AMetricLogType)logType mainThreadBound:(BOOL)mainThreadBound; - (void)removeDynamicMetric:(NSString*)histogramName; -- (BraveHistogramsController*)histogramsController; - (instancetype)init NS_UNAVAILABLE; @end diff --git a/ios/browser/api/p3a/brave_p3a_utils.mm b/ios/browser/api/p3a/brave_p3a_utils.mm index 501c2c157871..628d20da79c5 100644 --- a/ios/browser/api/p3a/brave_p3a_utils.mm +++ b/ios/browser/api/p3a/brave_p3a_utils.mm @@ -14,7 +14,6 @@ #include "brave/components/p3a/metric_log_type.h" #include "brave/components/p3a/p3a_service.h" #include "brave/components/p3a/pref_names.h" -#include "brave/ios/browser/api/p3a/brave_histograms_controller+private.h" #include "components/prefs/pref_service.h" #include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" @@ -44,17 +43,13 @@ - (instancetype)initWithSubscription:(base::CallbackListSubscription)sub { @end @implementation BraveP3AUtils { - ChromeBrowserState* _browserState; PrefService* _localState; scoped_refptr _p3aService; } -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState - localState:(PrefService*)localState - p3aService: - (scoped_refptr)p3aService { +- (instancetype)initWithLocalState:(PrefService*)localState + p3aService:(scoped_refptr)p3aService { if ((self = [super init])) { - _browserState = mainBrowserState; _localState = localState; _p3aService = p3aService; } @@ -79,10 +74,6 @@ - (void)setIsNoticeAcknowledged:(bool)isNoticeAcknowledged { _localState->CommitPendingWrite(); } -- (BraveHistogramsController*)histogramsController { - return [[BraveHistogramsController alloc] initWithBrowserState:_browserState]; -} - - (P3ACallbackRegistration*)registerRotationCallback: (void (^)(P3AMetricLogType logType, BOOL isConstellation))callback { if (!_p3aService) { diff --git a/ios/browser/api/p3a/headers.gni b/ios/browser/api/p3a/headers.gni index a5c75f5f90f1..8798aec3ca7e 100644 --- a/ios/browser/api/p3a/headers.gni +++ b/ios/browser/api/p3a/headers.gni @@ -3,7 +3,4 @@ # 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/. -brave_p3a_public_headers = [ - "//brave/ios/browser/api/p3a/brave_histograms_controller.h", - "//brave/ios/browser/api/p3a/brave_p3a_utils.h", -] +brave_p3a_public_headers = [ "//brave/ios/browser/api/p3a/brave_p3a_utils.h" ] diff --git a/ios/browser/api/sync/BUILD.gn b/ios/browser/api/sync/BUILD.gn index 00add4c97035..2ea9caed430a 100644 --- a/ios/browser/api/sync/BUILD.gn +++ b/ios/browser/api/sync/BUILD.gn @@ -10,8 +10,6 @@ source_set("sync") { sources = [ "brave_sync_api.h", "brave_sync_api.mm", - "brave_sync_internals.h", - "brave_sync_internals.mm", "brave_sync_worker.cc", "brave_sync_worker.h", ] @@ -28,22 +26,10 @@ source_set("sync") { "//components/sync/protocol", "//components/sync/service", "//components/sync_device_info", - "//ios/chrome/browser/shared/model/application_context", "//ios/chrome/browser/shared/model/browser_state", "//ios/chrome/browser/sync/model", - "//ios/components/webui:url_constants", - "//ios/web/js_messaging:js_messaging", "//ios/web/public/thread", - "//ios/web/public/webui", - "//ios/web/web_state", - "//ios/web/web_state:web_state_impl_header", - "//ios/web/webui", - "//ui/base", ] - frameworks = [ - "Foundation.framework", - "UIKit.framework", - "WebKit.framework", - ] + frameworks = [ "Foundation.framework" ] } diff --git a/ios/browser/api/sync/brave_sync_api.h b/ios/browser/api/sync/brave_sync_api.h index a6eef6d1fab7..27825249ec99 100644 --- a/ios/browser/api/sync/brave_sync_api.h +++ b/ios/browser/api/sync/brave_sync_api.h @@ -122,8 +122,6 @@ OBJC_EXPORT - (nullable NSString*)getDeviceListJSON; -- (BraveSyncInternalsController*)createSyncInternalsController; - - (id)createSyncDeviceObserver:(void (^)())onDeviceInfoChanged; - (id)createSyncServiceObserver:(void (^)())onSyncServiceStateChanged onSyncServiceShutdown:(void (^)())onSyncServiceShutdown; diff --git a/ios/browser/api/sync/brave_sync_api.mm b/ios/browser/api/sync/brave_sync_api.mm index c3a599727c68..4ff0ce531937 100644 --- a/ios/browser/api/sync/brave_sync_api.mm +++ b/ios/browser/api/sync/brave_sync_api.mm @@ -20,7 +20,6 @@ #include "brave/components/brave_sync/qr_code_validator.h" #include "brave/components/brave_sync/time_limited_words.h" #include "brave/components/sync_device_info/brave_device_info.h" -#include "brave/ios/browser/api/sync/brave_sync_internals+private.h" #include "brave/ios/browser/api/sync/brave_sync_worker.h" #include "components/sync/engine/sync_protocol_error.h" @@ -31,15 +30,11 @@ #include "components/sync_device_info/device_info_sync_service.h" #include "components/sync_device_info/device_info_tracker.h" #include "components/sync_device_info/local_device_info_provider.h" -#include "ios/chrome/browser/shared/model/application_context/application_context.h" #include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" -#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/sync/model/device_info_sync_service_factory.h" #include "ios/chrome/browser/sync/model/sync_service_factory.h" #include "ios/chrome/browser/sync/model/sync_setup_service.h" #include "ios/chrome/browser/sync/model/sync_setup_service_factory.h" -#include "ios/web/public/thread/web_task_traits.h" -#include "ios/web/public/thread/web_thread.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -369,11 +364,6 @@ - (void)deleteDevice:(NSString*)guid { _worker->DeleteDevice(base::SysNSStringToUTF8(guid)); } -- (BraveSyncInternalsController*)createSyncInternalsController { - return [[BraveSyncInternalsController alloc] - initWithBrowserState:_chromeBrowserState]; -} - - (id)createSyncDeviceObserver:(void (^)())onDeviceInfoChanged { auto* tracker = DeviceInfoSyncServiceFactory::GetForBrowserState(_chromeBrowserState) diff --git a/ios/browser/api/sync/brave_sync_internals+private.h b/ios/browser/api/sync/brave_sync_internals+private.h deleted file mode 100644 index a0b69cb26973..000000000000 --- a/ios/browser/api/sync/brave_sync_internals+private.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2021 The Brave Authors. All rights reserved. - * 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/. */ - -#ifndef BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_PRIVATE_H_ -#define BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_PRIVATE_H_ - -#import - -#include "brave/ios/browser/api/sync/brave_sync_internals.h" - -NS_ASSUME_NONNULL_BEGIN - -class ChromeBrowserState; - -@interface BraveSyncInternalsController (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; -@end - -NS_ASSUME_NONNULL_END - -#endif // BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_PRIVATE_H_ diff --git a/ios/browser/api/sync/brave_sync_internals.h b/ios/browser/api/sync/brave_sync_internals.h deleted file mode 100644 index bea82dee070d..000000000000 --- a/ios/browser/api/sync/brave_sync_internals.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2021 The Brave Authors. All rights reserved. - * 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/. */ - -#ifndef BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_H_ -#define BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_H_ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -OBJC_EXPORT -@interface BraveSyncInternalsController : UIViewController -- (instancetype)init NS_UNAVAILABLE; -@end - -NS_ASSUME_NONNULL_END - -#endif // BRAVE_IOS_BROWSER_API_SYNC_BRAVE_SYNC_INTERNALS_H_ diff --git a/ios/browser/api/sync/brave_sync_internals.mm b/ios/browser/api/sync/brave_sync_internals.mm deleted file mode 100644 index 8c745ec1e995..000000000000 --- a/ios/browser/api/sync/brave_sync_internals.mm +++ /dev/null @@ -1,211 +0,0 @@ -/* Copyright (c) 2021 The Brave Authors. All rights reserved. - * 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 "brave/ios/browser/api/sync/brave_sync_internals.h" - -#include "base/memory/weak_ptr.h" -#include "base/strings/sys_string_conversions.h" -#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" -#include "ios/components/webui/web_ui_url_constants.h" -#import "ios/web/js_messaging/web_view_web_state_map.h" -#import "ios/web/public/browser_state.h" -#import "ios/web/public/navigation/navigation_manager.h" -#include "ios/web/public/thread/web_thread.h" -#import "ios/web/public/web_state.h" -#import "ios/web/public/web_state_delegate_bridge.h" -#import "ios/web/public/web_state_observer_bridge.h" -#import "ios/web/public/webui/web_ui_ios.h" -#import "ios/web/web_state/ui/crw_web_controller.h" -#import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" -#import "ios/web/web_state/web_state_impl.h" -#import "ios/web/webui/web_ui_ios_impl.h" -#import "net/base/mac/url_conversions.h" -#include "ui/base/page_transition_types.h" -#include "url/gurl.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -namespace web { - -WKWebView* EnsureWebViewCreatedWithConfiguration( - WebState* web_state, - WKWebViewConfiguration* configuration) { - WebStateImpl* impl = static_cast(web_state); - BrowserState* browser_state = impl->GetBrowserState(); - CRWWebController* web_controller = impl->GetWebController(); - - WKWebViewConfigurationProvider& provider = - WKWebViewConfigurationProvider::FromBrowserState(browser_state); - provider.ResetWithWebViewConfiguration(configuration); - - // |web_controller| will get the |configuration| from the |provider| to create - // the webView to return. - return [web_controller ensureWebViewCreated]; -} - -} // namespace web - -@protocol CRWebViewPrivate -- (void)setWebView:(WKWebView*)webView; -@end - -@interface BraveSyncInternalsController () { - ChromeBrowserState* _chromeBrowserState; - std::unique_ptr _webState; - std::unique_ptr _webStateObserver; - std::unique_ptr _webStateDelegate; - - WKWebView* _webView; - CRWWebController* _webController; -} -@end - -@implementation BraveSyncInternalsController -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { - if ((self = [super init])) { - _chromeBrowserState = mainBrowserState; - web::WebState::CreateParams webStateCreateParams(mainBrowserState); - _webState = web::WebState::Create(webStateCreateParams); - - _webStateObserver = std::make_unique(self); - _webState->AddObserver(_webStateObserver.get()); - - _webStateDelegate = std::make_unique(self); - _webState->SetDelegate(_webStateDelegate.get()); - - _webController = - static_cast(_webState.get())->GetWebController(); - _webView = [_webController ensureWebViewCreated]; - } - return self; -} - -- (void)dealloc { - [[_webController view] removeFromSuperview]; - _webController = nullptr; - _webView = nullptr; - _webState->RemoveObserver(_webStateObserver.get()); - _webStateObserver.reset(); - _webState.reset(); - _chromeBrowserState = nullptr; -} - -- (void)loadView { - self.view = [_webController view]; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - [self loadURL:[NSString stringWithFormat:@"%s://%s", kChromeUIScheme, - kChromeUISyncInternalsHost]]; -} - -- (void)loadURL:(NSString*)urlString { - GURL url = net::GURLWithNSURL([NSURL URLWithString:urlString]); - web::NavigationManager::WebLoadParams params(url); - params.transition_type = ui::PAGE_TRANSITION_TYPED; - _webState->GetNavigationManager()->LoadURLWithParams(params); -} - -/** - EVERYTHING below this line is NOT exported or used yet. - It's too beta and requires a lot of refactoring of iOS code. - Once we have a better way to integrate external WKWebView's, we can - uncomment it and test it out. Until then, it's best we don't use it. - - Brandon T. -*/ - -//- (UIView*)getViewForDisplay { -// return [_webController view]; -//} -// -//- (WKWebView*)getWebViewForDisplay { -// return _webView; -//} -// -//- (void)setCustomWebView:(WKWebView*)webView { -// if ([_webController -// respondsToSelector:NSSelectorFromString(@"setWebView:")]) { -// [((id)_webController) setWebView:webView]; -// } -//} - -//- (void)setCustomWebView:(WKWebView*)webView { -// web::WebState::CreateParams webStateCreateParams(_chromeBrowserState); -// std::unique_ptr webState = -// web::WebState::Create(webStateCreateParams); -// -// std::unique_ptr webStateObserver = -// std::make_unique(self); -// webState->AddObserver(_webStateObserver.get()); -// -// std::unique_ptr webStateDelegate = -// std::make_unique(self); -// webState->SetDelegate(webStateDelegate.get()); -// -// web::WKWebViewConfigurationProvider& config_provider = -// web::WKWebViewConfigurationProvider::FromBrowserState(_chromeBrowserState); -// -// web::WebStateImpl* webStateImpl = -// static_cast(webState.get()); -// web::WebViewWebStateMap::FromBrowserState( -// webStateImpl->GetBrowserState()) -// ->SetAssociatedWebViewForWebState(webView, webStateImpl); -// -// if (webView) { -// webStateImpl->RemoveAllWebFrames(); -// [webView stopLoading]; -// -// config_provider.ResetWithWebViewConfiguration(webView.configuration); -// -// webStateImpl->ClearWebUI(); -// webStateImpl->CreateWebUI(GURL("chrome://sync-internals")); -// -// GURL url = net::GURLWithNSURL([NSURL -// URLWithString:@"chrome://sync-internals"]); -// web::NavigationManager::WebLoadParams params(url); -// params.transition_type = ui::PAGE_TRANSITION_TYPED; -// _webState->GetNavigationManager()->LoadURLWithParams(params); -// -// [webView setWebState:webState.release()]; -// [webView setWebStateObserver:webStateObserver.release()]; -// [webView setWebStateDelegate:webStateDelegate.release()]; -// } -//} - -// MARK: - WebStateObserver implementation. - -- (void)webState:(web::WebState*)webState - didStartNavigation:(web::NavigationContext*)navigation { -} - -- (void)webState:(web::WebState*)webState - didFinishNavigation:(web::NavigationContext*)navigation { -} - -- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { - DCHECK_EQ(_webState.get(), webState); -} - -// MARK: - WebStateDelegate implementation. - -- (void)webState:(web::WebState*)webView - contextMenuConfigurationForParams:(const web::ContextMenuParams&)params - completionHandler:(void (^)(UIContextMenuConfiguration*)) - completionHandler { - completionHandler(nil); -} - -- (void)webStateDestroyed:(web::WebState*)webState { - // The WebState is owned by the current instance, and the observer bridge - // is unregistered before the WebState is destroyed, so this event should - // never happen. - NOTREACHED(); -} -@end diff --git a/ios/browser/api/web/BUILD.gn b/ios/browser/api/web/BUILD.gn index b35d72194edf..d160640073a8 100644 --- a/ios/browser/api/web/BUILD.gn +++ b/ios/browser/api/web/BUILD.gn @@ -6,8 +6,9 @@ import("//build/config/ios/rules.gni") import("//ios/build/config.gni") -source_set("web") { - sources = [] - - deps = [ "web_state" ] +group("web") { + public_deps = [ + "ui", + "web_state", + ] } diff --git a/ios/browser/api/web/ui/BUILD.gn b/ios/browser/api/web/ui/BUILD.gn new file mode 100644 index 000000000000..8e7ae86904c7 --- /dev/null +++ b/ios/browser/api/web/ui/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# 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 https://mozilla.org/MPL/2.0/. + +import("//build/config/ios/rules.gni") +import("//ios/build/config.gni") + +source_set("ui") { + sources = [ + "chrome_webview.h", + "chrome_webview.mm", + ] + + deps = [ + "//base", + "//components/profile_metrics", + "//ios/chrome/browser/shared/model/application_context", + "//ios/chrome/browser/shared/model/browser_state", + "//ios/components/webui:url_constants", + "//ios/web/js_messaging:js_messaging", + "//ios/web/public/thread", + "//ios/web/public/webui", + "//ios/web/web_state", + "//ios/web/web_state:web_state_impl_header", + "//ios/web/webui", + "//ui/base", + ] + + frameworks = [ + "Foundation.framework", + "UIKit.framework", + "WebKit.framework", + ] +} diff --git a/ios/browser/api/web/ui/chrome_webview.h b/ios/browser/api/web/ui/chrome_webview.h new file mode 100644 index 000000000000..527688218949 --- /dev/null +++ b/ios/browser/api/web/ui/chrome_webview.h @@ -0,0 +1,26 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_IOS_BROWSER_API_WEB_UI_CHROME_WEBVIEW_H_ +#define BRAVE_IOS_BROWSER_API_WEB_UI_CHROME_WEBVIEW_H_ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +OBJC_EXPORT +@interface ChromeWebViewController : UIViewController +@property(nonatomic, readonly) WKWebView* webView; +@property(nonatomic, readonly) bool isOffTheRecord; + +- (instancetype)initWithPrivateBrowsing:(bool)isPrivateBrowsing; +- (void)loadURL:(NSString*)urlString; +@end + +NS_ASSUME_NONNULL_END + +#endif // BRAVE_IOS_BROWSER_API_WEB_UI_CHROME_WEBVIEW_H_ diff --git a/ios/browser/api/web/ui/chrome_webview.mm b/ios/browser/api/web/ui/chrome_webview.mm new file mode 100644 index 000000000000..551ba7b8c53b --- /dev/null +++ b/ios/browser/api/web/ui/chrome_webview.mm @@ -0,0 +1,133 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/ios/browser/api/web/ui/chrome_webview.h" + +#include "base/memory/weak_ptr.h" +#include "base/strings/sys_string_conversions.h" +#include "ios/chrome/browser/shared/model/application_context/application_context.h" +#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state_manager.h" +#include "ios/components/webui/web_ui_url_constants.h" +#import "ios/web/js_messaging/web_view_web_state_map.h" +#import "ios/web/public/browser_state.h" +#import "ios/web/public/navigation/navigation_manager.h" +#include "ios/web/public/thread/web_thread.h" +#import "ios/web/public/web_state.h" +#import "ios/web/public/web_state_delegate_bridge.h" +#import "ios/web/public/web_state_observer_bridge.h" +#import "ios/web/public/webui/web_ui_ios.h" +#import "ios/web/web_state/ui/crw_web_controller.h" +#import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" +#import "ios/web/web_state/web_state_impl.h" +#import "ios/web/webui/web_ui_ios_impl.h" +#import "net/base/mac/url_conversions.h" +#include "ui/base/page_transition_types.h" +#include "url/gurl.h" + +#include "components/profile_metrics/browser_profile_type.h" + +@interface ChromeWebViewController () { + raw_ptr browser_state_; + std::unique_ptr web_state_; + std::unique_ptr web_state_observer_; + std::unique_ptr web_state_delegate_; + + WKWebView* web_view_; + CRWWebController* web_controller_; +} +@end + +@implementation ChromeWebViewController +- (instancetype)initWithPrivateBrowsing:(bool)isPrivateBrowsing { + if ((self = [super init])) { + ios::ChromeBrowserStateManager* browser_state_manager = + GetApplicationContext()->GetChromeBrowserStateManager(); + + browser_state_ = browser_state_manager->GetLastUsedBrowserState() + ->GetOriginalChromeBrowserState(); + + if (isPrivateBrowsing) { + browser_state_ = browser_state_->GetOffTheRecordChromeBrowserState(); + } + + web_state_ = + web::WebState::Create(web::WebState::CreateParams(browser_state_)); + + web_state_observer_ = std::make_unique(self); + web_state_->AddObserver(web_state_observer_.get()); + + web_state_delegate_ = std::make_unique(self); + web_state_->SetDelegate(web_state_delegate_.get()); + + web_controller_ = + static_cast(web_state_.get())->GetWebController(); + web_view_ = [web_controller_ ensureWebViewCreated]; + } + return self; +} + +- (void)dealloc { + [[web_controller_ view] removeFromSuperview]; + web_controller_ = nullptr; + web_view_ = nullptr; + web_state_->RemoveObserver(web_state_observer_.get()); + web_state_observer_.reset(); + web_state_delegate_.reset(); + web_state_.reset(); + browser_state_ = nullptr; +} + +- (WKWebView*)webView { + return web_view_; +} + +- (bool)isOffTheRecord { + return profile_metrics::GetBrowserProfileType(browser_state_) == + profile_metrics::BrowserProfileType::kIncognito; +} + +- (void)loadView { + self.view = [web_controller_ view]; +} + +- (void)loadURL:(NSString*)urlString { + GURL url = net::GURLWithNSURL([NSURL URLWithString:urlString]); + web::NavigationManager::WebLoadParams params(url); + params.transition_type = ui::PAGE_TRANSITION_TYPED; + web_state_->GetNavigationManager()->LoadURLWithParams(params); +} + +// MARK: - WebStateObserver implementation. + +- (void)webState:(web::WebState*)webState + didStartNavigation:(web::NavigationContext*)navigation { +} + +- (void)webState:(web::WebState*)webState + didFinishNavigation:(web::NavigationContext*)navigation { +} + +- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { + DCHECK_EQ(web_state_.get(), webState); +} + +// MARK: - WebStateDelegate implementation. + +- (void)webState:(web::WebState*)webView + contextMenuConfigurationForParams:(const web::ContextMenuParams&)params + completionHandler:(void (^)(UIContextMenuConfiguration*)) + completionHandler { + completionHandler(nil); +} + +- (void)webStateDestroyed:(web::WebState*)webState { + // The WebState is owned by the current instance, and the observer bridge + // is unregistered before the WebState is destroyed, so this event should + // never happen. + NOTREACHED(); +} +@end diff --git a/ios/browser/api/web/ui/headers.gni b/ios/browser/api/web/ui/headers.gni new file mode 100644 index 000000000000..e7089e5b11af --- /dev/null +++ b/ios/browser/api/web/ui/headers.gni @@ -0,0 +1,7 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# 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 https://mozilla.org/MPL/2.0/. + +browser_api_web_ui_public_headers = + [ "//brave/ios/browser/api/web/ui/chrome_webview.h" ] diff --git a/ios/browser/brave_web_client.h b/ios/browser/brave_web_client.h index c408bfbe8030..2eecdd789e5d 100644 --- a/ios/browser/brave_web_client.h +++ b/ios/browser/brave_web_client.h @@ -25,6 +25,9 @@ class BraveWebClient : public ChromeWebClient { std::unique_ptr CreateWebMainParts() override; std::string GetUserAgent(web::UserAgentType type) const override; + void PostBrowserURLRewriterCreation( + web::BrowserURLRewriter* rewriter) override; + private: std::string user_agent_; }; diff --git a/ios/browser/brave_web_client.mm b/ios/browser/brave_web_client.mm index 2993a0d277c8..7ce7817129c8 100644 --- a/ios/browser/brave_web_client.mm +++ b/ios/browser/brave_web_client.mm @@ -6,9 +6,12 @@ #import "brave/ios/browser/brave_web_client.h" #include "base/functional/bind.h" +#include "brave/components/constants/url_constants.h" #include "brave/ios/browser/brave_web_main_parts.h" #include "ios/chrome/browser/shared/model/url/chrome_url_constants.h" #include "ios/components/webui/web_ui_url_constants.h" +#import "ios/public/provider/chrome/browser/url_rewriters/url_rewriters_api.h" +#import "ios/web/public/navigation/browser_url_rewriter.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -32,3 +35,18 @@ std::string BraveWebClient::GetUserAgent(web::UserAgentType type) const { return user_agent_; } + +bool WillHandleBraveURLRedirect(GURL* url, web::BrowserState* browser_state) { + if (url->SchemeIs(kBraveUIScheme)) { + GURL::Replacements replacements; + replacements.SetSchemeStr(kChromeUIScheme); + *url = url->ReplaceComponents(replacements); + } + return false; +} + +void BraveWebClient::PostBrowserURLRewriterCreation( + web::BrowserURLRewriter* rewriter) { + rewriter->AddURLRewriter(&WillHandleBraveURLRedirect); + ChromeWebClient::PostBrowserURLRewriterCreation(rewriter); +} diff --git a/ios/browser/ui/webui/BUILD.gn b/ios/browser/ui/webui/BUILD.gn new file mode 100644 index 000000000000..798dabc35bae --- /dev/null +++ b/ios/browser/ui/webui/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# 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 https://mozilla.org/MPL/2.0/. + +import("//brave/build/config.gni") +import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni") +import("//build/config/features.gni") +import("//mojo/public/tools/bindings/mojom.gni") + +source_set("webui") { + sources = [ + "brave_web_ui_controller_factory.h", + "brave_web_ui_controller_factory.mm", + "brave_webui_source.h", + "brave_webui_source.mm", + ] + + deps = [ + "//brave/components/constants", + "//brave/components/webui", + "//components/prefs", + "//components/profile_metrics", + "//components/resources", + "//ios/chrome/browser/shared/model/browser_state", + "//ios/chrome/browser/shared/model/url:constants", + "//ios/chrome/browser/ui/webui", + "//ios/chrome/browser/ui/webui:webui_internal", + "//ios/components/webui:url_constants", + "//ios/web/public/webui", + "//services/network/public/cpp", + "//services/service_manager/public/cpp", + "//third_party/abseil-cpp:absl", + "//ui/base", + ] +} diff --git a/ios/browser/ui/webui/DEPS b/ios/browser/ui/webui/DEPS new file mode 100644 index 000000000000..8050e7e95ff7 --- /dev/null +++ b/ios/browser/ui/webui/DEPS @@ -0,0 +1,6 @@ +include_rules = [ + "+components/account_id", + "+ios/chrome/browser/ui/policy/user_policy_util.h", + "+ios/components/webui", + "+mojo/public", +] diff --git a/ios/browser/ui/webui/brave_web_ui_controller_factory.h b/ios/browser/ui/webui/brave_web_ui_controller_factory.h new file mode 100644 index 000000000000..f2bc649a5293 --- /dev/null +++ b/ios/browser/ui/webui/brave_web_ui_controller_factory.h @@ -0,0 +1,44 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEB_UI_CONTROLLER_FACTORY_H_ +#define BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEB_UI_CONTROLLER_FACTORY_H_ + +#include + +#import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" +#import "ios/web/public/webui/web_ui_ios.h" +#import "ios/web/public/webui/web_ui_ios_controller.h" + +namespace base { +template +class NoDestructor; +} // namespace base + +class GURL; + +class BraveWebUIControllerFactory : public ChromeWebUIIOSControllerFactory { + public: + std::unique_ptr CreateWebUIIOSControllerForURL( + web::WebUIIOS* web_ui, + const GURL& url) const override; + + NSInteger GetErrorCodeForWebUIURL(const GURL& url) const override; + + static BraveWebUIControllerFactory* GetInstance(); + + BraveWebUIControllerFactory(const BraveWebUIControllerFactory&) = delete; + BraveWebUIControllerFactory& operator=(const BraveWebUIControllerFactory&) = + delete; + + protected: + BraveWebUIControllerFactory(); + ~BraveWebUIControllerFactory() override; + + private: + friend class base::NoDestructor; +}; + +#endif // BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEB_UI_CONTROLLER_FACTORY_H_ diff --git a/ios/browser/ui/webui/brave_web_ui_controller_factory.mm b/ios/browser/ui/webui/brave_web_ui_controller_factory.mm new file mode 100644 index 000000000000..9868a4a67c10 --- /dev/null +++ b/ios/browser/ui/webui/brave_web_ui_controller_factory.mm @@ -0,0 +1,103 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/ios/browser/ui/webui/brave_web_ui_controller_factory.h" + +#include + +#include "base/feature_list.h" +#include "base/memory/ptr_util.h" +#include "base/no_destructor.h" +#include "brave/components/constants/pref_names.h" +#include "brave/components/constants/url_constants.h" +#include "brave/components/constants/webui_url_constants.h" +#include "build/build_config.h" +#include "components/prefs/pref_service.h" +#include "ios/components/webui/web_ui_url_constants.h" +#include "url/gurl.h" + +#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/shared/model/url/chrome_url_constants.h" + +using web::WebUIIOS; +using web::WebUIIOSController; + +namespace brave { + +// A function for creating a new WebUIIOS. +using WebUIIOSFactoryFunction = + std::unique_ptr (*)(WebUIIOS* web_ui, const GURL& url); + +// Template for defining WebUIIOSFactoryFunction. +template +std::unique_ptr NewWebUIIOS(WebUIIOS* web_ui, + const GURL& url) { + return std::make_unique(web_ui, url); +} + +// Returns a function that can be used to create the right type of WebUIIOS for +// a tab, based on its URL. Returns nullptr if the URL doesn't have WebUIIOS +// associated with it. +WebUIIOSFactoryFunction GetWebUIIOSFactoryFunction(const GURL& url) { + // This will get called a lot to check all URLs, so do a quick check of other + // schemes to filter out most URLs. + if (!url.SchemeIs(kBraveUIScheme) && !url.SchemeIs(kChromeUIScheme)) { + return nullptr; + } + + // TODO: Handle RewardsInternalUI, AdsInternalUI, AdblockInternalUI URLs here + // ChromeBrowserState* browser_state = + // ChromeBrowserState::FromWebUIIOS(web_ui); + + const std::string url_host = url.host(); + /*if (url_host == kAdblockInternalsHost) { + return &NewWebUIIOS; + } else if (url_host == kSkusInternalsHost) { + return &NewWebUIIOS; + } else if (url_host == kRewardsInternalsHost && + brave_rewards::IsSupportedForProfile(browser_state)) { + return &NewWebUIIOS; + }*/ + return nullptr; +} + +} // namespace brave + +NSInteger BraveWebUIControllerFactory::GetErrorCodeForWebUIURL( + const GURL& url) const { + if (url.host() == kChromeUIDinoHost) { + return NSURLErrorNotConnectedToInternet; + } + + if (brave::GetWebUIIOSFactoryFunction(url)) { + return 0; + } + + return ChromeWebUIIOSControllerFactory::GetErrorCodeForWebUIURL(url); +} + +std::unique_ptr +BraveWebUIControllerFactory::CreateWebUIIOSControllerForURL( + WebUIIOS* web_ui, + const GURL& url) const { + brave::WebUIIOSFactoryFunction function = + brave::GetWebUIIOSFactoryFunction(url); + if (!function) { + return ChromeWebUIIOSControllerFactory::CreateWebUIIOSControllerForURL( + web_ui, url); + } + + return (*function)(web_ui, url); +} + +// static +BraveWebUIControllerFactory* BraveWebUIControllerFactory::GetInstance() { + static base::NoDestructor instance; + return instance.get(); +} + +BraveWebUIControllerFactory::BraveWebUIControllerFactory() = default; + +BraveWebUIControllerFactory::~BraveWebUIControllerFactory() = default; diff --git a/ios/browser/ui/webui/brave_webui_source.h b/ios/browser/ui/webui/brave_webui_source.h new file mode 100644 index 000000000000..ef753b919b23 --- /dev/null +++ b/ios/browser/ui/webui/brave_webui_source.h @@ -0,0 +1,35 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEBUI_SOURCE_H_ +#define BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEBUI_SOURCE_H_ + +#include + +#include "build/build_config.h" + +namespace web { +class WebUIIOS; +class WebUIIOSDataSource; +} // namespace web + +namespace webui { +struct ResourcePath; +} // namespace webui + +namespace brave { + +// Add brave resource path mapping and localized strings to new data source. +web::WebUIIOSDataSource* CreateAndAddWebUIDataSource( + web::WebUIIOS* web_ui, + const std::string& name, + const webui::ResourcePath* resource_map, + size_t resouece_map_size, + int html_resource_id, + bool disable_trusted_types_csp = false); + +} // namespace brave + +#endif // BRAVE_IOS_BROWSER_UI_WEBUI_BRAVE_WEBUI_SOURCE_H_ diff --git a/ios/browser/ui/webui/brave_webui_source.mm b/ios/browser/ui/webui/brave_webui_source.mm new file mode 100644 index 000000000000..e840fc7ecf55 --- /dev/null +++ b/ios/browser/ui/webui/brave_webui_source.mm @@ -0,0 +1,65 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// 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 https://mozilla.org/MPL/2.0/. + +#include "brave/ios/browser/ui/webui/brave_webui_source.h" + +#include +#include + +#include "base/containers/flat_map.h" +#include "base/strings/utf_string_conversions.h" +#include "brave/components/constants/url_constants.h" +#include "brave/components/webui/webui_resources.h" +#include "build/build_config.h" +#include "components/grit/components_resources.h" +#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" +#include "ios/web/public/webui/web_ui_ios_data_source.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/webui/resource_path.h" +#include "ui/base/webui/web_ui_util.h" + +namespace { + +void CustomizeWebUIHTMLSource(web::WebUIIOS* web_ui, + const std::string& name, + web::WebUIIOSDataSource* source) { + source->AddResourcePaths(brave::GetWebUIResources(name)); + source->AddLocalizedStrings(brave::GetWebUILocalizedStrings(name)); +} + +web::WebUIIOSDataSource* CreateWebUIDataSource( + web::WebUIIOS* web_ui, + const std::string& name, + const webui::ResourcePath* resource_map, + size_t resource_map_size, + int html_resource_id, + bool disable_trusted_types_csp) { + web::WebUIIOSDataSource* source = web::WebUIIOSDataSource::Create(name); + web::WebUIIOSDataSource::Add(ChromeBrowserState::FromWebUIIOS(web_ui), + source); + + source->UseStringsJs(); + source->AddResourcePaths(base::make_span(resource_map, resource_map_size)); + source->SetDefaultResource(html_resource_id); + CustomizeWebUIHTMLSource(web_ui, name, source); + return source; +} + +} // namespace + +namespace brave { + +web::WebUIIOSDataSource* CreateAndAddWebUIDataSource( + web::WebUIIOS* web_ui, + const std::string& name, + const webui::ResourcePath* resource_map, + size_t resource_map_size, + int html_resource_id, + bool disable_trusted_types_csp) { + return CreateWebUIDataSource(web_ui, name, resource_map, resource_map_size, + html_resource_id, disable_trusted_types_csp); +} + +} // namespace brave