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 Twitch adblocking list by default #25546

Closed
Closed
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 @@ -556,6 +556,17 @@
FEATURE_VALUE_TYPE( \
brave_shields::features::kBraveAdblockExperimentalListDefault), \
}, \
{ \
"brave-adblock-twitch-list-default", \
"Treat 'Brave Twitch Adblock Rules' as a default list " \
"source", \
\
"Enables the 'Brave Twitch Adblock Rules' regional list if " \
"its toggle in brave://adblock hasn't otherwise been modified", \
kOsAll, \
FEATURE_VALUE_TYPE( \
brave_shields::features::kBraveAdblockTwitchListDefault), \
}, \
{ \
"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 @@ -29,6 +29,7 @@
using brave_shields::features::kBraveAdblockCookieListDefault;
using brave_shields::features::kBraveAdblockExperimentalListDefault;
using brave_shields::features::kBraveAdblockMobileNotificationsListDefault;
using brave_shields::features::kBraveAdblockTwitchListDefault;

namespace brave_shields {

Expand All @@ -39,23 +40,18 @@ typedef struct ListDefaultOverrideConstants {
const char* list_uuid;
} ListDefaultOverrideConstants;

const ListDefaultOverrideConstants kCookieListConstants{
.feature = raw_ref<const base::Feature>(kBraveAdblockCookieListDefault),
.list_uuid = kCookieListUuid};

const ListDefaultOverrideConstants kMobileNotificationsListConstants{
.feature = raw_ref<const base::Feature>(
kBraveAdblockMobileNotificationsListDefault),
.list_uuid = kMobileNotificationsListUuid};

const ListDefaultOverrideConstants kExperimentalListConstants{
.feature =
raw_ref<const base::Feature>(kBraveAdblockExperimentalListDefault),
.list_uuid = kExperimentalListUuid};

const ListDefaultOverrideConstants kOverrideConstants[3] = {
kCookieListConstants, kMobileNotificationsListConstants,
kExperimentalListConstants};
const ListDefaultOverrideConstants kOverrideConstants[4] = {
{.feature = raw_ref<const base::Feature>(kBraveAdblockCookieListDefault),
.list_uuid = kCookieListUuid},
{.feature = raw_ref<const base::Feature>(
kBraveAdblockMobileNotificationsListDefault),
.list_uuid = kMobileNotificationsListUuid},
{.feature =
raw_ref<const base::Feature>(kBraveAdblockExperimentalListDefault),
.list_uuid = kExperimentalListUuid},
{.feature = raw_ref<const base::Feature>(kBraveAdblockTwitchListDefault),
.list_uuid = kTwitchListUuid},
};

} // namespace

Expand Down
2 changes: 2 additions & 0 deletions components/brave_shields/core/common/brave_shield_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ inline constexpr char kMobileNotificationsListUuid[] =
"2F3DCE16-A19A-493C-A88F-2E110FBD37D6";
inline constexpr char kExperimentalListUuid[] =
"564C3B75-8731-404C-AD7C-5683258BA0B0";
inline constexpr char kTwitchListUuid[] =
"529A3F3B-7EBA-4351-B986-D176A82E7F5A";

inline constexpr char kAdBlockResourceComponentName[] =
"Brave Ad Block Resources Library";
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 @@ -60,6 +60,12 @@ BASE_FEATURE(kBraveAdblockMobileNotificationsListDefault,
BASE_FEATURE(kBraveAdblockExperimentalListDefault,
"BraveAdblockExperimentalListDefault",
base::FEATURE_DISABLED_BY_DEFAULT);
// When enabled, Brave will enable "Brave Twitch Adblock Rules" list by
// default unless overridden by a locally set preference.
// NOTE: should only be turned on by default in Nightly and Beta (for now).
BASE_FEATURE(kBraveAdblockTwitchListDefault,
"BraveAdblockTwitchListDefault",
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 @@ -23,6 +23,7 @@ BASE_DECLARE_FEATURE(kBraveAdblockCspRules);
BASE_DECLARE_FEATURE(kBraveAdblockDefault1pBlocking);
BASE_DECLARE_FEATURE(kBraveAdblockMobileNotificationsListDefault);
BASE_DECLARE_FEATURE(kBraveAdblockExperimentalListDefault);
BASE_DECLARE_FEATURE(kBraveAdblockTwitchListDefault);
BASE_DECLARE_FEATURE(kBraveAdblockScriptletDebugLogs);
BASE_DECLARE_FEATURE(kBraveDarkModeBlock);
BASE_DECLARE_FEATURE(kBraveDomainBlock);
Expand Down
Loading