5
5
6
6
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent' ;
7
7
import { coalesce } from 'vs/base/common/arrays' ;
8
+ import { DeferredPromise } from 'vs/base/common/async' ;
8
9
import { decodeBase64 } from 'vs/base/common/buffer' ;
9
10
import { Emitter , Event } from 'vs/base/common/event' ;
10
11
import { Disposable } from 'vs/base/common/lifecycle' ;
11
12
import { getExtensionForMimeType } from 'vs/base/common/mime' ;
12
13
import { FileAccess , Schemas } from 'vs/base/common/network' ;
14
+ import { equals } from 'vs/base/common/objects' ;
13
15
import { isMacintosh , isWeb } from 'vs/base/common/platform' ;
14
16
import { dirname , joinPath } from 'vs/base/common/resources' ;
15
- import { equals } from 'vs/base/common/objects' ;
16
17
import { URI } from 'vs/base/common/uri' ;
17
18
import * as UUID from 'vs/base/common/uuid' ;
18
19
import { TokenizationRegistry } from 'vs/editor/common/languages' ;
@@ -27,6 +28,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
27
28
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
28
29
import { IFileService } from 'vs/platform/files/common/files' ;
29
30
import { IOpenerService , matchesScheme , matchesSomeScheme } from 'vs/platform/opener/common/opener' ;
31
+ import { IStorageService } from 'vs/platform/storage/common/storage' ;
30
32
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
31
33
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust' ;
32
34
import { asWebviewUri , webviewGenericCspSource } from 'vs/workbench/common/webview' ;
@@ -39,12 +41,11 @@ import { CellUri, INotebookRendererInfo, NotebookSetting, RendererMessagingSpec
39
41
import { INotebookKernel } from 'vs/workbench/contrib/notebook/common/notebookKernelService' ;
40
42
import { IScopedRendererMessaging } from 'vs/workbench/contrib/notebook/common/notebookRendererMessagingService' ;
41
43
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService' ;
42
- import { IWebviewElement , IWebviewService , WebviewContentPurpose } from 'vs/workbench/contrib/webview/browser/webview' ;
44
+ import { IWebviewElement , IWebviewService , WebviewContentPurpose , WebviewOriginStore } from 'vs/workbench/contrib/webview/browser/webview' ;
43
45
import { WebviewWindowDragMonitor } from 'vs/workbench/contrib/webview/browser/webviewWindowDragMonitor' ;
44
46
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService' ;
45
47
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
46
48
import { FromWebviewMessage , IAckOutputHeight , IClickedDataUrlMessage , ICodeBlockHighlightRequest , IContentWidgetTopRequest , IControllerPreload , ICreationContent , ICreationRequestMessage , IFindMatch , IMarkupCellInitialization , RendererMetadata , StaticPreloadMetadata , ToWebviewMessage } from './webviewMessages' ;
47
- import { DeferredPromise } from 'vs/base/common/async' ;
48
49
49
50
export interface ICachedInset < K extends ICommonCellInfo > {
50
51
outputId : string ;
@@ -98,6 +99,14 @@ interface BacklayerWebviewOptions {
98
99
}
99
100
100
101
export class BackLayerWebView < T extends ICommonCellInfo > extends Disposable {
102
+
103
+ private static _originStore ?: WebviewOriginStore ;
104
+
105
+ private static getOriginStore ( storageService : IStorageService ) : WebviewOriginStore {
106
+ this . _originStore ??= new WebviewOriginStore ( 'notebook.backlayerWebview.origins' , storageService ) ;
107
+ return this . _originStore ;
108
+ }
109
+
101
110
element : HTMLElement ;
102
111
webview : IWebviewElement | undefined = undefined ;
103
112
insetMapping : Map < IDisplayOutputViewModel , ICachedInset < T > > = new Map ( ) ;
@@ -139,6 +148,7 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
139
148
@ILanguageService private readonly languageService : ILanguageService ,
140
149
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
141
150
@IEditorGroupsService private readonly editorGroupService : IEditorGroupsService ,
151
+ @IStorageService private readonly storageService : IStorageService ,
142
152
) {
143
153
super ( ) ;
144
154
@@ -912,6 +922,7 @@ var requirejs = (function() {
912
922
this . localResourceRootsCache = this . _getResourceRootsCache ( ) ;
913
923
const webview = webviewService . createWebviewElement ( {
914
924
id : this . id ,
925
+ origin : BackLayerWebView . getOriginStore ( this . storageService ) . getOrigin ( this . notebookViewType , undefined ) ,
915
926
options : {
916
927
purpose : WebviewContentPurpose . NotebookRenderer ,
917
928
enableFindWidget : false ,
0 commit comments