mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-29 17:35:02 +08:00
Cache Storage moves up to the Storage where it belongs. Back/forward cache moves down to Background Services as it kinda fits the concept and we don't have better ideas. Bug: 1407166 Change-Id: Ibceb5019179b5bd1695169b0de2b9d5934ab433f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4161387 Commit-Queue: Danil Somsikov <dsv@chromium.org> Auto-Submit: Danil Somsikov <dsv@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
import type * as Platform from '../../core/platform/platform.js';
|
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
import * as ApplicationComponents from './components/components.js';
|
|
import * as Host from '../../core/host/host.js';
|
|
|
|
import {ApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
|
|
import {type ResourcesPanel} from './ResourcesPanel.js';
|
|
|
|
const UIStrings = {
|
|
/**
|
|
*@description Text in Application Panel Sidebar of the Application panel
|
|
*/
|
|
backForwardCache: 'Back/forward cache',
|
|
};
|
|
const str_ = i18n.i18n.registerUIStrings('panels/application/BackForwardCacheTreeElement.ts', UIStrings);
|
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
|
export class BackForwardCacheTreeElement extends ApplicationPanelTreeElement {
|
|
private view?: ApplicationComponents.BackForwardCacheView.BackForwardCacheViewWrapper;
|
|
|
|
constructor(resourcesPanel: ResourcesPanel) {
|
|
super(resourcesPanel, i18nString(UIStrings.backForwardCache), false);
|
|
const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
|
|
this.setLeadingIcons([icon]);
|
|
}
|
|
|
|
get itemURL(): Platform.DevToolsPath.UrlString {
|
|
return 'bfcache://' as Platform.DevToolsPath.UrlString;
|
|
}
|
|
|
|
onselect(selectedByUser?: boolean): boolean {
|
|
super.onselect(selectedByUser);
|
|
if (!this.view) {
|
|
this.view = new ApplicationComponents.BackForwardCacheView.BackForwardCacheViewWrapper(
|
|
new ApplicationComponents.BackForwardCacheView.BackForwardCacheView());
|
|
}
|
|
this.showView(this.view);
|
|
Host.userMetrics.panelShown(Host.UserMetrics.PanelCodes[Host.UserMetrics.PanelCodes.back_forward_cache]);
|
|
return false;
|
|
}
|
|
}
|