-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,444 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
browser/resources/settings/default_brave_shields_page/brave_adblock_browser_proxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* Copyright 2022 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/. */ | ||
|
||
import { sendWithPromise, addWebUIListener } from 'chrome://resources/js/cr.m.js'; | ||
|
||
/** @interface */ | ||
export class BraveAdblockBrowserProxy { | ||
getInstance() { } | ||
getRegionalLists() { } | ||
enableFilterList() { } | ||
getListSubscriptions() { } | ||
getCustomFilters() { } | ||
setSubscriptionEnabled() { } | ||
addSubscription() { } | ||
addWebUIListener() { } | ||
updateSubscription() { } | ||
deleteSubscription() { } | ||
viewSubscription() { } | ||
} | ||
|
||
/** | ||
* @implements {BraveAdblockBrowserProxy} | ||
*/ | ||
export class BraveAdblockBrowserProxyImpl { | ||
/** @instance */ | ||
static getInstance() { | ||
return instance || (instance = new BraveAdblockBrowserProxyImpl()); | ||
} | ||
|
||
/** @returns {Promise} */ | ||
getRegionalLists () { | ||
return sendWithPromise('brave_adblock.getRegionalLists') | ||
} | ||
|
||
/** @returns {Promise} */ | ||
getListSubscriptions () { | ||
return sendWithPromise('brave_adblock.getListSubscriptions') | ||
} | ||
|
||
/** @returns {Promise} */ | ||
getCustomFilters () { | ||
return sendWithPromise('brave_adblock.getCustomFilters') | ||
} | ||
|
||
enableFilterList (uuid, enabled) { | ||
chrome.send('brave_adblock.enableFilterList', [uuid, enabled]) | ||
} | ||
|
||
setSubscriptionEnabled (url, enabled) { | ||
chrome.send('brave_adblock.setSubscriptionEnabled', [url, enabled]) | ||
} | ||
|
||
addSubscription (url) { | ||
chrome.send('brave_adblock.addSubscription', [url]) | ||
} | ||
|
||
updateSubscription (url) { | ||
chrome.send('brave_adblock.updateSubscription', [url]) | ||
} | ||
|
||
updateCustomFilters (value) { | ||
chrome.send('brave_adblock.updateCustomFilters', [value]) | ||
} | ||
|
||
deleteSubscription (url) { | ||
chrome.send('brave_adblock.deleteSubscription', [url]) | ||
} | ||
|
||
viewSubscription (url) { | ||
chrome.send('brave_adblock.viewSubscription', [url]) | ||
} | ||
|
||
addWebUIListener (event_name, callback) { | ||
addWebUIListener(event_name, callback) | ||
} | ||
} | ||
|
||
/** @type {BraveAdblockBrowserProxyImpl} */ | ||
let instance |
Oops, something went wrong.