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

Side by Side Diff: messageResponder.js

Issue 29564735: Issue 5587 - Use options module (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Include check for mobile-options.html Created Oct. 5, 2017, 12:08 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ext/background.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 21 matching lines...) Expand all
32 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); 32 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses");
33 const {Synchronizer} = require("synchronizer"); 33 const {Synchronizer} = require("synchronizer");
34 34
35 const info = require("info"); 35 const info = require("info");
36 const { 36 const {
37 Subscription, 37 Subscription,
38 DownloadableSubscription, 38 DownloadableSubscription,
39 SpecialSubscription 39 SpecialSubscription
40 } = require("subscriptionClasses"); 40 } = require("subscriptionClasses");
41 41
42 const {showOptions} = require("options");
43
42 port.on("types.get", (message, sender) => 44 port.on("types.get", (message, sender) =>
43 { 45 {
44 let filterTypes = Array.from(require("requestBlocker").filterTypes); 46 let filterTypes = Array.from(require("requestBlocker").filterTypes);
45 filterTypes.push(...filterTypes.splice(filterTypes.indexOf("OTHER"), 1)); 47 filterTypes.push(...filterTypes.splice(filterTypes.indexOf("OTHER"), 1));
46 return filterTypes; 48 return filterTypes;
47 }); 49 });
48 50
49 function convertObject(keys, obj) 51 function convertObject(keys, obj)
50 { 52 {
51 let result = {}; 53 let result = {};
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 207
206 port.on("app.listen", (message, sender) => 208 port.on("app.listen", (message, sender) =>
207 { 209 {
208 getListenerFilters(sender.page).app = message.filter; 210 getListenerFilters(sender.page).app = message.filter;
209 }); 211 });
210 212
211 port.on("app.open", (message, sender) => 213 port.on("app.open", (message, sender) =>
212 { 214 {
213 if (message.what == "options") 215 if (message.what == "options")
214 { 216 {
215 ext.showOptions(() => 217 showOptions(() =>
216 { 218 {
217 if (!message.action) 219 if (!message.action)
218 return; 220 return;
219 221
220 sendMessage("app", message.action, ...message.args); 222 sendMessage("app", message.action, ...message.args);
221 }); 223 });
222 } 224 }
223 }); 225 });
224 226
225 port.on("filters.add", (message, sender) => 227 port.on("filters.add", (message, sender) =>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 port.on("subscriptions.add", (message, sender) => 347 port.on("subscriptions.add", (message, sender) =>
346 { 348 {
347 let subscription = Subscription.fromURL(message.url); 349 let subscription = Subscription.fromURL(message.url);
348 if (message.confirm) 350 if (message.confirm)
349 { 351 {
350 if ("title" in message) 352 if ("title" in message)
351 subscription.title = message.title; 353 subscription.title = message.title;
352 if ("homepage" in message) 354 if ("homepage" in message)
353 subscription.homepage = message.homepage; 355 subscription.homepage = message.homepage;
354 356
355 ext.showOptions(() => 357 showOptions(() =>
356 { 358 {
357 sendMessage("app", "addSubscription", subscription); 359 sendMessage("app", "addSubscription", subscription);
358 }); 360 });
359 } 361 }
360 else 362 else
361 { 363 {
362 addSubscription(subscription, message); 364 addSubscription(subscription, message);
363 } 365 }
364 }); 366 });
365 367
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (message.url) 416 if (message.url)
415 subscriptions = [Subscription.fromURL(message.url)]; 417 subscriptions = [Subscription.fromURL(message.url)];
416 418
417 for (let subscription of subscriptions) 419 for (let subscription of subscriptions)
418 { 420 {
419 if (subscription instanceof DownloadableSubscription) 421 if (subscription instanceof DownloadableSubscription)
420 Synchronizer.execute(subscription, true); 422 Synchronizer.execute(subscription, true);
421 } 423 }
422 }); 424 });
423 })(this); 425 })(this);
OLDNEW
« no previous file with comments | « ext/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld