mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:04:14 +08:00
sandbox - move contextMenuService
This commit is contained in:
parent
88ae7a4387
commit
9c36a570c3
@ -157,7 +157,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||
'vs/workbench/workbench.desktop.main.js',
|
||||
'vs/workbench/workbench.desktop.main.css',
|
||||
'vs/workbench/services/extensions/node/extensionHostProcess.js',
|
||||
'vs/code/electron-browser/workbench/preload.js',
|
||||
'vs/code/electron-browser/preload.js',
|
||||
'vs/code/electron-browser/workbench/workbench.html',
|
||||
'vs/code/electron-browser/workbench/workbench.js'
|
||||
]);
|
||||
|
||||
@ -11,6 +11,12 @@ export const ipcRenderer = (window as any).vscode.ipcRenderer as {
|
||||
*/
|
||||
on(channel: string, listener: Function): void;
|
||||
|
||||
/**
|
||||
* Adds a one time `listener` function for the event. This `listener` is invoked
|
||||
* only the next time a message is sent to `channel`, after which it is removed.
|
||||
*/
|
||||
once(channel: string, listener: Function): void;
|
||||
|
||||
/**
|
||||
* Removes the specified `listener` from the listener array for the specified
|
||||
* `channel`.
|
||||
@ -32,3 +38,11 @@ export const ipcRenderer = (window as any).vscode.ipcRenderer as {
|
||||
*/
|
||||
send(channel: string, ...args: any[]): void;
|
||||
};
|
||||
|
||||
export const webFrame = (window as any).vscode.webFrame as {
|
||||
|
||||
/**
|
||||
* The current zoom factor.
|
||||
*/
|
||||
getZoomFactor(): number;
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ipcRenderer, Event } from 'electron';
|
||||
import { ipcRenderer } from 'vs/base/electron-sandbox/globals';
|
||||
import { IContextMenuItem, ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions, IContextMenuEvent } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
|
||||
let contextMenuIdPool = 0;
|
||||
@ -27,7 +27,7 @@ import { EnvironmentService, INativeEnvironmentService } from 'vs/platform/envir
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/common/mainProcessService';
|
||||
import { MainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { ISettingsSearchIssueReporterData, IssueReporterData, IssueReporterExtensionData, IssueReporterFeatures, IssueReporterStyles, IssueType } from 'vs/platform/issue/common/issue';
|
||||
import { getLogLevel, ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { ipcRenderer, webFrame } = require('electron');
|
||||
|
||||
// @ts-ignore
|
||||
window.vscode = {
|
||||
@ -15,6 +15,8 @@
|
||||
/**
|
||||
* A minimal set of methods exposed from ipcRenderer
|
||||
* to support communication to electron-main
|
||||
*
|
||||
* @type {typeof import('../../base/electron-sandbox/globals').ipcRenderer}
|
||||
*/
|
||||
ipcRenderer: {
|
||||
|
||||
@ -38,6 +40,16 @@
|
||||
ipcRenderer.on(channel, listener);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
*/
|
||||
once(channel, listener) {
|
||||
validateIPC(channel);
|
||||
|
||||
ipcRenderer.once(channel, listener);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
@ -47,6 +59,18 @@
|
||||
|
||||
ipcRenderer.removeListener(channel, listener);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Support for methods of webFrame type.
|
||||
*
|
||||
* @type {typeof import('../../base/electron-sandbox/globals').webFrame}
|
||||
*/
|
||||
webFrame: {
|
||||
|
||||
getZoomFactor() {
|
||||
return webFrame.getZoomFactor();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -13,7 +13,7 @@ import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/co
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-browser/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-sandbox/contextmenu';
|
||||
import { ProcessItem } from 'vs/base/common/processes';
|
||||
import { addDisposableListener } from 'vs/base/browser/dom';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
|
||||
@ -779,7 +779,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
|
||||
private doGetPreloadUrl(): string {
|
||||
return `${require.toUrl('vs/code/electron-browser/workbench/preload.js')}`;
|
||||
return require.toUrl('vs/code/electron-browser/preload.js');
|
||||
}
|
||||
|
||||
serializeWindowState(): IWindowState {
|
||||
|
||||
@ -18,6 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWindowState } from 'vs/platform/windows/electron-main/windows';
|
||||
import { listProcesses } from 'vs/base/node/ps';
|
||||
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
const DEFAULT_BACKGROUND_COLOR = '#1E1E1E';
|
||||
|
||||
@ -189,6 +190,7 @@ export class IssueMainService implements IIssueService {
|
||||
title: localize('issueReporter', "Issue Reporter"),
|
||||
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR,
|
||||
webPreferences: {
|
||||
preload: URI.parse(require.toUrl('vs/code/electron-browser/preload.js')).fsPath,
|
||||
nodeIntegration: true,
|
||||
enableWebSQL: false
|
||||
}
|
||||
@ -239,6 +241,7 @@ export class IssueMainService implements IIssueService {
|
||||
backgroundColor: data.styles.backgroundColor,
|
||||
title: localize('processExplorer', "Process Explorer"),
|
||||
webPreferences: {
|
||||
preload: URI.parse(require.toUrl('vs/code/electron-browser/preload.js')).fsPath,
|
||||
nodeIntegration: true,
|
||||
enableWebSQL: false
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import * as dom from 'vs/base/browser/dom';
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { webFrame } from 'electron';
|
||||
import { webFrame } from 'vs/base/electron-sandbox/globals';
|
||||
import { unmnemonicLabel } from 'vs/base/common/labels';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@ -17,7 +17,7 @@ import { IContextMenuDelegate, ContextSubMenu, IContextMenuEvent } from 'vs/base
|
||||
import { once } from 'vs/base/common/functional';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-browser/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-sandbox/contextmenu';
|
||||
import { getTitleBarStyle } from 'vs/platform/windows/common/windows';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@ -39,7 +39,6 @@ import 'vs/workbench/services/dialogs/electron-browser/dialogService';
|
||||
import 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
|
||||
import 'vs/workbench/services/keybinding/electron-browser/keybinding.contribution';
|
||||
import 'vs/workbench/services/extensions/electron-browser/extensionService';
|
||||
import 'vs/workbench/services/contextmenu/electron-browser/contextmenuService';
|
||||
import 'vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService';
|
||||
import 'vs/workbench/services/extensionManagement/electron-browser/extensionTipsService';
|
||||
import 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
|
||||
@ -18,6 +18,7 @@ import 'vs/workbench/services/userDataSync/electron-sandbox/storageKeysSyncRegis
|
||||
import 'vs/workbench/services/menubar/electron-sandbox/menubarService';
|
||||
import 'vs/workbench/services/issue/electron-sandbox/issueService';
|
||||
import 'vs/workbench/services/update/electron-sandbox/updateService';
|
||||
import 'vs/workbench/services/contextmenu/electron-sandbox/contextmenuService';
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user