aboutsummaryrefslogtreecommitdiff
path: root/src/background/operators/impls
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-12-02 22:40:10 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-12-09 23:09:34 +0900
commitca804b1b335df0e7a316d12ed9246beec55ff7f2 (patch)
tree6265d1d0b4e7637a10ae9e68e0f2949d11fcd0e4 /src/background/operators/impls
parentddf912804fc4cb26d388283eacca63a0aeddf779 (diff)
Make background operator as an operator
Diffstat (limited to 'src/background/operators/impls')
-rw-r--r--src/background/operators/impls/CommandOperatorFactoryChain.ts1
-rw-r--r--src/background/operators/impls/InternalOperatorFactoryChain.ts1
-rw-r--r--src/background/operators/impls/NavigateOperatorFactoryChain.ts2
-rw-r--r--src/background/operators/impls/RepeatOperatorFactoryChain.ts1
-rw-r--r--src/background/operators/impls/ResetZoomOperator.ts7
-rw-r--r--src/background/operators/impls/ShowAddBookmarkOperator.ts2
-rw-r--r--src/background/operators/impls/ZoomInOperator.ts6
-rw-r--r--src/background/operators/impls/ZoomOperatorFactoryChain.ts15
-rw-r--r--src/background/operators/impls/ZoomOutOperator.ts6
9 files changed, 25 insertions, 16 deletions
diff --git a/src/background/operators/impls/CommandOperatorFactoryChain.ts b/src/background/operators/impls/CommandOperatorFactoryChain.ts
index 7432153..680a384 100644
--- a/src/background/operators/impls/CommandOperatorFactoryChain.ts
+++ b/src/background/operators/impls/CommandOperatorFactoryChain.ts
@@ -18,6 +18,7 @@ export default class CommandOperatorFactoryChain
constructor(
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
+ @inject("ConsoleClient")
private readonly consoleClient: ConsoleClient
) {}
diff --git a/src/background/operators/impls/InternalOperatorFactoryChain.ts b/src/background/operators/impls/InternalOperatorFactoryChain.ts
index 607dbfa..fd3e010 100644
--- a/src/background/operators/impls/InternalOperatorFactoryChain.ts
+++ b/src/background/operators/impls/InternalOperatorFactoryChain.ts
@@ -15,6 +15,7 @@ export default class InternalOperatorFactoryChain
private readonly windowPresenter: WindowPresenter,
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
+ @inject("ConsoleClient")
private readonly consoleClient: ConsoleClient
) {}
diff --git a/src/background/operators/impls/NavigateOperatorFactoryChain.ts b/src/background/operators/impls/NavigateOperatorFactoryChain.ts
index d9b1619..618db45 100644
--- a/src/background/operators/impls/NavigateOperatorFactoryChain.ts
+++ b/src/background/operators/impls/NavigateOperatorFactoryChain.ts
@@ -20,7 +20,9 @@ export default class NavigateOperatorFactoryChain
constructor(
@inject("TabPresenter")
private readonly tabPresenter: TabPresenter,
+ @inject("NavigateClient")
private readonly navigateClient: NavigateClient,
+ @inject("BrowserSettingRepository")
private readonly browserSettingRepository: BrowserSettingRepository
) {}
diff --git a/src/background/operators/impls/RepeatOperatorFactoryChain.ts b/src/background/operators/impls/RepeatOperatorFactoryChain.ts
index 9d67b75..5038d48 100644
--- a/src/background/operators/impls/RepeatOperatorFactoryChain.ts
+++ b/src/background/operators/impls/RepeatOperatorFactoryChain.ts
@@ -10,6 +10,7 @@ import * as operations from "../../../shared/operations";
export default class RepeatOperatorFactoryChain
implements OperatorFactoryChain {
constructor(
+ @inject("RepeatRepository")
private readonly repeatRepository: RepeatRepository,
@inject("OperatorFactory")
private readonly operatorFactory: OperatorFactory
diff --git a/src/background/operators/impls/ResetZoomOperator.ts b/src/background/operators/impls/ResetZoomOperator.ts
index 66cf245..48db1d5 100644
--- a/src/background/operators/impls/ResetZoomOperator.ts
+++ b/src/background/operators/impls/ResetZoomOperator.ts
@@ -1,9 +1,10 @@
import Operator from "../Operator";
-import ZoomUseCase from "../../usecases/ZoomUseCase";
+import ZoomPresenter from "../../usecases/ZoomPresenter";
export default class ResetZoomOperator implements Operator {
- constructor(private readonly zoomUseCase: ZoomUseCase) {}
+ constructor(private readonly zoomPresenter: ZoomPresenter) {}
+
run(): Promise<void> {
- return this.zoomUseCase.zoomNutoral();
+ return this.zoomPresenter.resetZoom();
}
}
diff --git a/src/background/operators/impls/ShowAddBookmarkOperator.ts b/src/background/operators/impls/ShowAddBookmarkOperator.ts
index a1752eb..cce4879 100644
--- a/src/background/operators/impls/ShowAddBookmarkOperator.ts
+++ b/src/background/operators/impls/ShowAddBookmarkOperator.ts
@@ -11,7 +11,7 @@ export default class ShowAddBookmarkOperator implements Operator {
async run(): Promise<void> {
const tab = await this.tabPresenter.getCurrent();
- let command = "addookmark ";
+ let command = "addbookmark ";
if (this.alter) {
command += tab.title || "";
}
diff --git a/src/background/operators/impls/ZoomInOperator.ts b/src/background/operators/impls/ZoomInOperator.ts
index 0c44c6f..9ed1861 100644
--- a/src/background/operators/impls/ZoomInOperator.ts
+++ b/src/background/operators/impls/ZoomInOperator.ts
@@ -1,10 +1,10 @@
import Operator from "../Operator";
-import ZoomUseCase from "../../usecases/ZoomUseCase";
+import ZoomPresenter from "../../usecases/ZoomPresenter";
export default class ZoomInOperator implements Operator {
- constructor(private readonly zoomUseCase: ZoomUseCase) {}
+ constructor(private readonly zoomPresenter: ZoomPresenter) {}
run(): Promise<void> {
- return this.zoomUseCase.zoomIn();
+ return this.zoomPresenter.zoomIn();
}
}
diff --git a/src/background/operators/impls/ZoomOperatorFactoryChain.ts b/src/background/operators/impls/ZoomOperatorFactoryChain.ts
index b8858ab..ebcf2a5 100644
--- a/src/background/operators/impls/ZoomOperatorFactoryChain.ts
+++ b/src/background/operators/impls/ZoomOperatorFactoryChain.ts
@@ -1,24 +1,27 @@
-import { injectable } from "tsyringe";
+import { inject, injectable } from "tsyringe";
import Operator from "../Operator";
import OperatorFactoryChain from "../OperatorFactoryChain";
import ZoomInOperator from "./ZoomInOperator";
import ZoomOutOperator from "./ZoomOutOperator";
import ResetZoomOperator from "./ResetZoomOperator";
-import ZoomUseCase from "../../usecases/ZoomUseCase";
+import ZoomPresenter from "../../usecases/ZoomPresenter";
import * as operations from "../../../shared/operations";
@injectable()
export default class ZoomOperatorFactoryChain implements OperatorFactoryChain {
- constructor(private readonly zoomUseCase: ZoomUseCase) {}
+ constructor(
+ @inject("ZoomPresenter")
+ private readonly zoomPresenter: ZoomPresenter
+ ) {}
create(op: operations.Operation): Operator | null {
switch (op.type) {
case operations.ZOOM_IN:
- return new ZoomInOperator(this.zoomUseCase);
+ return new ZoomInOperator(this.zoomPresenter);
case operations.ZOOM_OUT:
- return new ZoomOutOperator(this.zoomUseCase);
+ return new ZoomOutOperator(this.zoomPresenter);
case operations.ZOOM_NEUTRAL:
- return new ResetZoomOperator(this.zoomUseCase);
+ return new ResetZoomOperator(this.zoomPresenter);
}
return null;
}
diff --git a/src/background/operators/impls/ZoomOutOperator.ts b/src/background/operators/impls/ZoomOutOperator.ts
index 7f9cb6b..35f5d3d 100644
--- a/src/background/operators/impls/ZoomOutOperator.ts
+++ b/src/background/operators/impls/ZoomOutOperator.ts
@@ -1,10 +1,10 @@
import Operator from "../Operator";
-import ZoomUseCase from "../../usecases/ZoomUseCase";
+import ZoomPresenter from "../../usecases/ZoomPresenter";
export default class ZoomOutOperator implements Operator {
- constructor(private readonly zoomUseCase: ZoomUseCase) {}
+ constructor(private readonly zoomPresenter: ZoomPresenter) {}
run(): Promise<void> {
- return this.zoomUseCase.zoomOut();
+ return this.zoomPresenter.zoomOut();
}
}