mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { app, ipcMain as ipc, BrowserWindow } from 'electron';
|
||||
import { app, ipcMain as ipc, BrowserWindow, dialog } from 'electron';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { WindowsManager } from 'vs/code/electron-main/windows';
|
||||
import { IWindowsService, OpenContext } from 'vs/platform/windows/common/windows';
|
||||
@@ -57,12 +57,9 @@ import { IWorkspacesMainService } from 'vs/platform/workspaces/common/workspaces
|
||||
import { dirname, join } from 'path';
|
||||
import { touch } from 'vs/base/node/pfs';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { ProxyOAuthHandler } from 'sql/code/electron-main/oauth';
|
||||
|
||||
export class CodeApplication {
|
||||
|
||||
private static APP_ICON_REFRESH_KEY = 'macOSAppIconRefresh';
|
||||
private static APP_ICON_REFRESH_KEY = 'macOSAppIconRefresh3';
|
||||
|
||||
private toDispose: IDisposable[];
|
||||
private windowsMainService: IWindowsMainService;
|
||||
@@ -79,7 +76,7 @@ export class CodeApplication {
|
||||
@ILogService private logService: ILogService,
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@ILifecycleService private lifecycleService: ILifecycleService,
|
||||
@IConfigurationService private configurationService: ConfigurationService<any>,
|
||||
@IConfigurationService private configurationService: ConfigurationService,
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@IHistoryMainService private historyService: IHistoryMainService
|
||||
) {
|
||||
@@ -137,7 +134,7 @@ export class CodeApplication {
|
||||
!source || (URI.parse(source.toLowerCase()).toString() as any).startsWith(URI.file(this.environmentService.appRoot.toLowerCase()).toString());
|
||||
|
||||
app.on('web-contents-created', (event, contents) => {
|
||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
||||
contents.on('will-attach-webview', (event: Electron.Event, webPreferences, params) => {
|
||||
delete webPreferences.preload;
|
||||
webPreferences.nodeIntegration = false;
|
||||
|
||||
@@ -231,9 +228,9 @@ export class CodeApplication {
|
||||
});
|
||||
|
||||
// Keyboard layout changes
|
||||
KeyboardLayoutMonitor.INSTANCE.onDidChangeKeyboardLayout(isISOKeyboard => {
|
||||
KeyboardLayoutMonitor.INSTANCE.onDidChangeKeyboardLayout(() => {
|
||||
if (this.windowsMainService) {
|
||||
this.windowsMainService.sendToAll('vscode:keyboardLayoutChanged', isISOKeyboard);
|
||||
this.windowsMainService.sendToAll('vscode:keyboardLayoutChanged', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -277,11 +274,6 @@ export class CodeApplication {
|
||||
const authHandler = appInstantiationService.createInstance(ProxyAuthHandler);
|
||||
this.toDispose.push(authHandler);
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Setup OAuth Handler
|
||||
const oauthHandler = appInstantiationService.createInstance(ProxyOAuthHandler);
|
||||
this.toDispose.push(oauthHandler);
|
||||
|
||||
// Open Windows
|
||||
appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor));
|
||||
|
||||
@@ -299,10 +291,11 @@ export class CodeApplication {
|
||||
services.set(ICredentialsService, new SyncDescriptor(CredentialsService));
|
||||
|
||||
// Telemtry
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !!product.enableTelemetry) {
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
|
||||
const channel = getDelayedChannel<ITelemetryAppenderChannel>(this.sharedProcessClient.then(c => c.getChannel('telemetryAppender')));
|
||||
const appender = new TelemetryAppenderClient(channel);
|
||||
const commonProperties = resolveCommonProperties(product.commit, pkg.version)
|
||||
const commonProperties = resolveCommonProperties(product.commit, pkg.version, this.environmentService.installSource)
|
||||
// __GDPR__COMMON__ "common.machineId" : { "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
|
||||
.then(result => Object.defineProperty(result, 'common.machineId', {
|
||||
get: () => this.storageService.getItem(machineIdStorageKey),
|
||||
enumerable: true
|
||||
@@ -378,15 +371,39 @@ export class CodeApplication {
|
||||
private afterWindowOpen(accessor: ServicesAccessor): void {
|
||||
const appInstantiationService = accessor.get(IInstantiationService);
|
||||
|
||||
// Setup Windows mutex
|
||||
let windowsMutex: Mutex = null;
|
||||
if (platform.isWindows) {
|
||||
|
||||
// Setup Windows mutex
|
||||
try {
|
||||
const Mutex = (require.__$__nodeRequire('windows-mutex') as any).Mutex;
|
||||
windowsMutex = new Mutex(product.win32MutexName);
|
||||
this.toDispose.push({ dispose: () => windowsMutex.release() });
|
||||
} catch (e) {
|
||||
// noop
|
||||
if (!this.environmentService.isBuilt) {
|
||||
dialog.showMessageBox({
|
||||
title: product.nameLong,
|
||||
type: 'warning',
|
||||
message: 'Failed to load windows-mutex!',
|
||||
detail: e.toString(),
|
||||
noLink: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure Windows foreground love module
|
||||
try {
|
||||
<any>require.__$__nodeRequire('windows-foreground-love');
|
||||
} catch (e) {
|
||||
if (!this.environmentService.isBuilt) {
|
||||
dialog.showMessageBox({
|
||||
title: product.nameLong,
|
||||
type: 'warning',
|
||||
message: 'Failed to load windows-foreground-love!',
|
||||
detail: e.toString(),
|
||||
noLink: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user