提交 96579057 编写于 作者: C Christof Marti

Cannot access localStorage from main process (#19035)

上级 20f3a9f1
......@@ -16,7 +16,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IStorageService } from 'vs/code/electron-main/storage';
import { IFilesConfiguration, AutoSaveConfiguration } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
import { IUpdateService, State as UpdateState } from 'vs/platform/update/common/update';
import { Keybinding } from 'vs/base/common/keyCodes';
import { KeybindingLabels } from 'vs/base/common/keybinding';
......@@ -161,6 +160,9 @@ export class VSCodeMenu {
private extensionViewlets: IExtensionViewlet[];
private _welcome: Electron.MenuItem;
private _welcomeEnabled = false;
constructor(
@IUpdateService private updateService: IUpdateService,
@IInstantiationService instantiationService: IInstantiationService,
......@@ -208,6 +210,13 @@ export class VSCodeMenu {
}
});
ipc.on('vscode:welcomeEnabled', (event, enabled: string) => {
this._welcomeEnabled = enabled === 'true';
if (this._welcome) {
this._welcome.visible = this._welcomeEnabled;
}
});
// Update when auto save config changes
this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config, true /* update menu if changed */));
......@@ -846,13 +855,14 @@ export class VSCodeMenu {
}
}
const enableWelcomePage = isWelcomePageEnabled();
this._welcome = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miWelcome', comment: ['&& denotes a mnemonic'] }, "&&Welcome")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.welcomePage') });
this._welcome.visible = this._welcomeEnabled;
const keyboardShortcutsUrl = platform.isLinux ? product.keyboardShortcutsUrlLinux : platform.isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin;
arrays.coalesce([
enableWelcomePage ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miWelcome', comment: ['&& denotes a mnemonic'] }, "&&Welcome")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.welcomePage') }) : null,
this._welcome,
product.documentationUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.openDocumentationUrl') }) : null,
product.releaseNotesUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'update.showCurrentReleaseNotes') }) : null,
enableWelcomePage || product.documentationUrl || product.releaseNotesUrl ? __separator__() : null,
product.documentationUrl || product.releaseNotesUrl ? __separator__() : null,
keyboardShortcutsUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.keybindingsReference') }) : null,
product.introductoryVideosUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.openIntroductoryVideosUrl') }) : null,
(product.introductoryVideosUrl || keyboardShortcutsUrl) ? __separator__() : null,
......
......@@ -46,6 +46,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { Position, IResourceInput } from 'vs/platform/editor/common/editor';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
import { remote, ipcRenderer as ipc, webFrame } from 'electron';
......@@ -283,6 +284,8 @@ export class ElectronWindow {
}
});
ipc.send('vscode:welcomeEnabled', String(isWelcomePageEnabled()));
// Configuration changes
let previousConfiguredZoomLevel: number;
this.configurationService.onDidUpdateConfiguration(e => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册