• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15import {RouteArgs} from './route_schema';
16import {CommandManager} from './command';
17import {OmniboxManager} from './omnibox';
18import {SidebarManager} from './sidebar';
19import {Analytics} from './analytics';
20import {PluginManager} from './plugin';
21import {Trace} from './trace';
22import {PageManager} from './page';
23import {FeatureFlagManager} from './feature_flag';
24import {Raf} from './raf';
25
26/**
27 * The API endpoint to interact programmaticaly with the UI before a trace has
28 * been loaded. This is passed to plugins' OnActivate().
29 */
30export interface App {
31  /**
32   * The unique id for this plugin (as specified in the PluginDescriptor),
33   * or '__core__' for the interface exposed to the core.
34   */
35  readonly pluginId: string;
36  readonly commands: CommandManager;
37  readonly sidebar: SidebarManager;
38  readonly omnibox: OmniboxManager;
39  readonly analytics: Analytics;
40  readonly plugins: PluginManager;
41  readonly pages: PageManager;
42  readonly featureFlags: FeatureFlagManager;
43
44  /**
45   * The parsed querystring passed when starting the app, before any navigation
46   * happens.
47   */
48  readonly initialRouteArgs: RouteArgs;
49
50  /**
51   * Returns the current trace object, if any. The instance being returned is
52   * bound to the same plugin of App.pluginId.
53   */
54  readonly trace?: Trace;
55
56  /**
57   * Used to schedule things.
58   */
59  readonly raf: Raf;
60
61  /**
62   * Navigate to a new page.
63   */
64  navigate(newHash: string): void;
65
66  openTraceFromFile(file: File): void;
67  openTraceFromUrl(url: string): void;
68  openTraceFromBuffer(args: {
69    buffer: ArrayBuffer;
70    title: string;
71    fileName: string;
72  }): void;
73}
74