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'; 24 25/** 26 * The API endpoint to interact programmaticaly with the UI before a trace has 27 * been loaded. This is passed to plugins' OnActivate(). 28 */ 29export interface App { 30 /** 31 * The unique id for this plugin (as specified in the PluginDescriptor), 32 * or '__core__' for the interface exposed to the core. 33 */ 34 readonly pluginId: string; 35 readonly commands: CommandManager; 36 readonly sidebar: SidebarManager; 37 readonly omnibox: OmniboxManager; 38 readonly analytics: Analytics; 39 readonly plugins: PluginManager; 40 readonly pages: PageManager; 41 readonly featureFlags: FeatureFlagManager; 42 43 /** 44 * The parsed querystring passed when starting the app, before any navigation 45 * happens. 46 */ 47 readonly initialRouteArgs: RouteArgs; 48 49 /** 50 * Returns the current trace object, if any. The instance being returned is 51 * bound to the same plugin of App.pluginId. 52 */ 53 readonly trace?: Trace; 54 55 // TODO(primiano): this should be needed in extremely rare cases. We should 56 // probably switch to mithril auto-redraw at some point. 57 scheduleFullRedraw(force?: 'force'): void; 58 59 /** 60 * Navigate to a new page. 61 */ 62 navigate(newHash: string): void; 63 64 openTraceFromFile(file: File): void; 65 openTraceFromUrl(url: string): void; 66 openTraceFromBuffer(args: { 67 buffer: ArrayBuffer; 68 title: string; 69 fileName: string; 70 }): void; 71} 72