add eye adblock setting page for windows
This commit is contained in:
@@ -259,6 +259,7 @@ Add-kill-switch-for-unsupported-clangd-flags.patch
|
||||
|
||||
00AdblockPlus.patch
|
||||
00Eyeo-Adblock-Remove-Privacy-Issues.patch
|
||||
00WIN-Add-adblock-plus-setting-page.patch
|
||||
|
||||
00WIN-ADDTO-Eyeo-Adblock.patch
|
||||
00WIN-ADDTO-Add-an-always-incognito-mode.patch
|
||||
|
||||
@@ -0,0 +1,569 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Thu, 9 Mar 2023 13:39:38 +0000
|
||||
Subject: WIN Add adblock plus setting page
|
||||
|
||||
---
|
||||
chrome/browser/resources/settings/BUILD.gn | 2 +
|
||||
.../settings/adblock_page/adblock_page.html | 185 ++++++++++++++++
|
||||
.../settings/adblock_page/adblock_page.ts | 204 ++++++++++++++++++
|
||||
.../settings/basic_page/basic_page.html | 7 +
|
||||
.../settings/basic_page/basic_page.ts | 1 +
|
||||
.../resources/settings/page_visibility.ts | 1 +
|
||||
chrome/browser/resources/settings/route.ts | 4 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
chrome/browser/resources/settings/settings.ts | 1 +
|
||||
.../settings/settings_menu/settings_menu.html | 5 +
|
||||
tools/typescript/definitions/adblock.d.ts | 33 +++
|
||||
11 files changed, 444 insertions(+)
|
||||
create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.html
|
||||
create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.ts
|
||||
create mode 100644 tools/typescript/definitions/adblock.d.ts
|
||||
|
||||
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn
|
||||
--- a/chrome/browser/resources/settings/BUILD.gn
|
||||
+++ b/chrome/browser/resources/settings/BUILD.gn
|
||||
@@ -78,6 +78,7 @@ build_webui("build") {
|
||||
"a11y_page/a11y_page.ts",
|
||||
"a11y_page/live_caption_section.ts",
|
||||
"about_page/about_page.ts",
|
||||
+ "adblock_page/adblock_page.ts",
|
||||
"appearance_page/appearance_fonts_page.ts",
|
||||
"appearance_page/appearance_page.ts",
|
||||
"appearance_page/home_url_input.ts",
|
||||
@@ -396,6 +397,7 @@ build_webui("build") {
|
||||
ts_composite = true
|
||||
ts_definitions = [
|
||||
"//tools/typescript/definitions/autofill_private.d.ts",
|
||||
+ "//tools/typescript/definitions/adblock.d.ts",
|
||||
"//tools/typescript/definitions/chrome_send.d.ts",
|
||||
"//tools/typescript/definitions/language_settings_private.d.ts",
|
||||
"//tools/typescript/definitions/management.d.ts",
|
||||
diff --git a/chrome/browser/resources/settings/adblock_page/adblock_page.html b/chrome/browser/resources/settings/adblock_page/adblock_page.html
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/resources/settings/adblock_page/adblock_page.html
|
||||
@@ -0,0 +1,185 @@
|
||||
+<!--
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
+ Bromite is free software: you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation, either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ Bromite is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
|
||||
+-->
|
||||
+
|
||||
+<style include="settings-shared cr-shared-style settings-shared action-link iron-flex">
|
||||
+ #languagesCollapse .list-item.selected {
|
||||
+ min-height: var(--settings-row-two-line-min-height);
|
||||
+ }
|
||||
+</style>
|
||||
+<settings-toggle-button class="hr" pref="{{prefs.adblock.enable}}"
|
||||
+ on-change="onAdblockEnabled_"
|
||||
+ label="Ad blocking" data-qa="adblock-toogle">
|
||||
+</settings-toggle-button>
|
||||
+
|
||||
+<div hidden$="[[!prefs.adblock.enable.value]]">
|
||||
+ <div>
|
||||
+ <cr-expand-button class="cr-row first" expanded="{{recommendedSubscriptions}}" data-qa="recommended-subscriptions-menu-item">
|
||||
+ <div>
|
||||
+ Built in Subscriptions
|
||||
+ </div>
|
||||
+ </cr-expand-button>
|
||||
+ <iron-collapse opened="{{recommendedSubscriptions}}">
|
||||
+ <div>
|
||||
+ <!-- if we want description
|
||||
+ <div class="cr-row continuation">
|
||||
+ <div class="cr-padded-text">
|
||||
+ <span>Add or remove language lists subscriptions</span>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ -->
|
||||
+ </div>
|
||||
+ <div class="list-frame vertical-list">
|
||||
+ <template is="dom-repeat" items="[[subscriptions]]">
|
||||
+ <div class="list-item">
|
||||
+ <cr-checkbox id="[[item.url]]" no-set-pref on-change="selectRecommendedSubscription"
|
||||
+ checked="{{item.enabled}}">
|
||||
+ </cr-checkbox>
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <div data-qa="recommended-subscription-list-item">
|
||||
+ [[item.title]]
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </template>
|
||||
+ </div>
|
||||
+ </iron-collapse>
|
||||
+ </div>
|
||||
+ <div>
|
||||
+ <cr-expand-button class="cr-row first" expanded="{{allowedDomainsOpened}}" data-qa="allowed-domains-menu-item">
|
||||
+ <div>
|
||||
+ Allowed Domains
|
||||
+ </div>
|
||||
+ </cr-expand-button>
|
||||
+ <iron-collapse opened="{{allowedDomainsOpened}}">
|
||||
+ <div>
|
||||
+ <!-- if we want description
|
||||
+ <div class="cr-row continuation">
|
||||
+ <div class="cr-padded-text">
|
||||
+ <span>Add or remove language lists subscriptions</span>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ -->
|
||||
+ </div>
|
||||
+ <div class="list-frame vertical-list">
|
||||
+ <template is="dom-repeat" items="{{allowedDomains}}">
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <div data-qa="allowed-domains-list-item">
|
||||
+ [[item]]
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ <cr-button class="button" id="[[item]]" on-click="removeAllowedDomain" data-qa="remove-allowed-domains-btn">
|
||||
+ Remove
|
||||
+ </cr-button>
|
||||
+ </div>
|
||||
+ </template>
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <cr-input slot="inputs" value="{{allowedDomainInput}}" data-qa="allowed-domains-input">
|
||||
+ <cr-button slot="suffix" class="action-button" id="[[item]]" on-click="addAllowedDomain" data-qa="add-allowed-domains-btn">
|
||||
+ Add
|
||||
+ </cr-button>
|
||||
+ </cr-input>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </iron-collapse>
|
||||
+ </div>
|
||||
+ <div>
|
||||
+ <cr-expand-button class="cr-row first" expanded="{{customSubscriptionsOpened}}" data-qa="custom-subscriptions-menu-item">
|
||||
+ <div>
|
||||
+ Custom Subscriptions
|
||||
+ </div>
|
||||
+ </cr-expand-button>
|
||||
+ <iron-collapse opened="{{customSubscriptionsOpened}}">
|
||||
+ <div>
|
||||
+ <!-- if we want description
|
||||
+ <div class="cr-row continuation">
|
||||
+ <div class="cr-padded-text">
|
||||
+ <span>Add or remove language lists subscriptions</span>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ -->
|
||||
+ </div>
|
||||
+ <div class="list-frame vertical-list">
|
||||
+ <template is="dom-repeat" items="{{customSubscriptions}}">
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <div data-qa="custom-subscriptions-list-item">
|
||||
+ [[item]]
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ <cr-button class="button" id="[[item]]" on-click="removeCustomSubscription" data-qa="remove-custom-subscriptions-btn">
|
||||
+ Remove
|
||||
+ </cr-button>
|
||||
+ </div>
|
||||
+ </template>
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <cr-input slot="inputs" value="{{customSubscriptionInput}}" data-qa="custom-subscriptions-input">
|
||||
+ <cr-button slot="suffix" class="action-button" id="[[item]]" on-click="addCustomSubscription" data-qa="add-custom-subscription-btn">
|
||||
+ Add
|
||||
+ </cr-button>
|
||||
+ </cr-input>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </iron-collapse>
|
||||
+ </div>
|
||||
+ <div>
|
||||
+ <cr-expand-button class="cr-row first" expanded="{{customFiltersOpened}}" data-qa="custom-filters-menu-item">
|
||||
+ <div>
|
||||
+ Custom Filters
|
||||
+ </div>
|
||||
+ </cr-expand-button>
|
||||
+ <iron-collapse opened="{{customFiltersOpened}}">
|
||||
+ <div>
|
||||
+ <!-- if we want description
|
||||
+ <div class="cr-row continuation">
|
||||
+ <div class="cr-padded-text">
|
||||
+ <span>Add or remove language lists subscriptions</span>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ -->
|
||||
+ </div>
|
||||
+ <div class="list-frame vertical-list">
|
||||
+ <template is="dom-repeat" items="{{customFilters}}">
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <div data-qa="custom-filters-list-item">
|
||||
+ [[item]]
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ <cr-button class="button" id="[[item]]" on-click="removeCustomFilter" data-qa="remove-custom-filter-btn">
|
||||
+ Remove
|
||||
+ </cr-button>
|
||||
+ </div>
|
||||
+ </template>
|
||||
+ <div class="list-item">
|
||||
+ <div class="start cr-padded-text">
|
||||
+ <cr-input slot="inputs" value="{{customFilterInput}}" data-qa="custom-filter-input">
|
||||
+ <cr-button slot="suffix" class="action-button" id="[[item]]" on-click="addCustomFilter" data-qa="add-custom-filter-btn">
|
||||
+ Add
|
||||
+ </cr-button>
|
||||
+ </cr-input>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </iron-collapse>
|
||||
+ </div>
|
||||
+
|
||||
+</div>
|
||||
diff --git a/chrome/browser/resources/settings/adblock_page/adblock_page.ts b/chrome/browser/resources/settings/adblock_page/adblock_page.ts
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/resources/settings/adblock_page/adblock_page.ts
|
||||
@@ -0,0 +1,204 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
+ Bromite is free software: you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation, either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ Bromite is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
|
||||
+*/
|
||||
+import 'chrome://resources/cr_elements/cr_button/cr_button.js';
|
||||
+import 'chrome://resources/cr_elements/cr_shared_style.css.js';
|
||||
+import 'chrome://resources/polymer/v3_0/iron-collapse/iron-collapse.js';
|
||||
+import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
|
||||
+import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
|
||||
+import '../controls/controlled_button.js';
|
||||
+import '../controls/settings_toggle_button.js';
|
||||
+import '../settings_shared.css.js';
|
||||
+
|
||||
+
|
||||
+import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js';
|
||||
+import { BaseMixin } from '../base_mixin.js';
|
||||
+import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
|
||||
+import { SettingsToggleButtonElement } from '../controls/settings_toggle_button.js';
|
||||
+import { PrefsMixin } from '../prefs/prefs_mixin.js';
|
||||
+import { CrCheckboxElement } from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js';
|
||||
+import { getTemplate } from './adblock_page.html.js';
|
||||
+
|
||||
+
|
||||
+const SettingsAdblockPageElementBase =
|
||||
+ I18nMixin(PrefsMixin(BaseMixin((PolymerElement))));
|
||||
+
|
||||
+export class SettingsAdblockPageElement extends
|
||||
+ SettingsAdblockPageElementBase {
|
||||
+ static get is() {
|
||||
+ return 'settings-adblock-page';
|
||||
+ }
|
||||
+
|
||||
+ static get template() {
|
||||
+ return getTemplate();
|
||||
+ }
|
||||
+
|
||||
+ // input fields updated by html
|
||||
+ public customSubscriptionInput: string;
|
||||
+ public customFilterInput: string;
|
||||
+ public allowedDomainInput: string;
|
||||
+
|
||||
+ // models that will fill templates lists in html
|
||||
+ public customSubscriptions: Array<string> = [];
|
||||
+ public customFilters: Array<string> = [];
|
||||
+ public allowedDomains: Array<string> = [];
|
||||
+ public subscriptions: chrome.adblockPrivate.Subscription[] = [];
|
||||
+
|
||||
+ private syncSubscriptions() {
|
||||
+ this.subscriptions = []
|
||||
+ this.customSubscriptions = [];
|
||||
+
|
||||
+ chrome.adblockPrivate.getBuiltInSubscriptions(list => {
|
||||
+ chrome.adblockPrivate.getInstalledSubscriptions(activelist => {
|
||||
+ let new_subscriptions: chrome.adblockPrivate.Subscription[] = [];
|
||||
+ let custom_subscriptions: string[] = [];
|
||||
+
|
||||
+ list.forEach(obj => {
|
||||
+ new_subscriptions.push({
|
||||
+ title: obj.title,
|
||||
+ enabled: false,
|
||||
+ url: obj.url
|
||||
+ })
|
||||
+ })
|
||||
+
|
||||
+ activelist.forEach(obj => {
|
||||
+ var found = new_subscriptions.find(element => element.url == obj.url);
|
||||
+ if (found != undefined) {
|
||||
+ found.enabled = true;
|
||||
+ } else {
|
||||
+ custom_subscriptions.push(obj.url)
|
||||
+ }
|
||||
+ })
|
||||
+
|
||||
+ this.subscriptions = new_subscriptions;
|
||||
+ this.customSubscriptions = custom_subscriptions;
|
||||
+ })
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private syncCustomFilters() {
|
||||
+ chrome.adblockPrivate.getCustomFilters(domain => {
|
||||
+ this.customFilters = [];
|
||||
+ domain.forEach(value => {
|
||||
+ this.customFilters.push(value);
|
||||
+ })
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private syncAllowedDomains() {
|
||||
+ chrome.adblockPrivate.getAllowedDomains(domain => {
|
||||
+ this.allowedDomains = [];
|
||||
+ domain.forEach(value => {
|
||||
+ this.allowedDomains.push(value);
|
||||
+ })
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ public override ready() {
|
||||
+ super.ready();
|
||||
+
|
||||
+ this.syncSubscriptions();
|
||||
+ this.syncCustomFilters();
|
||||
+ this.syncAllowedDomains();
|
||||
+ }
|
||||
+
|
||||
+ private onAdblockEnabled_(event: Event) {
|
||||
+ if ((event.target as SettingsToggleButtonElement).checked) {
|
||||
+ chrome.adblockPrivate.setEnabled(true);
|
||||
+ } else {
|
||||
+ chrome.adblockPrivate.setEnabled(false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private cleanUrl(url: string) : string {
|
||||
+ let cleanedUrl : string = "";
|
||||
+ try {
|
||||
+ cleanedUrl = new URL(url).host;
|
||||
+ } catch (err) {
|
||||
+ try {
|
||||
+ // one last try by adding schema
|
||||
+ cleanedUrl = new URL("https://" + url).host;
|
||||
+ }
|
||||
+ catch (err) {
|
||||
+ console.log("malformed url " + url);
|
||||
+ }
|
||||
+ }
|
||||
+ return cleanedUrl;
|
||||
+ }
|
||||
+
|
||||
+ private selectRecommendedSubscription(e: Event) {
|
||||
+ const url = ((e.target as CrCheckboxElement).id);
|
||||
+ const enabled = ((e.target as CrCheckboxElement).checked);
|
||||
+ if (enabled) {
|
||||
+ chrome.adblockPrivate.installSubscription(url);
|
||||
+ } else {
|
||||
+ chrome.adblockPrivate.uninstallSubscription(url);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private removeCustomFilter(e: Event) {
|
||||
+ const filter = ((e.target as HTMLElement).id);
|
||||
+ chrome.adblockPrivate.removeCustomFilter(filter);
|
||||
+ const i = this.customFilters.indexOf(filter);
|
||||
+ this.splice('customFilters', i, 1);
|
||||
+ }
|
||||
+
|
||||
+ private addCustomFilter() {
|
||||
+ if (this.customFilterInput == undefined || this.customFilterInput == "") return;
|
||||
+ chrome.adblockPrivate.addCustomFilter(this.customFilterInput);
|
||||
+ this.customFilterInput = "";
|
||||
+ this.syncCustomFilters();
|
||||
+ }
|
||||
+
|
||||
+ private removeAllowedDomain(e: Event) {
|
||||
+ const allowedDomain = ((e.target as HTMLElement).id);
|
||||
+ chrome.adblockPrivate.removeAllowedDomain(allowedDomain);
|
||||
+ const i = this.allowedDomains.indexOf(allowedDomain);
|
||||
+ this.splice('allowedDomains', i, 1);
|
||||
+ }
|
||||
+
|
||||
+ private addAllowedDomain() {
|
||||
+ if (this.allowedDomainInput == undefined || this.allowedDomainInput == "") return;
|
||||
+ const cleanedUrl = this.cleanUrl(this.allowedDomainInput);
|
||||
+ if (cleanedUrl == "") return;
|
||||
+ chrome.adblockPrivate.addAllowedDomain(cleanedUrl);
|
||||
+ this.allowedDomainInput = "";
|
||||
+ this.syncAllowedDomains();
|
||||
+ }
|
||||
+
|
||||
+ private removeCustomSubscription(e: Event) {
|
||||
+ const subscription = ((e.target as HTMLElement).id);
|
||||
+ chrome.adblockPrivate.uninstallSubscription(subscription);
|
||||
+ const i = this.customSubscriptions.indexOf(subscription);
|
||||
+ this.splice('customSubscriptions', i, 1);
|
||||
+ }
|
||||
+
|
||||
+ private addCustomSubscription() {
|
||||
+ if (this.customSubscriptionInput == undefined || this.customSubscriptionInput == "") return;
|
||||
+ chrome.adblockPrivate.installSubscription(this.customSubscriptionInput);
|
||||
+ this.customSubscriptionInput = "";
|
||||
+ this.syncSubscriptions();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+declare global {
|
||||
+ interface HTMLElementTagNameMap {
|
||||
+ 'settings-adblock-page': SettingsAdblockPageElement;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+customElements.define(
|
||||
+ SettingsAdblockPageElement.is, SettingsAdblockPageElement);
|
||||
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.html b/chrome/browser/resources/settings/basic_page/basic_page.html
|
||||
--- a/chrome/browser/resources/settings/basic_page/basic_page.html
|
||||
+++ b/chrome/browser/resources/settings/basic_page/basic_page.html
|
||||
@@ -24,6 +24,13 @@
|
||||
</settings-people-page>
|
||||
</settings-section>
|
||||
</template>
|
||||
+ <template is="dom-if" if="[[showPage_(pageVisibility.adblock)]]"
|
||||
+ restamp>
|
||||
+ <settings-section page-title="Adblock"
|
||||
+ section="adblock">
|
||||
+ <settings-adblock-page prefs="{{prefs}}"></settings-adblock-page>
|
||||
+ </settings-section>
|
||||
+ </template>
|
||||
<template is="dom-if" if="[[showPage_(pageVisibility.autofill)]]"
|
||||
restamp>
|
||||
<settings-section page-title="$i18n{autofillPageTitle}"
|
||||
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.ts b/chrome/browser/resources/settings/basic_page/basic_page.ts
|
||||
--- a/chrome/browser/resources/settings/basic_page/basic_page.ts
|
||||
+++ b/chrome/browser/resources/settings/basic_page/basic_page.ts
|
||||
@@ -10,6 +10,7 @@ import 'chrome://resources/cr_elements/cr_hidden_style.css.js';
|
||||
import 'chrome://resources/cr_elements/cr_shared_style.css.js';
|
||||
import 'chrome://resources/cr_elements/cr_shared_vars.css.js';
|
||||
import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
|
||||
+import '../adblock_page/adblock_page.js';
|
||||
import '../appearance_page/appearance_page.js';
|
||||
import '../privacy_page/privacy_guide_promo.js';
|
||||
import '../privacy_page/privacy_page.js';
|
||||
diff --git a/chrome/browser/resources/settings/page_visibility.ts b/chrome/browser/resources/settings/page_visibility.ts
|
||||
--- a/chrome/browser/resources/settings/page_visibility.ts
|
||||
+++ b/chrome/browser/resources/settings/page_visibility.ts
|
||||
@@ -9,6 +9,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.js';
|
||||
*/
|
||||
export interface PageVisibility {
|
||||
a11y?: boolean;
|
||||
+ adblock?: boolean;
|
||||
advancedSettings?: boolean;
|
||||
appearance?: boolean|AppearancePageVisibility;
|
||||
autofill?: boolean;
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -156,6 +156,10 @@ function createBrowserSettingsRoutes(): SettingsRoutes {
|
||||
r.FONTS = r.APPEARANCE.createChild('/fonts');
|
||||
}
|
||||
|
||||
+ if (visibility.adblock !== false) {
|
||||
+ r.ADBLOCK = r.BASIC.createSection('/adblock', 'adblock');
|
||||
+ }
|
||||
+
|
||||
if (visibility.autofill !== false) {
|
||||
r.AUTOFILL = r.BASIC.createSection(
|
||||
'/autofill', 'autofill', loadTimeData.getString('autofillPageTitle'));
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -13,6 +13,7 @@ import {dedupingMixin, PolymerElement} from 'chrome://resources/polymer/v3_0/pol
|
||||
*/
|
||||
export interface SettingsRoutes {
|
||||
ABOUT: Route;
|
||||
+ ADBLOCK: Route;
|
||||
ACCESSIBILITY: Route;
|
||||
ADDRESSES: Route;
|
||||
ADVANCED: Route;
|
||||
diff --git a/chrome/browser/resources/settings/settings.ts b/chrome/browser/resources/settings/settings.ts
|
||||
--- a/chrome/browser/resources/settings/settings.ts
|
||||
+++ b/chrome/browser/resources/settings/settings.ts
|
||||
@@ -24,6 +24,7 @@ export {AppearanceBrowserProxy, AppearanceBrowserProxyImpl} from './appearance_p
|
||||
export {SettingsAppearancePageElement, SystemTheme} from './appearance_page/appearance_page.js';
|
||||
export {HomeUrlInputElement} from './appearance_page/home_url_input.js';
|
||||
export {SettingsAutofillPageElement} from './autofill_page/autofill_page.js';
|
||||
+export {SettingsAdblockPageElement} from './adblock_page/adblock_page.js';
|
||||
export {AccountStorageOptInStateChangedListener, CredentialsChangedListener, PasswordCheckInteraction, PasswordCheckReferrer, PasswordCheckStatusChangedListener, PasswordExceptionListChangedListener, PasswordManagerAuthTimeoutListener, PasswordManagerImpl, PasswordManagerProxy, PasswordsFileExportProgressListener, SavedPasswordListChangedListener} from './autofill_page/password_manager_proxy.js';
|
||||
export {BaseMixin} from './base_mixin.js';
|
||||
export {SettingsBasicPageElement} from './basic_page/basic_page.js';
|
||||
diff --git a/chrome/browser/resources/settings/settings_menu/settings_menu.html b/chrome/browser/resources/settings/settings_menu/settings_menu.html
|
||||
--- a/chrome/browser/resources/settings/settings_menu/settings_menu.html
|
||||
+++ b/chrome/browser/resources/settings/settings_menu/settings_menu.html
|
||||
@@ -138,6 +138,11 @@
|
||||
$i18n{a11yPageTitle}
|
||||
<paper-ripple></paper-ripple>
|
||||
</a>
|
||||
+ <a role="menuitem" id="adblock" href="/adblock" class="cr-nav-menu-item" hidden="[[!pageVisibility.adblock]]">
|
||||
+ <iron-icon icon="settings:block"></iron-icon>
|
||||
+ Adblock
|
||||
+ <paper-ripple></paper-ripple>
|
||||
+ </a>
|
||||
<if expr="not chromeos_ash">
|
||||
<a role="menuitem" id="system" href="/system" class="cr-nav-menu-item"
|
||||
hidden="[[!pageVisibility.system]]">
|
||||
diff --git a/tools/typescript/definitions/adblock.d.ts b/tools/typescript/definitions/adblock.d.ts
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/tools/typescript/definitions/adblock.d.ts
|
||||
@@ -0,0 +1,33 @@
|
||||
+import {ChromeEvent} from './chrome_event.js';
|
||||
+
|
||||
+declare global {
|
||||
+ export namespace chrome {
|
||||
+ export namespace adblockPrivate {
|
||||
+ export interface Subscription {
|
||||
+ title: string;
|
||||
+ enabled: boolean;
|
||||
+ url: string;
|
||||
+ }
|
||||
+
|
||||
+ interface SubscriptionCallback { (value: Subscription[]): void }
|
||||
+ interface DomainCallback { (value: string[]): void }
|
||||
+ interface CustomFilterCallback { (value: string[]): void }
|
||||
+
|
||||
+ export function setEnabled(enabled: boolean): void;
|
||||
+
|
||||
+ export function getBuiltInSubscriptions(callback: SubscriptionCallback): void;
|
||||
+ export function getInstalledSubscriptions(callback: SubscriptionCallback): void;
|
||||
+
|
||||
+ export function installSubscription(value: string): void;
|
||||
+ export function uninstallSubscription(value: string): void;
|
||||
+
|
||||
+ export function getAllowedDomains(callback: DomainCallback): void;
|
||||
+ export function addAllowedDomain(value: string): void;
|
||||
+ export function removeAllowedDomain(value: string): void;
|
||||
+
|
||||
+ export function getCustomFilters(callback: CustomFilterCallback): void;
|
||||
+ export function addCustomFilter(value: string): void;
|
||||
+ export function removeCustomFilter(value: string): void;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
Reference in New Issue
Block a user