Skip to content

Commit 905490e

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Extract openInNewTab to a separate target
I looked around and this in only used in UI code, so keeping it near there sound better than moving it to Common. Bypass-Check-License: Moving old files to separate bundle Bug: 456407878 Change-Id: I9a966fdabe03135baebbc796a97883027dce69d3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7142121 Reviewed-by: Danil Somsikov <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent 68d638c commit 905490e

31 files changed

+332
-176
lines changed

config/gni/devtools_grd_files.gni

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ grd_files_bundled_sources = [
809809
"front_end/ui/components/text_prompt/text_prompt.js",
810810
"front_end/ui/components/tooltips/tooltips.js",
811811
"front_end/ui/components/tree_outline/tree_outline.js",
812+
"front_end/ui/helpers/helpers.js",
812813
"front_end/ui/i18n/i18n.js",
813814
"front_end/ui/legacy/components/color_picker/color_picker.js",
814815
"front_end/ui/legacy/components/cookie_table/cookie_table.js",
@@ -2463,6 +2464,7 @@ grd_files_unbundled_sources = [
24632464
"front_end/ui/components/tree_outline/TreeOutline.js",
24642465
"front_end/ui/components/tree_outline/TreeOutlineUtils.js",
24652466
"front_end/ui/components/tree_outline/treeOutline.css.js",
2467+
"front_end/ui/helpers/OpenInNewTab.js",
24662468
"front_end/ui/legacy/ARIAUtils.js",
24672469
"front_end/ui/legacy/ActionRegistration.js",
24682470
"front_end/ui/legacy/ActionRegistry.js",

front_end/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ group("unittests") {
257257
"ui/components/text_prompt:unittests",
258258
"ui/components/tooltips:unittests",
259259
"ui/components/tree_outline:unittests",
260+
"ui/helpers:unittests",
260261
"ui/i18n:unittests",
261262
"ui/legacy:copy_stylesheets_for_server",
262263
"ui/legacy:unittests",

front_end/core/common/ParsedURL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function normalizePath(path: string): string {
3838
return normalizedPath;
3939
}
4040

41-
export function schemeIs(url: Platform.DevToolsPath.UrlString, scheme: string): boolean {
41+
export function schemeIs(url: Platform.DevToolsPath.UrlString|URL, scheme: string): boolean {
4242
try {
4343
return (new URL(url)).protocol === scheme;
4444
} catch {

front_end/panels/ai_assistance/AiAssistancePanel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
1717
import * as Workspace from '../../models/workspace/workspace.js';
1818
import * as Buttons from '../../ui/components/buttons/buttons.js';
1919
import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
20+
import * as UIHelpers from '../../ui/helpers/helpers.js';
2021
import * as UI from '../../ui/legacy/legacy.js';
2122
import * as Lit from '../../ui/lit/lit.js';
2223
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
@@ -957,7 +958,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
957958
onDeleteClick: this.#onDeleteClicked.bind(this),
958959
onExportConversationClick: this.#onExportConversationClick.bind(this),
959960
onHelpClick: () => {
960-
UI.UIUtils.openInNewTab(AI_ASSISTANCE_HELP);
961+
UIHelpers.openInNewTab(AI_ASSISTANCE_HELP);
961962
},
962963
onSettingsClick: () => {
963964
void UI.ViewManager.ViewManager.instance().showView('chrome-ai');

front_end/panels/ai_assistance/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ devtools_ui_module("ai_assistance") {
5353
"../../ui/components/markdown_view:bundle",
5454
"../../ui/components/snackbars:bundle",
5555
"../../ui/components/spinners:bundle",
56+
"../../ui/helpers:bundle",
5657
"../../ui/i18n:bundle",
5758
"../../ui/legacy:bundle",
5859
"../../ui/lit:bundle",

front_end/panels/ai_assistance/components/UserActionRow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
88
import type * as Platform from '../../../core/platform/platform.js';
99
import * as Buttons from '../../../ui/components/buttons/buttons.js';
1010
import * as Input from '../../../ui/components/input/input.js';
11+
import * as UIHelpers from '../../../ui/helpers/helpers.js';
1112
import * as UI from '../../../ui/legacy/legacy.js';
1213
import * as Lit from '../../../ui/lit/lit.js';
1314
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
@@ -321,7 +322,7 @@ export class UserActionRow extends UI.Widget.Widget implements UserActionRowWidg
321322
{
322323
onSuggestionClick: this.onSuggestionClick,
323324
onRatingClick: this.#handleRateClick.bind(this),
324-
onReportClick: () => UI.UIUtils.openInNewTab(REPORT_URL),
325+
onReportClick: () => UIHelpers.openInNewTab(REPORT_URL),
325326
onCopyResponseClick: this.onCopyResponseClick,
326327
scrollSuggestionsScrollContainer: this.#scrollSuggestionsScrollContainer.bind(this),
327328
onSuggestionsScrollOrResize: this.#handleSuggestionsScrollOrResize.bind(this),

front_end/panels/common/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ devtools_ui_module("common") {
5151
"../../ui/components/spinners:bundle",
5252
"../../ui/components/switch:bundle",
5353
"../../ui/components/tooltips:bundle",
54+
"../../ui/helpers:bundle",
5455
"../../ui/i18n:bundle",
5556
"../../ui/legacy:bundle",
5657
"../../ui/legacy/components/utils:bundle",

front_end/panels/common/BadgeNotification.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Host from '../../core/host/host.js';
77
import * as i18n from '../../core/i18n/i18n.js';
88
import * as Badges from '../../models/badges/badges.js';
99
import * as Buttons from '../../ui/components/buttons/buttons.js';
10+
import * as UIHelpers from '../../ui/helpers/helpers.js';
1011
import * as uiI18n from '../../ui/i18n/i18n.js';
1112
import * as UI from '../../ui/legacy/legacy.js';
1213
import * as Lit from '../../ui/lit/lit.js';
@@ -290,7 +291,7 @@ export class BadgeNotification extends UI.Widget.Widget {
290291
label: i18nString(UIStrings.viewProfile),
291292
jslogContext: 'view-profile',
292293
onClick: () => {
293-
UI.UIUtils.openInNewTab(Host.GdpClient.GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK);
294+
UIHelpers.openInNewTab(Host.GdpClient.GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK);
294295
}
295296
}
296297
],

front_end/panels/common/GdpSignUpDialog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as Geometry from '../../models/geometry/geometry.js';
1212
import * as Buttons from '../../ui/components/buttons/buttons.js';
1313
import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
1414
import type * as Switch from '../../ui/components/switch/switch.js';
15+
import * as UIHelpers from '../../ui/helpers/helpers.js';
1516
import * as uiI18n from '../../ui/i18n/i18n.js';
1617
import * as UI from '../../ui/legacy/legacy.js';
1718
import {html, render} from '../../ui/lit/lit.js';
@@ -168,7 +169,7 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
168169
.title=${i18nString(UIStrings.learnMoreAccessibleText)}
169170
.variant=${Buttons.Button.Variant.OUTLINED}
170171
.jslogContext=${'learn-more'}
171-
@click=${() => UI.UIUtils.openInNewTab(GDP_PROGRAM_URL as Platform.DevToolsPath.UrlString)}>${i18nString(UIStrings.learnMore)}</devtools-button>
172+
@click=${() => UIHelpers.openInNewTab(GDP_PROGRAM_URL as Platform.DevToolsPath.UrlString)}>${i18nString(UIStrings.learnMore)}</devtools-button>
172173
<div class="right-buttons">
173174
<devtools-button
174175
.variant=${Buttons.Button.Variant.TONAL}

front_end/panels/elements/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ devtools_ui_module("elements") {
101101
"../../ui/components/text_editor:bundle",
102102
"../../ui/components/tooltips:bundle",
103103
"../../ui/components/tree_outline:bundle",
104+
"../../ui/helpers:bundle",
104105
"../../ui/legacy:bundle",
105106
"../../ui/legacy/components/color_picker:bundle",
106107
"../../ui/legacy/components/inline_editor:bundle",

0 commit comments

Comments
 (0)