1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import {Trace} from 'trace/trace';
18import {Traces} from 'trace/traces';
19import {TRACE_INFO} from 'trace/trace_info';
20import {ImeTraceType, TraceType} from 'trace/trace_type';
21import {HierarchyTreeNode} from 'trace/tree_node/hierarchy_tree_node';
22import {AbstractViewerInputMethod} from 'viewers/common/abstract_viewer_input_method';
23import {View, ViewType} from 'viewers/viewer';
24import {PresenterInputMethodService} from './presenter_input_method_service';
25
26class ViewerInputMethodService extends AbstractViewerInputMethod {
27  static readonly DEPENDENCIES: ImeTraceType[] = [
28    TraceType.INPUT_METHOD_SERVICE,
29  ];
30
31  override readonly view: View;
32
33  constructor(
34    trace: Trace<HierarchyTreeNode>,
35    traces: Traces,
36    storage: Storage,
37  ) {
38    super(trace, traces, storage);
39    this.view = new View(
40      ViewType.TAB,
41      this.getTraces(),
42      this.htmlElement,
43      TRACE_INFO[TraceType.INPUT_METHOD_SERVICE].name,
44    );
45  }
46
47  override initializePresenter(
48    trace: Trace<HierarchyTreeNode>,
49    traces: Traces,
50    storage: Storage,
51  ) {
52    return new PresenterInputMethodService(
53      trace,
54      traces,
55      storage,
56      this.imeUiCallback,
57    );
58  }
59}
60
61export {ViewerInputMethodService};
62