Split WorkspaceTrustService (#120974)

* Split WorkspaceTrustService into WorkspaceTrustManagementService, WorkspaceTrustRequestService, WorkspaceTrustStorageService
This commit is contained in:
Ladislau Szomoru
2021-04-10 09:20:58 +02:00
committed by GitHub
parent 3b4a74297c
commit c41460cba5
20 changed files with 464 additions and 424 deletions

View File

@@ -16,7 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { ILabelService } from 'vs/platform/label/common/label';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IRequestService } from 'vs/platform/request/common/request';
import { WorkspaceTrustStateChangeEvent, IWorkspaceTrustService, WorkspaceTrustRequestOptions, WorkspaceTrustState } from 'vs/platform/workspace/common/workspaceTrust';
import { WorkspaceTrustStateChangeEvent, WorkspaceTrustRequestOptions, WorkspaceTrustState, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust';
import { IWorkspace, IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { isUntitledWorkspace } from 'vs/platform/workspaces/common/workspaces';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
@@ -47,7 +47,8 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
@ILabelService private readonly _labelService: ILabelService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IFileService fileService: IFileService,
@IWorkspaceTrustService private readonly _workspaceTrustService: IWorkspaceTrustService
@IWorkspaceTrustManagementService private readonly _workspaceTrustManagementService: IWorkspaceTrustManagementService,
@IWorkspaceTrustRequestService private readonly _workspaceTrustRequestService: IWorkspaceTrustRequestService
) {
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostWorkspace);
const workspace = this._contextService.getWorkspace();
@@ -60,7 +61,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
}
this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace, this, this._toDispose);
this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace, this, this._toDispose);
this._workspaceTrustService.onDidChangeTrustState(this._onDidChangeWorkspaceTrustState, this, this._toDispose);
this._workspaceTrustManagementService.onDidChangeTrustState(this._onDidChangeWorkspaceTrustState, this, this._toDispose);
}
dispose(): void {
@@ -209,11 +210,11 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
// --- trust ---
$requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<WorkspaceTrustState | undefined> {
return this._workspaceTrustService.requestWorkspaceTrust(options);
return this._workspaceTrustRequestService.requestWorkspaceTrust(options);
}
private getWorkspaceTrustState(): WorkspaceTrustState {
return this._workspaceTrustService.getWorkspaceTrustState();
return this._workspaceTrustManagementService.getWorkspaceTrustState();
}
private _onDidChangeWorkspaceTrustState(state: WorkspaceTrustStateChangeEvent): void {