Skip to content

Commit 2c976d1

Browse files
finnurbrekiDevtools-frontend LUCI CQ
authored andcommitted
[GreenDevFloaty]: Add a popup AI disclaimer.
Bug: 466071312 Change-Id: I55589acb78c999ccd5db9473da744a100a200df5 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7560699 Reviewed-by: Wolfgang Beyer <wolfi@chromium.org> Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
1 parent fd0b427 commit 2c976d1

5 files changed

Lines changed: 130 additions & 4 deletions

File tree

front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ class GreenDevFloaty {
7272
});
7373
}
7474

75+
const learnMoreLink = doc.querySelector('.learn-more-link');
76+
if (learnMoreLink) {
77+
learnMoreLink.addEventListener('click', event => {
78+
event.preventDefault();
79+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
80+
'https://developer.chrome.com/docs/devtools/ai-assistance' as Platform.DevToolsPath.UrlString);
81+
});
82+
}
83+
7584
const nodeDescriptionElement = doc.querySelector('.green-dev-floaty-dialog-node-description') as HTMLDivElement;
7685
nodeDescriptionElement?.addEventListener('mousemove', () => {
7786
if (this.#node) {

front_end/entrypoints/greendev_floaty/floaty.css

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,48 @@ html, body {
251251
}
252252

253253
.green-dev-floaty-disclaimer {
254-
font-size: 13px;
254+
font-size: 16px;
255255
color: #666;
256256
text-align: center;
257257
margin-top: 8px;
258+
position: relative; /* For tooltip positioning */
259+
}
260+
261+
.disclaimer-link {
262+
color: #666; /* Match text color */
263+
text-decoration: underline;
264+
cursor: pointer;
265+
}
266+
267+
.disclaimer-tooltip {
268+
display: none;
269+
position: absolute;
270+
bottom: 100%; /* Position above */
271+
left: 50%;
272+
transform: translateX(-50%);
273+
width: 300px;
274+
padding: 12px;
275+
background-color: #fff;
276+
border: 1px solid #ccc;
277+
border-radius: 8px;
278+
box-shadow: 0 2px 10px rgb(0 0 0 / 20%);
279+
z-index: 1000;
280+
text-align: left;
281+
font-size: 14px;
282+
line-height: 1.4;
283+
color: #333;
284+
}
285+
286+
.disclaimer-link:hover + .disclaimer-tooltip,
287+
.disclaimer-tooltip:hover {
288+
display: block;
289+
}
290+
291+
.learn-more-link {
292+
color: #0b57d0;
293+
text-decoration: none;
294+
}
295+
296+
.learn-more-link:hover {
297+
text-decoration: underline;
258298
}

front_end/entrypoints/greendev_floaty/floaty.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323
<input type="text" class="green-dev-floaty-dialog-text-field" placeholder="Why is this not centered?">
2424
<button class="green-dev-floaty-dialog-play-button"></button>
2525
</div>
26-
<div class="green-dev-floaty-disclaimer">Relevant data is sent to Google</div>
26+
<div class="green-dev-floaty-disclaimer">
27+
<span class="disclaimer-link">Relevant data</span> is sent to Google
28+
<div class="disclaimer-tooltip">
29+
Chat messages and any data the inspected page can access via Web APIs are sent to Google and may be seen by human reviewers to improve this feature. This is an experimental AI feature and won't always get it right.
30+
<br><br>
31+
<a href="https://developer.chrome.com/docs/devtools/ai-assistance" class="learn-more-link">Learn about AI in DevTools</a>
32+
</div>
33+
</div>
2734
</div>
2835
</div>
2936
</div>

front_end/panels/greendev/GreenDevPanel.css

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,49 @@
234234
}
235235

236236
.green-dev-floaty-disclaimer {
237-
font-size: 14px;
237+
font-size: 15px;
238238
color: #666;
239239
text-align: center;
240240
margin-top: 8px;
241+
position: relative; /* For tooltip positioning */
242+
}
243+
244+
.disclaimer-link {
245+
color: #666; /* Match text color */
246+
text-decoration: underline;
247+
cursor: pointer;
248+
}
249+
250+
.disclaimer-tooltip {
251+
display: none;
252+
position: absolute;
253+
bottom: 100%; /* Position above */
254+
left: 50%;
255+
transform: translateX(-50%);
256+
width: 300px;
257+
padding: 12px;
258+
background-color: #fff;
259+
border: 1px solid #ccc;
260+
border-radius: 8px;
261+
box-shadow: 0 2px 10px rgb(0 0 0 / 20%);
262+
z-index: 1000;
263+
text-align: left;
264+
font-size: 16px;
265+
line-height: 1.4;
266+
color: #333;
267+
white-space: normal; /* Ensure text wraps */
268+
}
269+
270+
.disclaimer-link:hover + .disclaimer-tooltip,
271+
.disclaimer-tooltip:hover {
272+
display: block;
273+
}
274+
275+
.learn-more-link {
276+
color: #0b57d0;
277+
text-decoration: none;
278+
}
279+
280+
.learn-more-link:hover {
281+
text-decoration: underline;
241282
}

front_end/panels/greendev/GreenDevPanel.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
/* eslint-disable @devtools/no-imperative-dom-api */
55

66
import type * as Common from '../../core/common/common.js';
7+
import * as Host from '../../core/host/host.js';
8+
import type * as Platform from '../../core/platform/platform.js';
79
import * as SDK from '../../core/sdk/sdk.js';
810
import type * as Protocol from '../../generated/protocol.js';
911
import * as UI from '../../ui/legacy/legacy.js';
@@ -186,7 +188,34 @@ export class GreenDevPanel extends UI.Panel.Panel {
186188

187189
const disclaimer = document.createElement('div');
188190
disclaimer.className = 'green-dev-floaty-disclaimer';
189-
disclaimer.textContent = 'Relevant data is sent to Google';
191+
192+
const link = document.createElement('span');
193+
link.className = 'disclaimer-link';
194+
link.textContent = 'Relevant data';
195+
disclaimer.appendChild(link);
196+
197+
disclaimer.appendChild(document.createTextNode(' is sent to Google'));
198+
199+
const tooltip = document.createElement('div');
200+
tooltip.className = 'disclaimer-tooltip';
201+
202+
tooltip.appendChild(document.createTextNode(
203+
'Chat messages and any data the inspected page can access via Web APIs are sent to Google and may be seen by human reviewers to improve this feature. This is an experimental AI feature and won\'t always get it right.'));
204+
tooltip.appendChild(document.createElement('br'));
205+
tooltip.appendChild(document.createElement('br'));
206+
207+
const learnMore = document.createElement('a');
208+
const href = 'https://developer.chrome.com/docs/devtools/ai-assistance' as Platform.DevToolsPath.UrlString;
209+
learnMore.href = href;
210+
learnMore.className = 'learn-more-link';
211+
learnMore.textContent = 'Learn about AI in DevTools';
212+
learnMore.addEventListener('click', event => {
213+
event.preventDefault();
214+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(href);
215+
});
216+
tooltip.appendChild(learnMore);
217+
218+
disclaimer.appendChild(tooltip);
190219
blueCard.appendChild(disclaimer);
191220

192221
content.appendChild(blueCard);

0 commit comments

Comments
 (0)