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 "Manage custom filters" context menu item #8394

Merged
merged 3 commits into from
Apr 4, 2021
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
12 changes: 12 additions & 0 deletions browser/extensions/api/brave_shields_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/strings/string_number_conversions.h"
#include "brave/browser/brave_browser_process_impl.h"
#include "brave/browser/extensions/api/brave_action_api.h"
#include "brave/browser/ui/brave_pages.h"
#include "brave/browser/webcompat_reporter/webcompat_reporter_dialog.h"
#include "brave/common/extensions/api/brave_shields.h"
#include "brave/components/brave_shields/browser/ad_block_custom_filters_service.h"
Expand All @@ -26,6 +27,7 @@
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/constants.h"
Expand Down Expand Up @@ -161,6 +163,16 @@ BraveShieldsAddSiteCosmeticFilterFunction::Run() {
return RespondNow(NoArguments());
}

ExtensionFunction::ResponseAction
BraveShieldsOpenFilterManagementPageFunction::Run() {
Browser* browser = chrome::FindLastActive();
if (browser) {
brave::ShowBraveAdblock(browser);
}

return RespondNow(NoArguments());
}

ExtensionFunction::ResponseAction BraveShieldsAllowScriptsOnceFunction::Run() {
std::unique_ptr<brave_shields::AllowScriptsOnce::Params> params(
brave_shields::AllowScriptsOnce::Params::Create(*args_));
Expand Down
10 changes: 10 additions & 0 deletions browser/extensions/api/brave_shields_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ class BraveShieldsAddSiteCosmeticFilterFunction : public ExtensionFunction {
ResponseAction Run() override;
};

class BraveShieldsOpenFilterManagementPageFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("braveShields.openFilterManagementPage", UNKNOWN)

protected:
~BraveShieldsOpenFilterManagementPageFunction() override {}

ResponseAction Run() override;
};

class BraveShieldsAllowScriptsOnceFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("braveShields.allowScriptsOnce", UNKNOWN)
Expand Down
6 changes: 6 additions & 0 deletions common/extensions/api/brave_shields.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
}
]
},
{
"name": "openFilterManagementPage",
"type": "function",
"description": "Opens brave://adblock for the purpose of adding, editing, or removing custom filters",
"parameters": []
},
{
"name": "getBraveShieldsEnabled",
"type": "function",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "አንድን ጉዳይ በመምረጫው አማካይነት አግድ ",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "ለዚህ ድረ ገጽ የ CSS ደንቦችን አጥራ ",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "ለሁሉም ድረ ገጾች የ CSS ደንቦችን አጥራ ",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "የላቀ እይታ",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "حظر العنصر عبر المحدد",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "مسح قواعد CSS لهذا الموقع",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "مسح قواعد CSS لجميع المواقع",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "عرض متقدم",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Блокиране на елемента чрез селектор",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Изчистване на правилата за CSS за този сайт",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Изчистване на CSS правилата за всички сайтове",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Допълнителен изглед",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "নির্বাচকের মাধ্যমে উপকরণ ব্লক করুন",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "এই সাইটের জন্য CSS নিয়মগুলি পরিস্কার করুন",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "সমস্ত সাইটের জন্য CSS নিয়মগুলি পরিস্কার করুন",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "উন্নত ভিউ",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Bloqueja l'element a través del selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Esborra les regles de CSS per a aquest lloc",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Esborra les regles de CSS per a tots els llocs",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Vista avançada",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Blokovat prvky přes přepínač",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Vymazat pravidla CSS pro tuto stránku",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Vyčistit pravidla CSS pro všechny stránky",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Pokročilé zobrazení",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Bloker element via vælger",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Ryd CSS-regler for denne side",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Ryd CSS-regler for alle sider",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Avanceret visning",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Element per Wahlschalter blockieren",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "CSS-Regeln für diese Website löschen",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "CSS-Regeln für alle Websites löschen",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Erweiterte Ansicht",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Αποκλείστε το στοιχείο μέσω του επιλογέα",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Καθαρίστε τους κανόνες CSS για αυτόν τον ιστότοπο",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Καθαρίστε τους κανόνες CSS για όλους τους ιστότοπους",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Εμφάνιση για Προχωρημένους",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Block element via selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Clear CSS rules for this site",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Clear CSS rules for all sites\t",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Advanced View",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,9 @@
"message": "Block element via selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Clear CSS rules for this site",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Clear CSS rules for all sites",
"description": "Message for context menu that resets all cosmetic filters"
"manageCustomFilters": {
"message": "Manage custom filters",
"description": "Message for context menu that opens a page for adding, editing, and removing custom cosmetic filters"
},
"advancedView": {
"message": "Advanced View",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Bloquear elemento vía selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Borra las reglas CSS para este sitio web",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Borrar las reglas CSS para todas los sitios web",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Vista avanzada",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Bloquear elemento usando el selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Borrar reglas de CSS en este sitio",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Borrar reglas de CSS en todos los sitios",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Vista avanzada",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Blokeeri element valija kaudu",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Kustuta CSS-i reeglid selle saidi jaoks",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Kustuta CSS-i reeglid kõigi saitide jaoks",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Täpsem vaade",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "مسدود کردن عناصر به‌وسیله انتخابگر",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "پاک کردن قوانین CSS برای این سایت",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "پاک کردن قوانین CSS برای همه سایت‌ها",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "نمای پیشرفته",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Estä elementti valitsimen kautta",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Tyhjennä tämän sivun CSS-säännöt",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Tyhjennä kaikkien sivustojen CSS-säännöt",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Tarkennettu näkymä",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "I-block ang element sa pamamagitan ng selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "I-clear ang CSS rules para sa site na ito",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "I-clear ang CSS rules para sa lahat ng siteI",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Advanced na View",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Bloquer l'élément via le sélecteur",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Supprimer les règles CSS pour ce site",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Supprimer toutes les règles CSS pour tous les sites",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Affichage avancé",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Block element via selector",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Clear CSS rules for this site",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Clear CSS rules for all sites",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Advanced View",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "חסום אלמנט באאמצעות סלקטור",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "נקה כללי CSS עבור אתר זה",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "נקה כללי CSS עבור כל האתרים",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "תצוגה מתקדמת",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "चयनकर्ता द्वारा एलिमेंट को ब्लॉक करें",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "इस साइट के लिए CSS नियम हटाएँ",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "सभी साइटों के लिए CSS नियम हटाएँ",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "उन्नत दृश्य",
"description": "Message for the advanced view option"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@
"message": "Blokiraj element uporabom odabirača",
"description": "Message for context menu that adds a filter for the cosmetic filtering"
},
"resetSiteFilterSettings": {
"message": "Očisti pravila CSS za ovo mjesto",
"description": "Message for context menu that resets the site filters for cosmetic filtering"
},
"resetAllFilterSettings": {
"message": "Očisti pravila CSS za sva mjesta",
"description": "Message for context menu that resets all cosmetic filters"
},
"advancedView": {
"message": "Napredan prikaz",
"description": "Message for the advanced view option"
Expand Down
Loading