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

Unified Diff: messageResponder.js

Issue 29333819: Issue 2375 - Implement "Blocking lists" section in new options page (Closed)
Patch Set: Fixed the progress indicator and small fixes Created Feb. 4, 2016, 5:43 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
« background.js ('K') | « locale/en-US/options.json ('k') | options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -47,7 +47,7 @@
}
var convertSubscription = convertObject.bind(null, ["disabled",
- "downloadStatus", "homepage", "lastSuccess", "title", "url"]);
+ "downloadStatus", "homepage", "lastDownload", "title", "url"]);
var convertFilter = convertObject.bind(null, ["text"]);
var changeListeners = null;
@@ -333,8 +333,17 @@
break;
case "subscriptions.toggle":
var subscription = Subscription.fromURL(message.url);
- if (subscription.url in FilterStorage.knownSubscriptions && !subscription.disabled)
- FilterStorage.removeSubscription(subscription);
+ if (subscription.url in FilterStorage.knownSubscriptions)
+ {
+ if (subscription.disabled || message.keepInstalled)
+ {
+ subscription.disabled = !subscription.disabled;
+ FilterNotifier.triggerListeners("subscription.disabled",
+ subscription);
+ }
+ else
+ FilterStorage.removeSubscription(subscription);
+ }
else
{
subscription.disabled = false;
@@ -345,6 +354,19 @@
Synchronizer.execute(subscription);
}
break;
+ case "subscriptions.update":
+ var subscriptions = message.url ? [Subscription.fromURL(message.url)] :
+ FilterStorage.subscriptions;
+ for (var i = 0; i < subscriptions.length; i++)
+ {
+ var subscription = subscriptions[i];
+ if (subscription instanceof DownloadableSubscription)
+ Synchronizer.execute(subscription, true);
+ }
+ break;
+ case "subscriptions.isDownloading":
+ callback(Synchronizer.isExecuting(message.url));
+ break;
}
});
})(this);
« background.js ('K') | « locale/en-US/options.json ('k') | options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld