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

Brave Shields: enable v2 UI refresh by default and introduce flag for legacy v1 #12586

Merged
merged 1 commit into from
Mar 17, 2022
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
26 changes: 17 additions & 9 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@ constexpr char kBraveSkusProdEnvName[] = "production";
constexpr char kBraveSkusStagingEnvName[] = "staging";
constexpr char kBraveSkusDevEnvName[] = "development";

constexpr char kBraveShieldsV1Name[] = "Enable Brave Shields v1";
constexpr char kBraveShieldsV1Description[] =
"Legacy extension-based panel UX/UI for Brave Shields";
constexpr char kBraveShieldsV2Name[] = "Enable Brave Shields v2";
constexpr char kBraveShieldsV2Description[] =
"Major UX/UI overhaul of Brave Shields";
"Major UX/UI overhaul of Brave Shields panel";

constexpr char kBraveDecentralizedDnsName[] = "Enable decentralized DNS";
constexpr char kBraveDecentralizedDnsDescription[] =
Expand Down Expand Up @@ -424,14 +427,19 @@ const flags_ui::FeatureEntry::Choice kBraveSkusEnvChoices[] = {
#endif // BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)

#if !defined(OS_ANDROID)
#define BRAVE_SHIELDS_V2_FEATURE_ENTRIES \
{"brave-shields-v2", \
flag_descriptions::kBraveShieldsV2Name, \
flag_descriptions::kBraveShieldsV2Description, \
kOsDesktop, \
FEATURE_VALUE_TYPE(brave_shields::features::kBraveShieldsPanelV2)},
#define BRAVE_SHIELDS_FEATURE_ENTRIES \
{"brave-shields-v2", \
flag_descriptions::kBraveShieldsV2Name, \
flag_descriptions::kBraveShieldsV2Description, \
kOsDesktop, \
FEATURE_VALUE_TYPE(brave_shields::features::kBraveShieldsPanelV2)}, \
{"brave-shields-v1", \
flag_descriptions::kBraveShieldsV1Name, \
flag_descriptions::kBraveShieldsV1Description, \
kOsDesktop, \
FEATURE_VALUE_TYPE(brave_shields::features::kBraveShieldsPanelV1)},
#else
#define BRAVE_SHIELDS_V2_FEATURE_ENTRIES
#define BRAVE_SHIELDS_FEATURE_ENTRIES
#endif

#define BRAVE_ABOUT_FLAGS_FEATURE_ENTRIES \
Expand Down Expand Up @@ -555,5 +563,5 @@ const flags_ui::FeatureEntry::Choice kBraveSkusEnvChoices[] = {
BRAVE_VPN_FEATURE_ENTRIES \
BRAVE_SKU_SDK_FEATURE_ENTRIES \
SPEEDREADER_FEATURE_ENTRIES \
BRAVE_SHIELDS_V2_FEATURE_ENTRIES \
BRAVE_SHIELDS_FEATURE_ENTRIES \
BRAVE_TRANSLATE_GO_FEATURE_ENTRIES
5 changes: 4 additions & 1 deletion browser/ui/views/brave_actions/brave_actions_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ void BraveActionsContainer::Init() {
AddChildViewAt(brave_button_separator_, 0);
AddActionViewForShields();
// Populate actions
actions_[brave_extension_id].position_ = 1;
if (base::FeatureList::IsEnabled(
brave_shields::features::kBraveShieldsPanelV1)) {
actions_[brave_extension_id].position_ = 1;
}
actions_[brave_rewards_extension_id].position_ = ACTION_ANY_POSITION;

// React to Brave Rewards preferences changes.
Expand Down
5 changes: 4 additions & 1 deletion components/brave_shields/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ const base::Feature kBraveDarkModeBlock{"BraveDarkModeBlock",
// load the cosmetic filter rules using sync ipc
const base::Feature kCosmeticFilteringSyncLoad{
"CosmeticFilterSyncLoad", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, an extension version of the panel will render
const base::Feature kBraveShieldsPanelV1{"BraveShieldsPanelV1",
base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, a mojom version of the panel will render
const base::Feature kBraveShieldsPanelV2{"BraveShieldsPanelV2",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features
} // namespace brave_shields
1 change: 1 addition & 0 deletions components/brave_shields/common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern const base::Feature kBraveDomainBlock1PES;
extern const base::Feature kBraveExtensionNetworkBlocking;
extern const base::Feature kBraveDarkModeBlock;
extern const base::Feature kCosmeticFilteringSyncLoad;
extern const base::Feature kBraveShieldsPanelV1;
extern const base::Feature kBraveShieldsPanelV2;
} // namespace features
} // namespace brave_shields
Expand Down