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

Implement cosmetic filtering #3303

Merged
merged 9 commits into from Dec 14, 2019

add brave://flags feature to enable cosmetic filtering

  • Loading branch information
antonok-edm committed Nov 22, 2019
commit 5640c42b6ebd8d68fe8a51349b4a62e427e056f1
@@ -3,6 +3,12 @@
* 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/. */

#define BRAVE_FEATURE_ENTRIES \
{"brave-adblock-cosmetic-filtering", \
flag_descriptions::kBraveAdblockCosmeticFilteringName, \
flag_descriptions::kBraveAdblockCosmeticFilteringDescription, kOsAll, \
FEATURE_VALUE_TYPE(features::kBraveAdblockCosmeticFiltering)},

#define SetFeatureEntryEnabled SetFeatureEntryEnabled_ChromiumImpl
#include "../../../../chrome/browser/about_flags.cc" // NOLINT
#include "../../../../components/flags_ui/flags_state.cc" // NOLINT
@@ -0,0 +1,12 @@
/* Copyright (c) 2019 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 "../../../../chrome/browser/flag_descriptions.cc"

namespace flag_descriptions {
const char kBraveAdblockCosmeticFilteringName[] = "Enable cosmetic filtering";
const char kBraveAdblockCosmeticFilteringDescription[] =
"Enable support for cosmetic filtering";
}
@@ -0,0 +1,16 @@
/* Copyright (c) 2019 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_CHROMIUM_SRC_CHROME_BROWSER_FLAG_DESCRIPTIONS_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_FLAG_DESCRIPTIONS_H_

#include "../../../../chrome/browser/flag_descriptions.h"

namespace flag_descriptions {
extern const char kBraveAdblockCosmeticFilteringName[];
extern const char kBraveAdblockCosmeticFilteringDescription[];
}

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_FLAG_DESCRIPTIONS_H_
@@ -0,0 +1,12 @@
/* Copyright (c) 2019 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 "../../../../chrome/common/chrome_features.cc"

namespace features {
const base::Feature kBraveAdblockCosmeticFiltering{
"BraveAdblockCosmeticFiltering",
base::FEATURE_DISABLED_BY_DEFAULT};
}
@@ -0,0 +1,16 @@
/* Copyright (c) 2019 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_CHROMIUM_SRC_CHROME_COMMON_CHROME_FEATURES_H_
#define BRAVE_CHROMIUM_SRC_CHROME_COMMON_CHROME_FEATURES_H_

#include "../../../../chrome/common/chrome_features.h"

namespace features {
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kBraveAdblockCosmeticFiltering;
}

#endif // BRAVE_CHROMIUM_SRC_CHROME_COMMON_CHROME_FEATURES_H_
@@ -21,3 +21,11 @@ index 0ab55be2f96853137cec8928621360e9f639b467..34e01378c8e413af12399bc3ca30188b

const FeatureEntry::Choice kPassiveListenersChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
@@ -4688,6 +4688,7 @@ const FeatureEntry kFeatureEntries[] = {
// "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag
// Histograms" in tools/metrics/histograms/README.md (run the
// AboutFlagsHistogramTest unit test to verify this process).
+ BRAVE_FEATURE_ENTRIES
};

class FlagsStateSingleton {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.