diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-25 21:55:45 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-25 22:16:49 +0900 |
commit | 48e005dc825a5211b4d3e92ed06ad15e01c23d13 (patch) | |
tree | 255ffc7841f33292a00f5bf0e11e4c4c854fe975 /src/background/usecases/CommandUseCase.ts | |
parent | a2ee6897bfbb95a0cca50ab11042aaf94c5de77c (diff) |
Repeat open, tabopen and winopen command
Diffstat (limited to 'src/background/usecases/CommandUseCase.ts')
-rw-r--r-- | src/background/usecases/CommandUseCase.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/background/usecases/CommandUseCase.ts b/src/background/usecases/CommandUseCase.ts index 921a779..a526cfc 100644 --- a/src/background/usecases/CommandUseCase.ts +++ b/src/background/usecases/CommandUseCase.ts @@ -1,4 +1,5 @@ import { injectable } from 'tsyringe'; +import * as operations from '../../shared/operations'; import * as parsers from './parsers'; import * as urls from '../../shared/urls'; import TabPresenter from '../presenters/TabPresenter'; @@ -7,6 +8,7 @@ import SettingRepository from '../repositories/SettingRepository'; import BookmarkRepository from '../repositories/BookmarkRepository'; import ConsoleClient from '../infrastructures/ConsoleClient'; import ContentMessageClient from '../infrastructures/ContentMessageClient'; +import RepeatUseCase from '../usecases/RepeatUseCase'; @injectable() export default class CommandIndicator { @@ -17,21 +19,36 @@ export default class CommandIndicator { private bookmarkRepository: BookmarkRepository, private consoleClient: ConsoleClient, private contentMessageClient: ContentMessageClient, + private repeatUseCase: RepeatUseCase, ) { } async open(keywords: string): Promise<browser.tabs.Tab> { let url = await this.urlOrSearch(keywords); + this.repeatUseCase.storeLastOperation({ + type: operations.INTERNAL_OPEN_URL, + url, + }); return this.tabPresenter.open(url); } async tabopen(keywords: string): Promise<browser.tabs.Tab> { let url = await this.urlOrSearch(keywords); + this.repeatUseCase.storeLastOperation({ + type: operations.INTERNAL_OPEN_URL, + url, + newTab: true, + }); return this.tabPresenter.create(url); } async winopen(keywords: string): Promise<browser.windows.Window> { let url = await this.urlOrSearch(keywords); + this.repeatUseCase.storeLastOperation({ + type: operations.INTERNAL_OPEN_URL, + url, + newWindow: true, + }); return this.windowPresenter.create(url); } |