提交 1f199ff7 编写于 作者: J Joao Moreno

ipc: remove vscode:openExternal

#10587
上级 e982cfb1
......@@ -18,7 +18,7 @@ import { EventEmitter } from 'events';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IStorageService } from 'vs/code/electron-main/storage';
import { IPath, VSCodeWindow, ReadyState, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState, IWindowSettings } from 'vs/code/electron-main/window';
import { ipcMain as ipc, app, screen, crashReporter, BrowserWindow, dialog, shell } from 'electron';
import { ipcMain as ipc, app, screen, crashReporter, BrowserWindow, dialog } from 'electron';
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/electron-main/paths';
import { ILifecycleService } from 'vs/code/electron-main/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
......@@ -255,12 +255,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
}
});
ipc.on('vscode:openExternal', (event, url: string) => {
this.logService.log('IPC#vscode-openExternal');
shell.openExternal(url);
});
this.updateService.on('update-downloaded', (update: IUpdate) => {
this.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } });
......
......@@ -39,6 +39,10 @@ export interface IWindowsService {
// TODO@joao: what?
closeExtensionHostWindow(extensionDevelopmentPath: string): TPromise<void>;
showItemInFolder(path: string): TPromise<void>;
// TODO: this needs to be handled from browser process to prevent
// foreground ordering issues on Windows
openExternal(url: string): TPromise<void>;
}
export const IWindowService = createDecorator<IWindowService>('windowService');
......
......@@ -10,9 +10,9 @@ import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IWindowsService } from './windows';
export interface IWindowsChannel extends IChannel {
call(command: 'openFileFolderPicker', args: [number, boolean]): TPromise<void>;
call(command: 'openFilePicker', args: [number, boolean, string]): TPromise<void>;
call(command: 'openFolderPicker', args: [number, boolean]): TPromise<void>;
call(command: 'openFileFolderPicker', arg: [number, boolean]): TPromise<void>;
call(command: 'openFilePicker', arg: [number, boolean, string]): TPromise<void>;
call(command: 'openFolderPicker', arg: [number, boolean]): TPromise<void>;
call(command: 'reloadWindow', arg: number): TPromise<void>;
call(command: 'toggleDevTools', arg: number): TPromise<void>;
call(command: 'closeFolder', arg: number): TPromise<void>;
......@@ -20,15 +20,16 @@ export interface IWindowsChannel extends IChannel {
call(command: 'setRepresentedFilename', arg: [number, string]): TPromise<void>;
call(command: 'getRecentlyOpen', arg: number): TPromise<{ files: string[]; folders: string[]; }>;
call(command: 'focusWindow', arg: number): TPromise<void>;
call(command: 'setDocumentEdited', args: [number, boolean]): TPromise<void>;
call(command: 'toggleMenuBar', args: number): TPromise<void>;
call(command: 'setDocumentEdited', arg: [number, boolean]): TPromise<void>;
call(command: 'toggleMenuBar', arg: number): TPromise<void>;
call(command: 'windowOpen', arg: [string[], boolean]): TPromise<void>;
call(command: 'openNewWindow'): TPromise<void>;
call(command: 'showWindow', arg: number): TPromise<void>;
call(command: 'getWindows'): TPromise<{ id: number; path: string; title: string; }[]>;
call(command: 'log', args: [string, string[]]): TPromise<void>;
call(command: 'closeExtensionHostWindow', args: string): TPromise<void>;
call(command: 'showItemInFolder', args: string): TPromise<void>;
call(command: 'log', arg: [string, string[]]): TPromise<void>;
call(command: 'closeExtensionHostWindow', arg: string): TPromise<void>;
call(command: 'showItemInFolder', arg: string): TPromise<void>;
call(command: 'openExternal', arg: string): TPromise<void>;
call(command: string, arg?: any): TPromise<any>;
}
......@@ -58,6 +59,7 @@ export class WindowsChannel implements IWindowsChannel {
case 'log': return this.service.log(arg[0], arg[1]);
case 'closeExtensionHostWindow': return this.service.closeExtensionHostWindow(arg);
case 'showItemInFolder': return this.service.showItemInFolder(arg);
case 'openExternal': return this.service.openExternal(arg);
}
}
}
......@@ -147,4 +149,8 @@ export class WindowsChannelClient implements IWindowsService {
showItemInFolder(path: string): TPromise<void> {
return this.channel.call('showItemInFolder', path);
}
openExternal(url: string): TPromise<void> {
return this.channel.call('openExternal', url);
}
}
\ No newline at end of file
......@@ -182,4 +182,9 @@ export class WindowsService implements IWindowsService {
shell.showItemInFolder(path);
return TPromise.as(null);
}
openExternal(url: string): TPromise<void> {
shell.openExternal(url);
return TPromise.as(null);
}
}
\ No newline at end of file
......@@ -121,8 +121,7 @@ export class ElectronWindow {
// Handle window.open() calls
const $this = this;
(<any>window).open = function (url: string, target: string, features: string, replace: boolean) {
$this.openExternal(url);
$this.windowsService.openExternal(url);
return null;
};
}
......@@ -157,8 +156,4 @@ export class ElectronWindow {
focus(): TPromise<void> {
return this.windowService.focusWindow();
}
public openExternal(url: string): void {
ipc.send('vscode:openExternal', url); // handled from browser process to prevent foreground ordering issues on Windows
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册