1 |
|
2 | import { BrowserWindow, Event as ElectronEvent } from '../../electron-shared/electron';
|
3 | import { ForkOptions } from 'child_process';
|
4 | import { FrontendApplicationConfig } from '@theia/application-package/lib/application-props';
|
5 | import URI from '../common/uri';
|
6 | import { Deferred } from '../common/promise-util';
|
7 | import { MaybePromise } from '../common/types';
|
8 | import { ContributionProvider } from '../common/contribution-provider';
|
9 | import { ElectronSecurityTokenService } from './electron-security-token-service';
|
10 | import { ElectronSecurityToken } from '../electron-common/electron-token';
|
11 | import Storage = require('electron-store');
|
12 | import { TheiaBrowserWindowOptions, TheiaElectronWindow, TheiaElectronWindowFactory } from './theia-electron-window';
|
13 | import { ElectronMainApplicationGlobals } from './electron-main-constants';
|
14 | export { ElectronMainApplicationGlobals };
|
15 |
|
16 |
|
17 |
|
18 | export interface ElectronMainCommandOptions {
|
19 | |
20 |
|
21 |
|
22 | readonly file?: string;
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export interface ElectronMainExecutionParams {
|
32 | readonly secondInstance: boolean;
|
33 | readonly argv: string[];
|
34 | readonly cwd: string;
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | export declare const ElectronMainApplicationContribution: unique symbol;
|
56 | export interface ElectronMainApplicationContribution {
|
57 | |
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | onStart?(application: ElectronMainApplication): MaybePromise<void>;
|
64 | |
65 |
|
66 |
|
67 | onStop?(application: ElectronMainApplication): void;
|
68 | }
|
69 | export declare class ElectronMainProcessArgv {
|
70 | protected get processArgvBinIndex(): number;
|
71 | protected get isBundledElectronApp(): boolean;
|
72 | protected get isElectronApp(): boolean;
|
73 | getProcessArgvWithoutBin(argv?: string[]): Array<string>;
|
74 | getProcessArgvBin(argv?: string[]): string;
|
75 | }
|
76 | export declare namespace ElectronMainProcessArgv {
|
77 | interface ElectronMainProcess extends NodeJS.Process {
|
78 | readonly defaultApp: boolean;
|
79 | readonly versions: NodeJS.ProcessVersions & {
|
80 | readonly electron: string;
|
81 | };
|
82 | }
|
83 | }
|
84 | export declare class ElectronMainApplication {
|
85 | protected readonly contributions: ContributionProvider<ElectronMainApplicationContribution>;
|
86 | protected readonly globals: ElectronMainApplicationGlobals;
|
87 | protected processArgv: ElectronMainProcessArgv;
|
88 | protected electronSecurityTokenService: ElectronSecurityTokenService;
|
89 | protected readonly electronSecurityToken: ElectronSecurityToken;
|
90 | protected readonly windowFactory: TheiaElectronWindowFactory;
|
91 | protected readonly electronStore: Storage<{
|
92 | windowstate?: TheiaBrowserWindowOptions | undefined;
|
93 | }>;
|
94 | protected readonly _backendPort: Deferred<number>;
|
95 | readonly backendPort: Promise<number>;
|
96 | protected _config: FrontendApplicationConfig | undefined;
|
97 | protected useNativeWindowFrame: boolean;
|
98 | protected didUseNativeWindowFrameOnStart: Map<number, boolean>;
|
99 | protected windows: Map<number, TheiaElectronWindow>;
|
100 | protected restarting: boolean;
|
101 | get config(): FrontendApplicationConfig;
|
102 | start(config: FrontendApplicationConfig): Promise<void>;
|
103 | protected getTitleBarStyle(config: FrontendApplicationConfig): 'native' | 'custom';
|
104 | protected launch(params: ElectronMainExecutionParams): Promise<void>;
|
105 | |
106 |
|
107 |
|
108 |
|
109 |
|
110 | createWindow(asyncOptions?: MaybePromise<TheiaBrowserWindowOptions>): Promise<BrowserWindow>;
|
111 | getLastWindowOptions(): Promise<TheiaBrowserWindowOptions>;
|
112 | protected avoidOverlap(options: TheiaBrowserWindowOptions): TheiaBrowserWindowOptions;
|
113 | protected getDefaultOptions(): TheiaBrowserWindowOptions;
|
114 | openDefaultWindow(): Promise<BrowserWindow>;
|
115 | protected openWindowWithWorkspace(workspacePath: string): Promise<BrowserWindow>;
|
116 |
|
117 | protected configureNativeSecondaryWindowCreation(electronWindow: BrowserWindow): void;
|
118 | |
119 |
|
120 |
|
121 | requestStop(): void;
|
122 | protected handleMainCommand(params: ElectronMainExecutionParams, options: ElectronMainCommandOptions): Promise<void>;
|
123 | protected createWindowUri(): Promise<URI>;
|
124 | protected getDefaultTheiaWindowOptions(): TheiaBrowserWindowOptions;
|
125 | protected getDefaultTheiaWindowBounds(): TheiaBrowserWindowOptions;
|
126 | |
127 |
|
128 |
|
129 | protected attachSaveWindowState(electronWindow: BrowserWindow): void;
|
130 | protected saveWindowState(electronWindow: BrowserWindow): void;
|
131 | |
132 |
|
133 |
|
134 | protected getCurrentScreenLayout(): string;
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 | protected startBackend(): Promise<number>;
|
141 | protected getForkOptions(): Promise<ForkOptions>;
|
142 | protected attachElectronSecurityToken(port: number): Promise<void>;
|
143 | protected hookApplicationEvents(): void;
|
144 | protected onWillQuit(event: ElectronEvent): void;
|
145 | protected onSecondInstance(event: ElectronEvent, argv: string[], cwd: string): Promise<void>;
|
146 | protected onWindowAllClosed(event: ElectronEvent): void;
|
147 | protected restart(id: number): Promise<void>;
|
148 | protected startContributions(): Promise<void>;
|
149 | protected stopContributions(): void;
|
150 | }
|
151 |
|
\ | No newline at end of file |