[JSDOC2TS]: Migrate View in ui
Bug: chromium:1158760
Change-Id: I3e9ac53ba357195f080da9f85e76e9379fe7417b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2792034
Commit-Queue: Jan Scheffler <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/front_end/ui/View.ts b/front_end/ui/View.ts
new file mode 100644
index 0000000..9dead2d
--- /dev/null
+++ b/front_end/ui/View.ts
@@ -0,0 +1,81 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/* eslint-disable rulesdir/no_underscored_properties */
+
+import {TabbedPane} from './TabbedPane.js'; // eslint-disable-line no-unused-vars
+import {ToolbarItem, ToolbarMenuButton} from './Toolbar.js'; // eslint-disable-line no-unused-vars
+import {ViewManager} from './ViewManager.js';
+import {VBox, Widget} from './Widget.js'; // eslint-disable-line no-unused-vars
+export interface View {
+ viewId(): string;
+
+ title(): string;
+
+ isCloseable(): boolean;
+
+ isTransient(): boolean;
+
+ toolbarItems(): Promise<ToolbarItem[]>;
+
+ widget(): Promise<Widget>;
+
+ disposeView(): void|Promise<void>;
+}
+
+export class SimpleView extends VBox implements View {
+ _title: string;
+ constructor(title: string, isWebComponent?: boolean) {
+ super(isWebComponent);
+ this._title = title;
+ }
+
+ viewId(): string {
+ return this._title;
+ }
+
+ title(): string {
+ return this._title;
+ }
+
+ isCloseable(): boolean {
+ return false;
+ }
+
+ isTransient(): boolean {
+ return false;
+ }
+
+ toolbarItems(): Promise<ToolbarItem[]> {
+ return Promise.resolve([]);
+ }
+
+ widget(): Promise<Widget> {
+ return (Promise.resolve(this) as Promise<Widget>);
+ }
+
+ revealView(): Promise<void> {
+ return ViewManager.instance().revealView(this);
+ }
+
+ disposeView(): void {
+ }
+}
+
+export interface ViewLocation {
+ appendApplicableItems(locationName: string): void;
+ appendView(view: View, insertBefore?: View|null): void;
+ showView(view: View, insertBefore?: View|null, userGesture?: boolean): Promise<void>;
+ removeView(view: View): void;
+ widget(): Widget;
+}
+
+export interface TabbedViewLocation extends ViewLocation {
+ tabbedPane(): TabbedPane;
+ enableMoreTabsButton(): ToolbarMenuButton;
+}
+
+export interface ViewLocationResolver {
+ resolveLocation(location: string): ViewLocation|null;
+}