Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for enabling experimental list by default #22858

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,17 @@
FEATURE_VALUE_TYPE(brave_shields::features:: \
kBraveAdblockMobileNotificationsListDefault), \
}, \
{ \
"brave-adblock-experimental-list-default", \
"Treat 'Brave Experimental Adblock Rules' as a default list " \
"source", \
\
"Enables the 'Brave Experimental Adblock Rules' regional list if " \
"its toggle in brave://adblock hasn't otherwise been modified", \
kOsAll, \
FEATURE_VALUE_TYPE( \
brave_shields::features::kBraveAdblockExperimentalListDefault), \
}, \
{ \
"brave-adblock-scriptlet-debug-logs", \
"Enable debug logging for scriptlet injections", \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "components/prefs/scoped_user_pref_update.h"

using brave_shields::features::kBraveAdblockCookieListDefault;
using brave_shields::features::kBraveAdblockExperimentalListDefault;
using brave_shields::features::kBraveAdblockMobileNotificationsListDefault;

namespace brave_shields {
Expand All @@ -43,8 +44,14 @@ const ListDefaultOverrideConstants kMobileNotificationsListConstants{
kBraveAdblockMobileNotificationsListDefault),
.list_uuid = kMobileNotificationsListUuid};

const ListDefaultOverrideConstants kOverrideConstants[2] = {
kCookieListConstants, kMobileNotificationsListConstants};
const ListDefaultOverrideConstants kExperimentalListConstants{
.feature =
raw_ref<const base::Feature>(kBraveAdblockExperimentalListDefault),
.list_uuid = kExperimentalListUuid};

const ListDefaultOverrideConstants kOverrideConstants[3] = {
kCookieListConstants, kMobileNotificationsListConstants,
kExperimentalListConstants};

} // namespace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const base::FilePath::CharType kCustomSubscriptionListText[] =
const char kCookieListUuid[] = "AC023D22-AE88-4060-A978-4FEEEC4221693";
const char kMobileNotificationsListUuid[] =
"2F3DCE16-A19A-493C-A88F-2E110FBD37D6";
const char kExperimentalListUuid[] = "564C3B75-8731-404C-AD7C-5683258BA0B0";

const char kCookieListEnabledHistogram[] = "Brave.Shields.CookieListEnabled";
const char kCookieListPromptHistogram[] = "Brave.Shields.CookieListPrompt";
Expand Down
6 changes: 6 additions & 0 deletions components/brave_shields/core/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ BASE_FEATURE(kBraveAdblockCspRules,
BASE_FEATURE(kBraveAdblockMobileNotificationsListDefault,
"BraveAdblockMobileNotificationsListDefault",
base::FEATURE_ENABLED_BY_DEFAULT);
// When enabled, Brave will enable "Brave Experimental Adblock Rules" list by
// default unless overridden by a locally set preference.
// NOTE: this should only be turned on by default in Nightly and Beta.
BASE_FEATURE(kBraveAdblockExperimentalListDefault,
"BraveAdblockExperimentalListDefault",
base::FEATURE_DISABLED_BY_DEFAULT);
// When enabled, Brave will block domains listed in the user's selected adblock
// filters and present a security interstitial with choice to proceed and
// optionally whitelist the domain.
Expand Down
1 change: 1 addition & 0 deletions components/brave_shields/core/common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ BASE_DECLARE_FEATURE(kBraveAdblockCosmeticFiltering);
BASE_DECLARE_FEATURE(kBraveAdblockCspRules);
BASE_DECLARE_FEATURE(kBraveAdblockDefault1pBlocking);
BASE_DECLARE_FEATURE(kBraveAdblockMobileNotificationsListDefault);
BASE_DECLARE_FEATURE(kBraveAdblockExperimentalListDefault);
BASE_DECLARE_FEATURE(kBraveAdblockScriptletDebugLogs);
BASE_DECLARE_FEATURE(kBraveDarkModeBlock);
BASE_DECLARE_FEATURE(kBraveDomainBlock);
Expand Down
Loading