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 */
16import {WinscopeEvent} from 'messaging/winscope_event';
17import {
18  EmitEvent,
19  WinscopeEventEmitter,
20} from 'messaging/winscope_event_emitter';
21import {WinscopeEventListener} from 'messaging/winscope_event_listener';
22import {Trace} from 'trace/trace';
23
24enum ViewType {
25  TAB,
26  OVERLAY,
27}
28
29class View {
30  constructor(
31    public type: ViewType,
32    public traces: Array<Trace<object>>,
33    public htmlElement: HTMLElement,
34    public title: string,
35  ) {}
36}
37
38interface Viewer extends WinscopeEventListener, WinscopeEventEmitter {
39  onWinscopeEvent(event: WinscopeEvent): Promise<void>;
40  setEmitEvent(callback: EmitEvent): void;
41  getViews(): View[];
42  getTraces(): Array<Trace<object>>;
43}
44
45export {Viewer, View, ViewType};
46