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

Unified Diff: desktop-options.js

Issue 29609587: Issue 6031 - Implement Acceptable Ads notification (Closed)
Patch Set: Rebased Created Nov. 21, 2017, 2 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
@@ -28,6 +28,7 @@
let acceptableAdsPrivacyUrl = null;
let isCustomFiltersLoaded = false;
let {getMessage} = browser.i18n;
+ let {setElementText} = ext.i18n;
let customFilters = [];
let filterErrors = new Map([
["synchronize_invalid_url",
@@ -907,6 +908,12 @@
{
setLinks("enable-acceptable-ads-description", link);
});
+ setElementText(E("tracking-warning-1"), "options_tracking_warning_1",
+ [getMessage("common_feature_privacy_title"),
+ getMessage("options_acceptableAds_ads_label")]);
+ setElementText(E("tracking-warning-3"), "options_tracking_warning_3",
+ [getMessage("options_acceptableAds_privacy_label")]);
+
getDocLink("privacy_friendly_ads", (link) =>
{
E("enable-acceptable-ads-privacy-description").href = link;
@@ -1094,6 +1101,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 +1291,16 @@
if (isAcceptableAds(url))
setAcceptableAds();
+ if ((url == acceptableAdsUrl || recommended == "privacy") &&
+ hasPrivacyConflict())
+ {
+ getPref("ui_warn_tracking", (showTrackingWarning) =>
+ {
+ if (showTrackingWarning)
+ E("acceptable-ads").classList.add("show-warning");
+ });
+ }
+
collections.filterLists.addItem(subscription);
break;
case "removed":
@@ -1341,6 +1375,10 @@
case "notifications_showui":
hidePref("notifications_ignoredcategories", !value);
break;
+ case "ui_warn_tracking":
+ if (!value)
+ E("acceptable-ads").classList.remove("show-warning");
+ break;
}
let checkbox = document.querySelector(
@@ -1415,7 +1453,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