Skip to content

Commit

Permalink
personalization: misc cleanup
Browse files Browse the repository at this point in the history
* delete obsolete closure compiler annotations
* tighten test interface provider type specification
* remove allowjs option for test typescript config

Bug: None
Change-Id: I3a28eb86f6486925556623c78188360c8ed3873f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3382219
Reviewed-by: Jason Thai <jasontt@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#958147}
  • Loading branch information
Xiaohui Chen authored and Chromium LUCI CQ committed Jan 12, 2022
1 parent 9501b1b commit d8143d7
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,6 @@ export async function selectWallpaper(
store.endBatchUpdate();
}

/**
* @param {!WallpaperLayout} layout
* @param {!WallpaperProviderInterface} provider
* @param {!PersonalizationStore} store
*/
export async function setCustomWallpaperLayout(
layout: WallpaperLayout, provider: WallpaperProviderInterface,
store: PersonalizationStore): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import {WallpaperProvider, WallpaperProviderInterface} from '../personalization_

let wallpaperProvider: WallpaperProviderInterface|null = null;

/**
* @param {!WallpaperProviderInterface}
* testProvider
*/
export function setWallpaperProviderForTesting(
testProvider: WallpaperProviderInterface): void {
wallpaperProvider = testProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import {hasHttpScheme, removeHighResolutionSuffix} from '../utils.js';

import {getWallpaperProvider} from './wallpaper_interface_provider.js';

/**
* @polymer
* @implements WallpaperObserverInterface
*/
export class WallpaperPreview extends WithPersonalizationStore {
static get is() {
return 'wallpaper-preview';
Expand Down Expand Up @@ -57,11 +53,9 @@ export class WallpaperPreview extends WithPersonalizationStore {

constructor() {
super();
/** @private */
this.wallpaperProvider_ = getWallpaperProvider();
}

/** @override */
connectedCallback() {
super.connectedCallback();
this.watch('image_', state => state.wallpaper.currentSelected);
Expand All @@ -76,15 +70,15 @@ export class WallpaperPreview extends WithPersonalizationStore {
/**
* Reload at the wallpaper collections page.
*/
onClickWallpaper_() {
private onClickWallpaper_() {
PersonalizationRouter.reloadAtWallpaper();
}

/**
* Return a chrome://image or data:// url to load the image safely. Returns
* empty string in case |image| is null or invalid.
*/
getImageSrc_(image: CurrentWallpaper|null): string {
private getImageSrc_(image: CurrentWallpaper|null): string {
if (image && image.url) {
if (hasHttpScheme(image.url.url)) {
return `chrome://image?${removeHighResolutionSuffix(image.url.url)}`;
Expand All @@ -94,7 +88,8 @@ export class WallpaperPreview extends WithPersonalizationStore {
return '';
}

computeShowImage_(image: CurrentWallpaper|null, loading: boolean): boolean {
private computeShowImage_(image: CurrentWallpaper|null, loading: boolean):
boolean {
// Specifically check === false to avoid undefined case while component is
// initializing.
return loading === false && !!image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function pendingSelectedReducer(
}
return state;
case WallpaperActionName.SET_FULLSCREEN_ENABLED:
if (!(/** @type {{enabled: boolean}} */ (action)).enabled) {
if (!action.enabled) {
// Clear the pending selected state after full screen is dismissed.
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
import {ThemeObserverInterface, ThemeObserverRemote, ThemeProviderInterface} from 'chrome://personalization/trusted/personalization_app.mojom-webui.js';
import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js';

/**
* @implements {ThemeProviderInterface}
* @extends {TestBrowserProxy}
*/
export class TestThemeProvider extends TestBrowserProxy implements
ThemeProviderInterface {
export class TestThemeProvider extends
TestBrowserProxy<ThemeProviderInterface> implements ThemeProviderInterface {
constructor() {
super([
'setThemeObserver',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path
import {assertTrue} from 'chrome://webui-test/chai_assert.js';
import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js';

/**
* @implements {WallpaperProviderInterface}
* @extends {TestBrowserProxy}
*/
export class TestWallpaperProvider extends TestBrowserProxy implements
WallpaperProviderInterface {
export class TestWallpaperProvider extends
TestBrowserProxy<WallpaperProviderInterface> implements
WallpaperProviderInterface {
constructor() {
super([
'makeTransparent',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../../../../../tools/typescript/tsconfig_base.json",
"compilerOptions": {
"allowJs": true,
"typeRoots": [
"../../../../../../third_party/node/node_modules/@types"
]
Expand Down

0 comments on commit d8143d7

Please sign in to comment.