make renderer-side parts splash ready for web
This commit is contained in:
parent
980fbb65b9
commit
9291d82351
|
@ -19,8 +19,8 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import * as perf from 'vs/base/common/performance';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { ISplashStorageService } from 'vs/workbench/contrib/splash/browser/splash';
|
||||
|
||||
export class PartsSplash {
|
||||
|
||||
|
@ -37,7 +37,7 @@ export class PartsSplash {
|
|||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IEditorGroupsService editorGroupsService: IEditorGroupsService,
|
||||
@IConfigurationService configService: IConfigurationService,
|
||||
@INativeHostService private readonly _nativeHostService: INativeHostService
|
||||
@ISplashStorageService private readonly _partSplashService: ISplashStorageService
|
||||
) {
|
||||
lifecycleService.when(LifecyclePhase.Restored).then(_ => {
|
||||
this._removePartsSplash();
|
||||
|
@ -68,7 +68,7 @@ export class PartsSplash {
|
|||
private _savePartsSplash() {
|
||||
const theme = this._themeService.getColorTheme();
|
||||
|
||||
this._nativeHostService.saveWindowSplash({
|
||||
this._partSplashService.saveWindowSplash({
|
||||
baseTheme: getThemeTypeSelector(theme.type),
|
||||
colorInfo: {
|
||||
foreground: theme.getColor(foreground)?.toString(),
|
|
@ -0,0 +1,26 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import { ISplashStorageService } from 'vs/workbench/contrib/splash/browser/splash';
|
||||
import { IPartsSplash } from 'vs/platform/windows/common/windows';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { PartsSplash } from 'vs/workbench/contrib/splash/browser/partsSplash';
|
||||
|
||||
registerSingleton(ISplashStorageService, class SplashStorageService implements ISplashStorageService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
async saveWindowSplash(splash: IPartsSplash): Promise<void> {
|
||||
const raw = JSON.stringify(splash);
|
||||
localStorage.setItem('monaco-parts-splash', raw);
|
||||
}
|
||||
}, true);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
|
||||
PartsSplash,
|
||||
LifecyclePhase.Starting
|
||||
);
|
16
src/vs/workbench/contrib/splash/browser/splash.ts
Normal file
16
src/vs/workbench/contrib/splash/browser/splash.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IPartsSplash } from 'vs/platform/windows/common/windows';
|
||||
|
||||
export const ISplashStorageService = createDecorator<ISplashStorageService>('ISplashStorageService');
|
||||
|
||||
export interface ISplashStorageService {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
saveWindowSplash(splash: IPartsSplash): Promise<void>;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import { ISplashStorageService } from 'vs/workbench/contrib/splash/browser/splash';
|
||||
import { IPartsSplash } from 'vs/platform/windows/common/windows';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { PartsSplash } from 'vs/workbench/contrib/splash/browser/partsSplash';
|
||||
|
||||
class SplashStorageService implements ISplashStorageService {
|
||||
_serviceBrand: undefined;
|
||||
readonly saveWindowSplash: (splash: IPartsSplash) => Promise<void>;
|
||||
|
||||
constructor(@INativeHostService nativeHostService: INativeHostService) {
|
||||
this.saveWindowSplash = nativeHostService.saveWindowSplash.bind(nativeHostService);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(ISplashStorageService, SplashStorageService, true);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
|
||||
PartsSplash,
|
||||
LifecyclePhase.Starting
|
||||
);
|
|
@ -19,9 +19,6 @@ import { IsMacContext } from 'vs/platform/contextkey/common/contextkeys';
|
|||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { PartsSplash } from 'vs/workbench/electron-sandbox/splash';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { InstallShellScriptAction, UninstallShellScriptAction } from 'vs/workbench/electron-sandbox/actions/installActions';
|
||||
import { EditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench/common/editor';
|
||||
import { TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
@ -324,10 +321,3 @@ import { TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
|
|||
|
||||
jsonRegistry.registerSchema(argvDefinitionFileSchemaId, schema);
|
||||
})();
|
||||
|
||||
// Workbench Contributions
|
||||
(function registerWorkbenchContributions() {
|
||||
|
||||
// Splash
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PartsSplash, LifecyclePhase.Starting);
|
||||
})();
|
||||
|
|
|
@ -143,4 +143,7 @@ import 'vs/workbench/contrib/externalTerminal/electron-sandbox/externalTerminal.
|
|||
// Webview
|
||||
import 'vs/workbench/contrib/webview/electron-sandbox/webview.contribution';
|
||||
|
||||
// Splash
|
||||
import 'vs/workbench/contrib/splash/electron-sandbox/splash.contribution';
|
||||
|
||||
//#endregion
|
||||
|
|
|
@ -147,4 +147,7 @@ import 'vs/workbench/contrib/tags/browser/workspaceTagsService';
|
|||
// Issues
|
||||
import 'vs/workbench/contrib/issue/browser/issue.web.contribution';
|
||||
|
||||
// Splash
|
||||
import 'vs/workbench/contrib/splash/browser/splash.contribution';
|
||||
|
||||
//#endregion
|
||||
|
|
Loading…
Reference in a new issue