mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
urls - add option to disable confirm dialog
This commit is contained in:
@@ -54,7 +54,7 @@ export class BrowserURLService extends AbstractURLService {
|
||||
|
||||
private registerListeners(): void {
|
||||
if (this.provider) {
|
||||
this._register(this.provider.onCallback(uri => this.open(uri)));
|
||||
this._register(this.provider.onCallback(uri => this.open(uri, { trusted: true })));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
|
||||
import { IURLService, IURLHandler, IOpenURLOptions } from 'vs/platform/url/common/url';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { URLHandlerChannel } from 'vs/platform/url/common/urlIpc';
|
||||
@@ -15,6 +15,11 @@ import { IElectronEnvironmentService } from 'vs/workbench/services/electron/elec
|
||||
import { createChannelSender } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
|
||||
export interface IRelayOpenURLOptions extends IOpenURLOptions {
|
||||
openToSide?: boolean;
|
||||
openExternal?: boolean;
|
||||
}
|
||||
|
||||
export class RelayURLService extends URLService implements IURLHandler {
|
||||
|
||||
private urlService: IURLService;
|
||||
@@ -46,16 +51,16 @@ export class RelayURLService extends URLService implements IURLHandler {
|
||||
return uri.with({ query });
|
||||
}
|
||||
|
||||
async open(resource: URI, options?: { openToSide?: boolean, openExternal?: boolean }): Promise<boolean> {
|
||||
async open(resource: URI, options?: IRelayOpenURLOptions): Promise<boolean> {
|
||||
if (resource.scheme !== product.urlProtocol) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return await this.urlService.open(resource);
|
||||
return await this.urlService.open(resource, options);
|
||||
}
|
||||
|
||||
async handleURL(uri: URI): Promise<boolean> {
|
||||
const result = await super.open(uri);
|
||||
async handleURL(uri: URI, options?: IOpenURLOptions): Promise<boolean> {
|
||||
const result = await super.open(uri, options);
|
||||
|
||||
if (result) {
|
||||
await this.electronService.focusWindow();
|
||||
|
||||
Reference in New Issue
Block a user