Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: desktop-options.js

Issue 29609579: Issue 6031 - Implement Accpetable Ads notification (Closed)
Patch Set: Created Nov. 15, 2017, 5 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « desktop-options.html ('k') | locale/en_US/desktop-options.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: desktop-options.js
===================================================================
--- a/desktop-options.js
+++ b/desktop-options.js
@@ -607,6 +607,9 @@
case "hide-notification":
hideNotification();
break;
+ case "hide-tracking-notification":
+ E("acceptable-ads").classList.remove("show-notification");
+ break;
case "import-subscription": {
let url = E("blockingList-textbox").value;
addEnableSubscription(url);
@@ -1094,6 +1097,23 @@
return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl;
}
+ function hasPrivacyConflict()
+ {
+ let acceptableAdsList = subscriptionsMap[acceptableAdsUrl];
+ let privacyList = null;
+ for (let url in subscriptionsMap)
+ {
+ let subscription = subscriptionsMap[url];
+ if (subscription.recommended == "privacy")
+ {
+ privacyList = subscription;
+ break;
+ }
+ }
+ return acceptableAdsList && acceptableAdsList.disabled == false &&
+ privacyList && privacyList.disabled == false;
+ }
+
function populateLists()
{
subscriptionsMap = Object.create(null);
@@ -1267,6 +1287,16 @@
if (isAcceptableAds(url))
setAcceptableAds();
+ if ((url == acceptableAdsUrl || recommended == "privacy") &&
+ hasPrivacyConflict())
+ {
+ getPref("ui_warn_tracking", (showTrackingWarning) =>
+ {
+ if (showTrackingWarning)
+ E("acceptable-ads").classList.add("show-notification");
+ });
+ }
+
collections.filterLists.addItem(subscription);
break;
case "removed":
@@ -1415,7 +1445,8 @@
browser.runtime.sendMessage({
type: "prefs.listen",
filter: ["notifications_ignoredcategories", "notifications_showui",
- "show_devtools_panel", "shouldShowBlockElementMenu"]
+ "show_devtools_panel", "shouldShowBlockElementMenu",
+ "ui_warn_tracking"]
});
browser.runtime.sendMessage({
type: "subscriptions.listen",
« no previous file with comments | « desktop-options.html ('k') | locale/en_US/desktop-options.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld