aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/background/controllers/ConsoleController.ts4
-rw-r--r--src/background/infrastructures/ContentMessageListener.ts14
-rw-r--r--src/background/usecases/ConsoleUseCase.ts9
3 files changed, 14 insertions, 13 deletions
diff --git a/src/background/controllers/ConsoleController.ts b/src/background/controllers/ConsoleController.ts
index 72b9b8e..2a0d75f 100644
--- a/src/background/controllers/ConsoleController.ts
+++ b/src/background/controllers/ConsoleController.ts
@@ -5,7 +5,7 @@ import ConsoleUseCase from "../usecases/ConsoleUseCase";
export default class ConsoleController {
constructor(private readonly consoleUseCase: ConsoleUseCase) {}
- resize(width: number, height: number) {
- return this.consoleUseCase.resize(width, height);
+ resize(senderTabId: number, width: number, height: number) {
+ return this.consoleUseCase.resize(senderTabId, width, height);
}
}
diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts
index ec87938..6023047 100644
--- a/src/background/infrastructures/ContentMessageListener.ts
+++ b/src/background/infrastructures/ContentMessageListener.ts
@@ -81,7 +81,11 @@ export default class ContentMessageListener {
case messages.CONSOLE_ENTER_COMMAND:
return this.onConsoleEnterCommand(message.text);
case messages.CONSOLE_RESIZE:
- return this.onConsoleResize(message.width, message.height);
+ return this.onConsoleResize(
+ senderTab.id!,
+ message.width,
+ message.height
+ );
case messages.SETTINGS_QUERY:
return this.onSettingsQuery();
case messages.FIND_GET_KEYWORD:
@@ -116,8 +120,12 @@ export default class ContentMessageListener {
return this.commandController.exec(text);
}
- onConsoleResize(width: number, height: number): Promise<void> {
- return this.consoleController.resize(width, height);
+ onConsoleResize(
+ senderTabId: number,
+ width: number,
+ height: number
+ ): Promise<void> {
+ return this.consoleController.resize(senderTabId, width, height);
}
async onSettingsQuery(): Promise<unknown> {
diff --git a/src/background/usecases/ConsoleUseCase.ts b/src/background/usecases/ConsoleUseCase.ts
index 329e4ee..7b461e5 100644
--- a/src/background/usecases/ConsoleUseCase.ts
+++ b/src/background/usecases/ConsoleUseCase.ts
@@ -1,21 +1,14 @@
import { inject, injectable } from "tsyringe";
import ConsoleFrameClient from "../clients/ConsoleFrameClient";
-import TabPresenter from "../presenters/TabPresenter";
@injectable()
export default class ConsoleUseCase {
constructor(
- @inject("TabPresenter")
- private readonly tabPresenter: TabPresenter,
@inject("ConsoleFrameClient")
private readonly consoleFrameClient: ConsoleFrameClient
) {}
- async resize(width: number, height: number): Promise<void> {
- const tabId = (await this.tabPresenter.getCurrent()).id;
- if (typeof tabId === "undefined") {
- return;
- }
+ async resize(tabId: number, width: number, height: number): Promise<void> {
return this.consoleFrameClient.resize(tabId, width, height);
}
}