diff --git a/app/brave_settings_strings.grdp b/app/brave_settings_strings.grdp index 2b3f0d6d4fd10..daa8ac6edfea5 100644 --- a/app/brave_settings_strings.grdp +++ b/app/brave_settings_strings.grdp @@ -95,6 +95,9 @@ Show Brave Rewards icon in address bar + + Show Brave News button in address bar + Always show bookmarks on new tab page diff --git a/browser/about_flags.cc b/browser/about_flags.cc index 7aec034337c49..8bb4cd56b2917 100644 --- a/browser/about_flags.cc +++ b/browser/about_flags.cc @@ -321,12 +321,6 @@ constexpr char kBraveNewsCardPeekFeatureDescription[] = "Prompt Brave News via the top featured article peeking up from the bottom " "of the New Tab Page, after a short delay."; -constexpr char kBraveNewsSubscribeButtonName[] = - "Enable Brave News Subscribe Button"; -constexpr char kBraveNewsSubscribeButtonDescription[] = - "Show a button in the toolbar to allow you to add supported sites to Brave " - "News."; - constexpr char kCryptoWalletsForNewInstallsName[] = "Enable Crypto Wallets option in settings"; constexpr char kCryptoWalletsForNewInstallsDescription[] = @@ -509,12 +503,6 @@ constexpr char kBraveBackgroundVideoPlaybackDescription[] = flag_descriptions::kBraveNewsCardPeekFeatureDescription, \ kOsDesktop, \ FEATURE_VALUE_TYPE(brave_today::features::kBraveNewsCardPeekFeature)}, \ - {"brave-news-subscribe-button", \ - flag_descriptions::kBraveNewsSubscribeButtonName, \ - flag_descriptions::kBraveNewsSubscribeButtonDescription, \ - kOsLinux | kOsMac | kOsWin, \ - FEATURE_VALUE_TYPE( \ - brave_today::features::kBraveNewsSubscribeButtonFeature)}, #define BRAVE_FEDERATED_FEATURE_ENTRIES \ {"brave-federated", \ diff --git a/browser/brave_news/brave_news_tab_helper_browsertest.cc b/browser/brave_news/brave_news_tab_helper_browsertest.cc index 19f0013d77838..27ea746df458e 100644 --- a/browser/brave_news/brave_news_tab_helper_browsertest.cc +++ b/browser/brave_news/brave_news_tab_helper_browsertest.cc @@ -75,10 +75,7 @@ class WaitForFeedsChanged : public BraveNewsTabHelper::PageFeedsObserver { class BraveNewsTabHelperTest : public InProcessBrowserTest { public: BraveNewsTabHelperTest() - : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { - features_.InitWithFeatures( - {brave_today::features::kBraveNewsSubscribeButtonFeature}, {}); - } + : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {} void SetUp() override { brave::RegisterPathProvider(); @@ -118,7 +115,6 @@ class BraveNewsTabHelperTest : public InProcessBrowserTest { net::EmbeddedTestServer* https_server() { return &https_server_; } private: - base::test::ScopedFeatureList features_; net::EmbeddedTestServer https_server_; content::ContentMockCertVerifier cert_verifier_; }; diff --git a/browser/brave_tab_helpers.cc b/browser/brave_tab_helpers.cc index 7df3ab3ecbcd9..e6b2f08f3733a 100644 --- a/browser/brave_tab_helpers.cc +++ b/browser/brave_tab_helpers.cc @@ -120,9 +120,7 @@ void AttachTabHelpers(content::WebContents* web_contents) { ipfs::IPFSTabHelper::MaybeCreateForWebContents(web_contents); #endif - if (base::FeatureList::IsEnabled( - brave_today::features::kBraveNewsSubscribeButtonFeature) && - !web_contents->GetBrowserContext()->IsOffTheRecord()) { + if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { BraveNewsTabHelper::CreateForWebContents(web_contents); } diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index 4e2c9c1f46636..7cf18bad5644e 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -10,6 +10,7 @@ #include "brave/components/brave_ads/common/pref_names.h" #include "brave/components/brave_rewards/common/pref_names.h" #include "brave/components/brave_shields/common/pref_names.h" +#include "brave/components/brave_today/common/pref_names.h" #include "brave/components/brave_vpn/buildflags/buildflags.h" #include "brave/components/brave_wallet/browser/pref_names.h" #include "brave/components/brave_wayback_machine/buildflags.h" @@ -144,6 +145,8 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() { settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_brave_allowlist)[kShowSidePanelButton] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[brave_news::prefs::kShouldShowToolbarButton] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_brave_allowlist)[kLocationBarIsWide] = settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_brave_allowlist)[omnibox::kAutocompleteEnabled] = diff --git a/browser/resources/settings/brave_appearance_page/toolbar.html b/browser/resources/settings/brave_appearance_page/toolbar.html index c14d17653ceb8..dc7546ea398f6 100644 --- a/browser/resources/settings/brave_appearance_page/toolbar.html +++ b/browser/resources/settings/brave_appearance_page/toolbar.html @@ -10,6 +10,11 @@ pref="{{prefs.brave.show_side_panel_button}}" label="$i18n{appearanceSettingsShowSidePanelButton}"> + + SetColorId(color_id.value()); } - if (base::FeatureList::IsEnabled( - brave_today::features::kBraveNewsSubscribeButtonFeature) && - base::FeatureList::IsEnabled(brave_today::features::kBraveNewsFeature) && + if (base::FeatureList::IsEnabled(brave_today::features::kBraveNewsFeature) && !browser_->profile()->IsOffTheRecord()) { brave_news_location_view_ = AddChildView(std::make_unique( diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index 35c096311331d..a4a65bb1fa92b 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -186,7 +186,6 @@ void CustomizeWebUIHTMLSource(content::WebUI* web_ui, { "searchPromotionSearchBoxPlaceholderLabel", IDS_BRAVE_NEW_TAB_SEARCH_PROMOTION_SEARCH_BOX_PLACEHOLDER}, // NOLINT { "braveTodayTitle", IDS_BRAVE_TODAY_TITLE }, - { "braveTodayShowToolbarButton", IDS_BRAVE_TODAY_SHOW_TOOLBAR_BUTTON }, { "braveTodayStatusFetching", IDS_BRAVE_TODAY_STATUS_FETCHING}, { "braveTodayActionRefresh", IDS_BRAVE_TODAY_ACTION_REFRESH}, { "braveTodayScrollHint", IDS_BRAVE_TODAY_SCROLL_HINT}, diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc index d21ab42efc703..665fb39c2c4af 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc +++ b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc @@ -81,8 +81,6 @@ base::Value::Dict GetPreferencesDictionary(PrefService* prefs) { pref_data.Set("showStats", prefs->GetBoolean(kNewTabPageShowStats)); pref_data.Set("showToday", prefs->GetBoolean(brave_news::prefs::kNewTabPageShowToday)); - pref_data.Set("showBraveNewsButton", - prefs->GetBoolean(brave_news::prefs::kShouldShowToolbarButton)); pref_data.Set("showRewards", prefs->GetBoolean(kNewTabPageShowRewards)); pref_data.Set("isBrandedWallpaperNotificationDismissed", prefs->GetBoolean(kBrandedWallpaperNotificationDismissed)); @@ -307,13 +305,9 @@ void BraveNewTabMessageHandler::OnJavascriptAllowed() { base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged, base::Unretained(this))); pref_change_registrar_.Add( - brave_news::prefs::kShouldShowToolbarButton, + kNewTabPageShowRewards, base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged, - base::Unretained(this))), - pref_change_registrar_.Add( - kNewTabPageShowRewards, - base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged, - base::Unretained(this))); + base::Unretained(this))); pref_change_registrar_.Add( kBrandedWallpaperNotificationDismissed, base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged, @@ -425,8 +419,6 @@ void BraveNewTabMessageHandler::HandleSaveNewTabPagePref( settingsKey = kNewTabPageShowStats; } else if (settingsKeyInput == "showToday") { settingsKey = brave_news::prefs::kNewTabPageShowToday; - } else if (settingsKeyInput == "showBraveNewsButton") { - settingsKey = brave_news::prefs::kShouldShowToolbarButton; } else if (settingsKeyInput == "isBraveTodayOptedIn") { settingsKey = brave_news::prefs::kBraveTodayOptedIn; } else if (settingsKeyInput == "showRewards") { diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_ui.cc b/browser/ui/webui/new_tab_page/brave_new_tab_ui.cc index 7b40eba617264..38043f0fd9d19 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_ui.cc +++ b/browser/ui/webui/new_tab_page/brave_new_tab_ui.cc @@ -68,10 +68,6 @@ BraveNewTabUI::BraveNewTabUI(content::WebUI* web_ui, const std::string& name) source->AddBoolean( "featureFlagBraveNewsV2Enabled", base::FeatureList::IsEnabled(brave_today::features::kBraveNewsV2Feature)); - source->AddBoolean( - "featureFlagBraveNewsSubscribeButtonEnabled", - base::FeatureList::IsEnabled( - brave_today::features::kBraveNewsSubscribeButtonFeature)); web_ui->AddMessageHandler( base::WrapUnique(BraveNewTabMessageHandler::Create(source, profile))); diff --git a/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc b/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc index 6a5e18e7e80d8..969e361887400 100644 --- a/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc +++ b/browser/ui/webui/settings/brave_settings_localized_strings_provider.cc @@ -102,6 +102,8 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source, IDS_SETTINGS_APPEARANCE_SETTINGS_LOCATION_BAR_IS_WIDE}, {"appearanceSettingsShowBraveRewardsButtonLabel", IDS_SETTINGS_SHOW_BRAVE_REWARDS_BUTTON_LABEL}, + {"appearanceSettingsShowBraveNewsButtonLabel", + IDS_SETTINGS_SHOW_BRAVE_NEWS_BUTTON_LABEL}, {"appearanceSettingsAlwaysShowBookmarkBarOnNTP", IDS_SETTINGS_ALWAYS_SHOW_BOOKMARK_BAR_ON_NTP}, {"appearanceSettingsShowAutocompleteInAddressBar", diff --git a/chromium_src/chrome/browser/feed/rss_links_fetcher_browsertest.cc b/chromium_src/chrome/browser/feed/rss_links_fetcher_browsertest.cc new file mode 100644 index 0000000000000..da20a6aa0c949 --- /dev/null +++ b/chromium_src/chrome/browser/feed/rss_links_fetcher_browsertest.cc @@ -0,0 +1,28 @@ +// 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 https://mozilla.org/MPL/2.0/. + +#include "base/metrics/histogram_base.h" +#include "base/test/metrics/histogram_tester.h" + +// We use the RSS Links Fetcher from our own TabHelper, which means the +// histogram counts are not what the test expects. Get get around this, we just +// disable the checks for histogram counts. +namespace base { +namespace { +class HistogramTesterStub { + public: + HistogramTesterStub() = default; + ~HistogramTesterStub() = default; + + void ExpectTotalCount(StringPiece name, HistogramBase::Count count) const {} +}; +} // namespace +} // namespace base + +#define HistogramTester HistogramTesterStub + +#include "src/chrome/browser/feed/rss_links_fetcher_browsertest.cc" + +#undef HistogramTester diff --git a/components/brave_new_tab_ui/api/preferences.ts b/components/brave_new_tab_ui/api/preferences.ts index 7925df867f846..a796830a236e9 100644 --- a/components/brave_new_tab_ui/api/preferences.ts +++ b/components/brave_new_tab_ui/api/preferences.ts @@ -30,10 +30,6 @@ export function saveShowToday (value: boolean): void { sendSavePref('showToday', value) } -export function saveShowBraveNewsButton (value: boolean): void { - sendSavePref('showBraveNewsButton', value) -} - export function saveShowRewards (value: boolean): void { sendSavePref('showRewards', value) } diff --git a/components/brave_new_tab_ui/containers/app.tsx b/components/brave_new_tab_ui/containers/app.tsx index d63d088c04769..8adefe75cdbef 100644 --- a/components/brave_new_tab_ui/containers/app.tsx +++ b/components/brave_new_tab_ui/containers/app.tsx @@ -50,7 +50,6 @@ function DefaultPage (props: Props) { actions={actions} saveShowBackgroundImage={PreferencesAPI.saveShowBackgroundImage} saveShowToday={PreferencesAPI.saveShowToday} - saveShowBraveNewsButton={PreferencesAPI.saveShowBraveNewsButton} saveShowRewards={PreferencesAPI.saveShowRewards} saveShowBraveTalk={PreferencesAPI.saveShowBraveTalk} saveBrandedWallpaperOptIn={PreferencesAPI.saveBrandedWallpaperOptIn} diff --git a/components/brave_new_tab_ui/containers/newTab/index.tsx b/components/brave_new_tab_ui/containers/newTab/index.tsx index ce52b92ee82c3..74329e07e2635 100644 --- a/components/brave_new_tab_ui/containers/newTab/index.tsx +++ b/components/brave_new_tab_ui/containers/newTab/index.tsx @@ -46,7 +46,6 @@ interface Props { getBraveNewsDisplayAd: GetDisplayAdContent saveShowBackgroundImage: (value: boolean) => void saveShowToday: (value: boolean) => any - saveShowBraveNewsButton: (value: boolean) => any saveShowRewards: (value: boolean) => void saveShowBraveTalk: (value: boolean) => void saveBrandedWallpaperOptIn: (value: boolean) => void @@ -273,12 +272,6 @@ class NewTabPage extends React.Component { this.props.actions.setMostVisitedSettings(!showTopSites, customLinksEnabled) } - toggleShowBraveNewsButton = () => { - this.props.saveShowBraveNewsButton( - !this.props.newTabData.showBraveNewsButton - ) - } - toggleCustomLinksEnabled = () => { const { showTopSites, customLinksEnabled } = this.props.newTabData this.props.actions.setMostVisitedSettings(showTopSites, !customLinksEnabled) @@ -714,14 +707,12 @@ class NewTabPage extends React.Component { showSettingsMenu={showSettingsMenu} featureFlagBraveNewsEnabled={newTabData.featureFlagBraveNewsEnabled} featureCustomBackgroundEnabled={newTabData.featureCustomBackgroundEnabled} - featureFlagBraveNewsSubscribeButtonEnabled={newTabData.featureFlagBraveNewsSubscribeButtonEnabled} onClose={this.closeSettings} setActiveTab={this.state.activeSettingsTab || undefined} onDisplayTodaySection={this.props.actions.today.ensureSettingsData} onClearTodayPrefs={this.props.actions.today.resetTodayPrefsToDefault} toggleShowBackgroundImage={this.toggleShowBackgroundImage} toggleShowToday={this.toggleShowToday} - toggleShowBraveNewsButton={this.toggleShowBraveNewsButton} toggleShowTopSites={this.toggleShowTopSites} setMostVisitedSettings={this.setMostVisitedSettings} toggleBrandedWallpaperOptIn={this.toggleShowBrandedWallpaper} @@ -732,7 +723,6 @@ class NewTabPage extends React.Component { setColorBackground={this.props.setColorBackground} showBackgroundImage={newTabData.showBackgroundImage} showToday={newTabData.showToday} - showBraveNewsButton={newTabData.showBraveNewsButton} showTopSites={newTabData.showTopSites} customLinksEnabled={newTabData.customLinksEnabled} showRewards={newTabData.showRewards} diff --git a/components/brave_new_tab_ui/containers/newTab/settings.tsx b/components/brave_new_tab_ui/containers/newTab/settings.tsx index d3cfcef421d75..406010c50be81 100644 --- a/components/brave_new_tab_ui/containers/newTab/settings.tsx +++ b/components/brave_new_tab_ui/containers/newTab/settings.tsx @@ -51,13 +51,11 @@ export interface Props { showSettingsMenu: boolean featureFlagBraveNewsEnabled: boolean featureCustomBackgroundEnabled: boolean - featureFlagBraveNewsSubscribeButtonEnabled: boolean onClose: () => void onDisplayTodaySection: () => any onClearTodayPrefs: () => any toggleShowBackgroundImage: () => void toggleShowToday: () => any - toggleShowBraveNewsButton: () => any toggleShowTopSites: () => void setMostVisitedSettings: (show: boolean, customize: boolean) => void toggleShowRewards: () => void @@ -72,7 +70,6 @@ export interface Props { onEnableRewards: () => void showBackgroundImage: boolean showToday: boolean - showBraveNewsButton: boolean showTopSites: boolean customLinksEnabled: boolean brandedWallpaperOptIn: boolean @@ -375,9 +372,6 @@ export default class Settings extends React.PureComponent { onClearPrefs={this.props.onClearTodayPrefs} showToday={this.props.showToday} toggleShowToday={this.props.toggleShowToday} - showBraveNewsButton={this.props.showBraveNewsButton} - featureFlagBraveNewsSubscribeButtonEnabled={this.props.featureFlagBraveNewsSubscribeButtonEnabled} - toggleShowBraveNewsButton={this.props.toggleShowBraveNewsButton} /> ) : null } diff --git a/components/brave_new_tab_ui/containers/newTab/settings/braveToday/index.tsx b/components/brave_new_tab_ui/containers/newTab/settings/braveToday/index.tsx index 93fea0d1580f7..27408d1d78697 100644 --- a/components/brave_new_tab_ui/containers/newTab/settings/braveToday/index.tsx +++ b/components/brave_new_tab_ui/containers/newTab/settings/braveToday/index.tsx @@ -22,9 +22,6 @@ export interface Props { onClearPrefs: () => any showToday: boolean toggleShowToday: () => any - showBraveNewsButton: boolean - featureFlagBraveNewsSubscribeButtonEnabled: boolean - toggleShowBraveNewsButton: () => any } export default function BraveTodayPrefs (props: Props) { @@ -61,16 +58,6 @@ export default function BraveTodayPrefs (props: Props) { /> )} - {!category && - props.showToday && - props.featureFlagBraveNewsSubscribeButtonEnabled && - - {getLocale('braveTodayShowToolbarButton')} - - } {shouldShowSources && } diff --git a/components/brave_new_tab_ui/storage/new_tab_storage.ts b/components/brave_new_tab_ui/storage/new_tab_storage.ts index b5a1b3a8b8e08..92b59f8c788dc 100644 --- a/components/brave_new_tab_ui/storage/new_tab_storage.ts +++ b/components/brave_new_tab_ui/storage/new_tab_storage.ts @@ -16,13 +16,11 @@ export const defaultState: NewTab.State = { featureFlagBraveNewsEnabled: loadTimeData.getBoolean('featureFlagBraveNewsEnabled'), featureFlagBraveNewsV2Enabled: loadTimeData.getBoolean('featureFlagBraveNewsV2Enabled'), featureFlagBraveNewsPromptEnabled: loadTimeData.getBoolean('featureFlagBraveNewsPromptEnabled'), - featureFlagBraveNewsSubscribeButtonEnabled: loadTimeData.getBoolean('featureFlagBraveNewsSubscribeButtonEnabled'), featureCustomBackgroundEnabled: loadTimeData.getBoolean('featureCustomBackgroundEnabled'), searchPromotionEnabled: false, showBackgroundImage: false, showStats: false, showToday: false, - showBraveNewsButton: false, showClock: false, clockFormat: '', showTopSites: false, diff --git a/components/brave_new_tab_ui/stories/regular.tsx b/components/brave_new_tab_ui/stories/regular.tsx index ab02f316c724b..e7db9d6703926 100644 --- a/components/brave_new_tab_ui/stories/regular.tsx +++ b/components/brave_new_tab_ui/stories/regular.tsx @@ -74,7 +74,6 @@ export const Regular = () => { actions={getActions()} saveShowBackgroundImage={doNothing} saveShowToday={doNothing} - saveShowBraveNewsButton={doNothing} saveShowRewards={doNothing} saveShowBraveTalk={doNothing} saveBrandedWallpaperOptIn={onShowBrandedImageChanged} diff --git a/components/brave_today/common/features.cc b/components/brave_today/common/features.cc index 929908cfd88ac..53b4e9b712c31 100644 --- a/components/brave_today/common/features.cc +++ b/components/brave_today/common/features.cc @@ -24,9 +24,6 @@ BASE_FEATURE(kBraveNewsV2Feature, BASE_FEATURE(kBraveNewsCardPeekFeature, "BraveNewsCardPeek", base::FEATURE_ENABLED_BY_DEFAULT); -BASE_FEATURE(kBraveNewsSubscribeButtonFeature, - "BraveNewsSubscribeButton", - base::FEATURE_DISABLED_BY_DEFAULT); } // namespace features } // namespace brave_today diff --git a/components/brave_today/common/features.h b/components/brave_today/common/features.h index 82f15f8c7dcd4..9ffa5f2c1e500 100644 --- a/components/brave_today/common/features.h +++ b/components/brave_today/common/features.h @@ -14,7 +14,6 @@ namespace features { BASE_DECLARE_FEATURE(kBraveNewsFeature); BASE_DECLARE_FEATURE(kBraveNewsV2Feature); BASE_DECLARE_FEATURE(kBraveNewsCardPeekFeature); -BASE_DECLARE_FEATURE(kBraveNewsSubscribeButtonFeature); } // namespace features } // namespace brave_today diff --git a/components/definitions/newTab.d.ts b/components/definitions/newTab.d.ts index e6a1bc720db32..ec09081796437 100644 --- a/components/definitions/newTab.d.ts +++ b/components/definitions/newTab.d.ts @@ -118,7 +118,6 @@ declare namespace NewTab { brandedWallpaperOptIn: boolean showStats: boolean showToday: boolean - showBraveNewsButton: boolean showClock: boolean clockFormat: string showTopSites: boolean @@ -136,7 +135,6 @@ declare namespace NewTab { featureFlagBraveNewsEnabled: boolean featureFlagBraveNewsV2Enabled: boolean featureFlagBraveNewsPromptEnabled: boolean - featureFlagBraveNewsSubscribeButtonEnabled: boolean searchPromotionEnabled: boolean featureCustomBackgroundEnabled: boolean isIncognito: boolean diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index 5087092a74ad4..d166f4cb1f926 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -283,9 +283,6 @@ Brave News - - Show Brave News button in the toolbar - Loading...