Skip to content

Commit 061a8ff

Browse files
AlinaVarkkiDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Change the security tooltip depending on logging enabled state and do not show the entry point to enterprise users with genAI disabled
Bug: 399814446 Change-Id: If83039833db58dcba1c34a4f75444a4bb5ec26e8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6355183 Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Jack Franklin <[email protected]> Auto-Submit: Alina Varkki <[email protected]>
1 parent 5ecf4ff commit 061a8ff

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

front_end/panels/timeline/overlays/OverlaysImpl.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,53 @@ describeWithEnvironment('Overlays', () => {
558558
assert.strictEqual(inputField?.innerText, 'entry label');
559559
});
560560

561+
it('Correct security tooltip on the `generate ai label` info icon hover for the users with logging enabled',
562+
async function() {
563+
const {elementsWrapper, inputField} =
564+
await createAnnotationsLabelElement(this, 'web-dev.json.gz', 50, 'entry label');
565+
assert.strictEqual(inputField?.innerText, 'entry label');
566+
567+
const aiLabelButtonWrapper =
568+
elementsWrapper.querySelector<HTMLElement>('.ai-label-button-wrapper') as HTMLSpanElement;
569+
assert.isOk(aiLabelButtonWrapper);
570+
571+
const infoIconTooltip = aiLabelButtonWrapper.querySelector('.pen-icon[title]');
572+
assert.isNotNull(infoIconTooltip);
573+
assert.strictEqual(
574+
infoIconTooltip.getAttribute('title'),
575+
'The selected call stack is sent to Google. The content you submit and that is generated by this feature will be used to improve Google’s AI models. This is an experimental AI feature and won’t always get it right.',
576+
);
577+
});
578+
579+
it('Correct security tooltip on the `geenrate ai label` info icon hover for the users with logging disabled',
580+
async function() {
581+
updateHostConfig({
582+
aidaAvailability: {
583+
enabled: true,
584+
blockedByAge: false,
585+
blockedByEnterprisePolicy: false,
586+
blockedByGeo: false,
587+
disallowLogging: true,
588+
enterprisePolicyValue: 1,
589+
},
590+
});
591+
592+
const {elementsWrapper, inputField} =
593+
await createAnnotationsLabelElement(this, 'web-dev.json.gz', 50, 'entry label');
594+
assert.strictEqual(inputField?.innerText, 'entry label');
595+
596+
const aiLabelButtonWrapper =
597+
elementsWrapper.querySelector<HTMLElement>('.ai-label-button-wrapper') as HTMLSpanElement;
598+
assert.isOk(aiLabelButtonWrapper);
599+
600+
const infoIconTooltip = aiLabelButtonWrapper.querySelector('.pen-icon[title]');
601+
assert.isNotNull(infoIconTooltip);
602+
assert.strictEqual(
603+
infoIconTooltip.getAttribute('title'),
604+
'The selected call stack is sent to Google. The content you submit and that is generated by this feature will not be used to improve Google’s AI models. This is an experimental AI feature and won’t always get it right.',
605+
);
606+
});
607+
561608
it('Inputting `Enter`into label overlay makes it non-editable', async function() {
562609
const {inputField} = await createAnnotationsLabelElement(this, 'web-dev.json.gz', 50, 'label');
563610

front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ const UIStringsNotTranslate = {
4747
*/
4848
generateLabelSecurityDisclaimer:
4949
'The selected call stack is sent to Google. The content you submit and that is generated by this feature will be used to improve Google’s AI models. This is an experimental AI feature and won’t always get it right.',
50+
/**
51+
*@description Enterprise users with logging off - Security disclaimer text displayed when the information icon on a button that generates an AI label is hovered.
52+
*/
53+
generateLabelSecurityDisclaimerLogginOff:
54+
'The selected call stack is sent to Google. The content you submit and that is generated by this feature will not be used to improve Google’s AI models. This is an experimental AI feature and won’t always get it right.',
5055
/**
5156
*@description Header text for the AI-powered annotations suggestions disclaimer dialog.
5257
*/
@@ -439,6 +444,9 @@ export class EntryLabelOverlay extends HTMLElement {
439444
}
440445

441446
#renderAiButton(): Lit.TemplateResult {
447+
const noLogging = Root.Runtime.hostConfig.aidaAvailability?.enterprisePolicyValue ===
448+
Root.Runtime.GenAiEnterprisePolicyValue.ALLOW_WITHOUT_LOGGING;
449+
442450
// clang-format off
443451
return html`
444452
<!-- 'preventDefault' on the AI label button to prevent the label removal on blur -->
@@ -458,7 +466,7 @@ export class EntryLabelOverlay extends HTMLElement {
458466
</button>
459467
<devtools-icon
460468
class="pen-icon"
461-
title=${lockedString(UIStringsNotTranslate.generateLabelSecurityDisclaimer)}
469+
title=${noLogging ? lockedString(UIStringsNotTranslate.generateLabelSecurityDisclaimerLogginOff) : lockedString(UIStringsNotTranslate.generateLabelSecurityDisclaimer)}
462470
.name=${'info'}
463471
.data=${{
464472
iconName: 'info', color: 'var(--color-background-inverted)', width: '20px'}}>
@@ -469,6 +477,8 @@ export class EntryLabelOverlay extends HTMLElement {
469477
}
470478

471479
#render(): void {
480+
const aiDisabledByEnterprisePolicy = Root.Runtime.hostConfig.aidaAvailability?.enterprisePolicyValue ===
481+
Root.Runtime.GenAiEnterprisePolicyValue.DISABLE;
472482
// clang-format off
473483
Lit.render(
474484
html`
@@ -486,8 +496,7 @@ export class EntryLabelOverlay extends HTMLElement {
486496
contenteditable=${this.#isLabelEditable ? 'plaintext-only' : false}
487497
jslog=${VisualLogging.textField('timeline.annotations.entry-label-input').track({keydown: true, click: true})}
488498
></span>
489-
490-
${Root.Runtime.hostConfig.devToolsAiGeneratedTimelineLabels?.enabled ?
499+
${!aiDisabledByEnterprisePolicy && Root.Runtime.hostConfig.devToolsAiGeneratedTimelineLabels?.enabled ?
491500
this.#renderAiButton():Lit.nothing}
492501
</span>
493502
<svg class="connectorContainer">

0 commit comments

Comments
 (0)