From 66c23423f931bb66c59cd29cf9279a5de5d56535 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 28 Jul 2018 10:42:32 +0900 Subject: Background operation as Clean Architecture --- src/background/infrastructures/content-message-listener.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/background/infrastructures') diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js index 2e84fcc..277d108 100644 --- a/src/background/infrastructures/content-message-listener.js +++ b/src/background/infrastructures/content-message-listener.js @@ -4,6 +4,7 @@ import SettingController from '../controllers/setting'; import FindController from '../controllers/find'; import AddonEnabledController from '../controllers/addon-enabled'; import LinkController from '../controllers/link'; +import OperationController from '../controllers/operation'; export default class ContentMessageListener { constructor() { @@ -12,6 +13,7 @@ export default class ContentMessageListener { this.findController = new FindController(); this.addonEnabledController = new AddonEnabledController(); this.linkController = new LinkController(); + this.backgroundOperationController = new OperationController(); } run() { @@ -46,6 +48,8 @@ export default class ContentMessageListener { case messages.OPEN_URL: return this.onOpenUrl( message.newTab, message.url, sender.tab.id, message.background); + case messages.BACKGROUND_OPERATION: + return this.onBackgroundOperation(message.operation); } } @@ -85,4 +89,8 @@ export default class ContentMessageListener { } return this.linkController.openToTab(url, openerId); } + + onBackgroundOperation(operation) { + return this.backgroundOperationController.exec(operation); + } } -- cgit v1.2.3