aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
Diffstat (limited to 'src/background')
-rw-r--r--src/background/di.ts2
-rw-r--r--src/background/operators/impls/InternalOperatorFactoryChain.ts1
-rw-r--r--src/background/presenters/WindowPresenter.ts11
-rw-r--r--src/background/usecases/CommandUseCase.ts3
-rw-r--r--src/background/usecases/TabUseCase.ts1
5 files changed, 12 insertions, 6 deletions
diff --git a/src/background/di.ts b/src/background/di.ts
index 8623f95..9ec3c74 100644
--- a/src/background/di.ts
+++ b/src/background/di.ts
@@ -17,6 +17,7 @@ import { ConsoleClientImpl } from "./infrastructures/ConsoleClient";
import { BrowserSettingRepositoryImpl } from "./repositories/BrowserSettingRepository";
import { RepeatRepositoryImpl } from "./repositories/RepeatRepository";
import { ZoomPresenterImpl } from "./usecases/ZoomPresenter";
+import { WindowPresenterImpl } from "./presenters/WindowPresenter";
container.register("LocalSettingRepository", {
useValue: LocalSettingRepository,
@@ -37,6 +38,7 @@ container.register("RepeatRepository", { useClass: RepeatRepositoryImpl });
container.register("TabRepository", { useClass: TabRepositoryImpl });
container.register("ZoomPresenter", { useClass: ZoomPresenterImpl });
container.register("TabPresenter", { useClass: TabPresenterImpl });
+container.register("WindowPresenter", { useClass: WindowPresenterImpl });
container.register("NavigateClient", { useClass: NavigateClientImpl });
container.register("ConsoleClient", { useClass: ConsoleClientImpl });
container.register("OperatorFactory", { useClass: OperatorFactoryImpl });
diff --git a/src/background/operators/impls/InternalOperatorFactoryChain.ts b/src/background/operators/impls/InternalOperatorFactoryChain.ts
index fd3e010..05615f6 100644
--- a/src/background/operators/impls/InternalOperatorFactoryChain.ts
+++ b/src/background/operators/impls/InternalOperatorFactoryChain.ts
@@ -12,6 +12,7 @@ import * as operations from "../../../shared/operations";
export default class InternalOperatorFactoryChain
implements OperatorFactoryChain {
constructor(
+ @inject("WindowPresenter")
private readonly windowPresenter: WindowPresenter,
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
diff --git a/src/background/presenters/WindowPresenter.ts b/src/background/presenters/WindowPresenter.ts
index 4f37f5d..5eb0f22 100644
--- a/src/background/presenters/WindowPresenter.ts
+++ b/src/background/presenters/WindowPresenter.ts
@@ -1,8 +1,9 @@
-import { injectable } from "tsyringe";
+export default interface WindowPresenter {
+ create(url: string): Promise<void>;
+}
-@injectable()
-export default class WindowPresenter {
- create(url: string): Promise<browser.windows.Window> {
- return browser.windows.create({ url });
+export class WindowPresenterImpl implements WindowPresenter {
+ async create(url: string): Promise<void> {
+ await browser.windows.create({ url });
}
}
diff --git a/src/background/usecases/CommandUseCase.ts b/src/background/usecases/CommandUseCase.ts
index 69ef3ea..cadcad1 100644
--- a/src/background/usecases/CommandUseCase.ts
+++ b/src/background/usecases/CommandUseCase.ts
@@ -16,6 +16,7 @@ export default class CommandIndicator {
constructor(
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
+ @inject("WindowPresenter")
private readonly windowPresenter: WindowPresenter,
private readonly helpPresenter: HelpPresenter,
@inject("CachedSettingRepository")
@@ -46,7 +47,7 @@ export default class CommandIndicator {
return this.tabPresenter.create(url);
}
- async winopen(keywords: string): Promise<browser.windows.Window> {
+ async winopen(keywords: string): Promise<void> {
const url = await this.urlOrSearch(keywords);
this.repeatUseCase.storeLastOperation({
type: operations.INTERNAL_OPEN_URL,
diff --git a/src/background/usecases/TabUseCase.ts b/src/background/usecases/TabUseCase.ts
index 900c305..be01032 100644
--- a/src/background/usecases/TabUseCase.ts
+++ b/src/background/usecases/TabUseCase.ts
@@ -8,6 +8,7 @@ export default class TabUseCase {
constructor(
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
+ @inject("WindowPresenter")
private readonly windowPresenter: WindowPresenter,
@inject("BrowserSettingRepository")
private readonly browserSettingRepository: BrowserSettingRepository