Merge from vscode 1b314ab317fbff7d799b21754326b7d849889ceb

This commit is contained in:
ADS Merger
2020-07-15 23:51:18 +00:00
parent aae013d498
commit 9d3f12d0b7
554 changed files with 15159 additions and 8223 deletions

View File

@@ -6,6 +6,7 @@
import { localize } from 'vs/nls';
import { Disposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { BrowserWindow, BrowserWindowConstructorOptions, app, AuthInfo, WebContents, Event as ElectronEvent } from 'electron';
type LoginEvent = {
@@ -58,10 +59,12 @@ export class ProxyAuthHandler extends Disposable {
show: true,
title: 'VS Code',
webPreferences: {
nodeIntegration: true,
preload: URI.parse(require.toUrl('vs/base/parts/sandbox/electron-browser/preload.js')).fsPath,
enableWebSQL: false,
sandbox: true,
devTools: false,
enableRemoteModule: false,
nativeWindowOpen: true
v8CacheOptions: 'bypassHeatCheck'
}
};
@@ -72,24 +75,27 @@ export class ProxyAuthHandler extends Disposable {
}
const win = new BrowserWindow(opts);
const config = {};
const baseUrl = require.toUrl('vs/code/electron-browser/proxy/auth.html');
const url = `${baseUrl}?config=${encodeURIComponent(JSON.stringify(config))}`;
const url = require.toUrl('vs/code/electron-sandbox/proxy/auth.html');
const proxyUrl = `${authInfo.host}:${authInfo.port}`;
const title = localize('authRequire', "Proxy Authentication Required");
const message = localize('proxyauth', "The proxy {0} requires authentication.", proxyUrl);
const data = { title, message };
const javascript = 'promptForCredentials(' + JSON.stringify(data) + ')';
const onWindowClose = () => cb('', '');
win.on('close', onWindowClose);
win.setMenu(null);
win.loadURL(url);
win.webContents.executeJavaScript(javascript, true).then(({ username, password }: Credentials) => {
cb(username, password);
win.webContents.on('did-finish-load', () => {
const data = { title, message };
win.webContents.send('vscode:openProxyAuthDialog', data);
});
win.webContents.on('ipc-message', (event, channel, credentials: Credentials) => {
if (channel === 'vscode:proxyAuthResponse') {
const { username, password } = credentials;
cb(username, password);
}
win.removeListener('close', onWindowClose);
win.close();
});
win.loadURL(url);
}
}

View File

@@ -178,8 +178,8 @@ class CodeMain {
environmentService.extensionsPath,
environmentService.nodeCachedDataDir,
environmentService.logsPath,
environmentService.globalStorageHome,
environmentService.workspaceStorageHome,
environmentService.globalStorageHome.fsPath,
environmentService.workspaceStorageHome.fsPath,
environmentService.backupHome.fsPath
].map((path): undefined | Promise<void> => path ? mkdirp(path) : undefined));

View File

@@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { parseArgs, OPTIONS, ParsedArgs } from 'vs/platform/environment/node/argv';
import product from 'vs/platform/product/common/product';
import { IWindowSettings, MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/windows/common/windows';
import { IWindowSettings, MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility, zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { ICodeWindow, IWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows';
@@ -153,6 +153,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen);
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
const options: BrowserWindowConstructorOptions = {
width: this.windowState.width,
height: this.windowState.height,
@@ -169,7 +171,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
webviewTag: true,
enableWebSQL: false,
enableRemoteModule: false,
nativeWindowOpen: true
nativeWindowOpen: true,
zoomFactor: zoomLevelToZoomFactor(windowConfig?.zoomLevel)
}
};
@@ -182,8 +185,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
options.icon = path.join(this.environmentService.appRoot, 'resources/win32/code_150x150.png');
}
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (isMacintosh && !this.useNativeFullScreen()) {
options.fullscreenable = false; // enables simple fullscreen mode
}
@@ -214,6 +215,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
this._win = new BrowserWindow(options);
this._id = this._win.id;
// Open devtools if instructed from command line args
if (this.environmentService.args['open-devtools'] === true) {
this._win.webContents.openDevTools();
}
if (isMacintosh && useCustomTitleStyle) {
this._win.setSheetOffset(22); // offset dialogs by the height of the custom title bar if we have any
}