aboutsummaryrefslogtreecommitdiff
path: root/src/background/infrastructures/content-message-listener.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-23 21:26:47 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-26 21:59:05 +0900
commitc4afd7237b7720acbf642fc4c6eb529420295dcd (patch)
tree1e251d23b8549937c0a3b00f020565b36a412cb3 /src/background/infrastructures/content-message-listener.js
parent0846587baf8ff04d2183985a61f14ccdea7263d3 (diff)
[wip] implement command usecases
Diffstat (limited to 'src/background/infrastructures/content-message-listener.js')
-rw-r--r--src/background/infrastructures/content-message-listener.js13
1 files changed, 10 insertions, 3 deletions
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();
}