blob: a268d15345370fddeefcf1fbaee1c9af9ee118cd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import {
ConsoleGetCompletionTypesResponse,
ConsoleRequestBookmarksResponse,
ConsoleRequestHistoryResponse,
ConsoleRequestSearchEnginesResponse,
ConsoleRequesttabsResponse
} from "../../shared/messages";
import { injectable } from "tsyringe";
import OpenCompletionUseCase from "../completion/OpenCompletionUseCase";
import TabCompletionUseCase from "../completion/TabCompletionUseCase";
@injectable()
export default class CompletionController {
constructor(
private completionUseCase: OpenCompletionUseCase,
private tabCompletionUseCase: TabCompletionUseCase,
) {
}
async getCompletionTypes(): Promise<ConsoleGetCompletionTypesResponse> {
return this.completionUseCase.getCompletionTypes();
}
async requestSearchEngines(query: string): Promise<ConsoleRequestSearchEnginesResponse> {
const items = await this.completionUseCase.requestSearchEngines(query);
return items.map(name => ({ title: name }));
}
async requestBookmarks(query: string): Promise<ConsoleRequestBookmarksResponse> {
return this.completionUseCase.requestBookmarks(query);
}
async requestHistory(query: string): Promise<ConsoleRequestHistoryResponse> {
return this.completionUseCase.requestHistory(query);
}
async queryTabs(query: string, excludePinned: boolean): Promise<ConsoleRequesttabsResponse> {
return this.tabCompletionUseCase.queryTabs(query, excludePinned);
}
}
|