From c4afd7237b7720acbf642fc4c6eb529420295dcd Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 23 Jul 2018 21:26:47 +0900 Subject: [wip] implement command usecases --- src/background/infrastructures/content-message-listener.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/background/infrastructures/content-message-listener.js') diff --git a/src/background/infrastructures/content-message-listener.js b/src/background/infrastructures/content-message-listener.js index f16804f..2e84fcc 100644 --- a/src/background/infrastructures/content-message-listener.js +++ b/src/background/infrastructures/content-message-listener.js @@ -1,5 +1,5 @@ import messages from '../../shared/messages'; -import CompletionsController from '../controllers/completions'; +import CommandController from '../controllers/command'; import SettingController from '../controllers/setting'; import FindController from '../controllers/find'; import AddonEnabledController from '../controllers/addon-enabled'; @@ -8,7 +8,7 @@ import LinkController from '../controllers/link'; export default class ContentMessageListener { constructor() { this.settingController = new SettingController(); - this.completionsController = new CompletionsController(); + this.commandController = new CommandController(); this.findController = new FindController(); this.addonEnabledController = new AddonEnabledController(); this.linkController = new LinkController(); @@ -31,6 +31,8 @@ export default class ContentMessageListener { switch (message.type) { case messages.CONSOLE_QUERY_COMPLETIONS: return this.onConsoleQueryCompletions(message.text); + case messages.CONSOLE_ENTER_COMMAND: + return this.onConsoleEnterCommand(message.text); case messages.SETTINGS_QUERY: return this.onSettingsQuery(); case messages.SETTINGS_RELOAD: @@ -48,10 +50,15 @@ export default class ContentMessageListener { } async onConsoleQueryCompletions(line) { - let completions = await this.completionsController.getCompletions(line); + let completions = await this.commandController.getCompletions(line); return Promise.resolve(completions.serialize()); } + onConsoleEnterCommand(text) { + return this.commandController.exec(text); + } + + onSettingsQuery() { return this.settingController.getSetting(); } -- cgit v1.2.3