Files
react-native-devtools-frontend/front_end/host/InspectorFrontendHostAPI.js
T
Patrick Brosset 77ed48ad21 Grid: New histogram to track how many grids users highlight in the page
There is a backend part to this change:
https://chromium-review.googlesource.com/c/chromium/src/+/2379254/

The goal is to track how many grids people highlight in web pages using either
the adorner in the Elements tree, or the checkboxes in the Layout panel.

The histogram is done in a way where we track when users highlight 0, 1, 2, 3, 4
grids, and then between 5 and 9, 10 and 19, 20 and 49, and more than 50.
We have more granularity at the bottom end of the spectrum as the expectation is
that users will mostly highlight few grids at a time.

Bug: 1047356
Change-Id: If3a5282d3909e85ba73b96714fae1d4e2bc9ba36
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2379098
Commit-Queue: Patrick Brosset <patrick.brosset@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-09-04 08:48:52 +00:00

427 lines
10 KiB
JavaScript

// Copyright (c) 2015 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 Root from '../root/root.js'; // eslint-disable-line no-unused-vars
/** @enum {symbol} */
export const Events = {
AppendedToURL: Symbol('appendedToURL'),
CanceledSaveURL: Symbol('canceledSaveURL'),
ContextMenuCleared: Symbol('contextMenuCleared'),
ContextMenuItemSelected: Symbol('contextMenuItemSelected'),
DeviceCountUpdated: Symbol('deviceCountUpdated'),
DevicesDiscoveryConfigChanged: Symbol('devicesDiscoveryConfigChanged'),
DevicesPortForwardingStatusChanged: Symbol('devicesPortForwardingStatusChanged'),
DevicesUpdated: Symbol('devicesUpdated'),
DispatchMessage: Symbol('dispatchMessage'),
DispatchMessageChunk: Symbol('dispatchMessageChunk'),
EnterInspectElementMode: Symbol('enterInspectElementMode'),
EyeDropperPickedColor: Symbol('eyeDropperPickedColor'),
FileSystemsLoaded: Symbol('fileSystemsLoaded'),
FileSystemRemoved: Symbol('fileSystemRemoved'),
FileSystemAdded: Symbol('fileSystemAdded'),
FileSystemFilesChangedAddedRemoved: Symbol('FileSystemFilesChangedAddedRemoved'),
IndexingTotalWorkCalculated: Symbol('indexingTotalWorkCalculated'),
IndexingWorked: Symbol('indexingWorked'),
IndexingDone: Symbol('indexingDone'),
KeyEventUnhandled: Symbol('keyEventUnhandled'),
ReattachMainTarget: Symbol('reattachMainTarget'),
ReloadInspectedPage: Symbol('reloadInspectedPage'),
RevealSourceLine: Symbol('revealSourceLine'),
SavedURL: Symbol('savedURL'),
SearchCompleted: Symbol('searchCompleted'),
SetInspectedTabId: Symbol('setInspectedTabId'),
SetUseSoftMenu: Symbol('setUseSoftMenu'),
ShowPanel: Symbol('showPanel')
};
export const EventDescriptors = [
[Events.AppendedToURL, 'appendedToURL', ['url']],
[Events.CanceledSaveURL, 'canceledSaveURL', ['url']],
[Events.ContextMenuCleared, 'contextMenuCleared', []],
[Events.ContextMenuItemSelected, 'contextMenuItemSelected', ['id']],
[Events.DeviceCountUpdated, 'deviceCountUpdated', ['count']],
[Events.DevicesDiscoveryConfigChanged, 'devicesDiscoveryConfigChanged', ['config']],
[Events.DevicesPortForwardingStatusChanged, 'devicesPortForwardingStatusChanged', ['status']],
[Events.DevicesUpdated, 'devicesUpdated', ['devices']],
[Events.DispatchMessage, 'dispatchMessage', ['messageObject']],
[Events.DispatchMessageChunk, 'dispatchMessageChunk', ['messageChunk', 'messageSize']],
[Events.EnterInspectElementMode, 'enterInspectElementMode', []],
[Events.EyeDropperPickedColor, 'eyeDropperPickedColor', ['color']],
[Events.FileSystemsLoaded, 'fileSystemsLoaded', ['fileSystems']],
[Events.FileSystemRemoved, 'fileSystemRemoved', ['fileSystemPath']],
[Events.FileSystemAdded, 'fileSystemAdded', ['errorMessage', 'fileSystem']],
[Events.FileSystemFilesChangedAddedRemoved, 'fileSystemFilesChangedAddedRemoved', ['changed', 'added', 'removed']],
[Events.IndexingTotalWorkCalculated, 'indexingTotalWorkCalculated', ['requestId', 'fileSystemPath', 'totalWork']],
[Events.IndexingWorked, 'indexingWorked', ['requestId', 'fileSystemPath', 'worked']],
[Events.IndexingDone, 'indexingDone', ['requestId', 'fileSystemPath']],
[Events.KeyEventUnhandled, 'keyEventUnhandled', ['event']],
[Events.ReattachMainTarget, 'reattachMainTarget', []],
[Events.ReloadInspectedPage, 'reloadInspectedPage', ['hard']],
[Events.RevealSourceLine, 'revealSourceLine', ['url', 'lineNumber', 'columnNumber']],
[Events.SavedURL, 'savedURL', ['url', 'fileSystemPath']],
[Events.SearchCompleted, 'searchCompleted', ['requestId', 'fileSystemPath', 'files']],
[Events.SetInspectedTabId, 'setInspectedTabId', ['tabId']],
[Events.SetUseSoftMenu, 'setUseSoftMenu', ['useSoftMenu']],
[Events.ShowPanel, 'showPanel', ['panelName']]
];
/** @interface */
export class InspectorFrontendHostAPI {
/**
* @param {string=} type
*/
addFileSystem(type) {
}
loadCompleted() {
}
/**
* @param {number} requestId
* @param {string} fileSystemPath
* @param {string} excludedFolders
*/
indexPath(requestId, fileSystemPath, excludedFolders) {
}
/**
* Requests inspected page to be placed atop of the inspector frontend with specified bounds.
* @param {{x: number, y: number, width: number, height: number}} bounds
*/
setInspectedPageBounds(bounds) {
}
/**
* @param {!Array<string>} certChain
*/
showCertificateViewer(certChain) {
}
/**
* @param {string} shortcuts
*/
setWhitelistedShortcuts(shortcuts) {
}
/**
* @param {boolean} active
*/
setEyeDropperActive(active) {
}
inspectElementCompleted() {
}
/**
* @param {string} url
*/
openInNewTab(url) {
}
/**
* @param {string} fileSystemPath
*/
showItemInFolder(fileSystemPath) {
}
/**
* @param {string} fileSystemPath
*/
removeFileSystem(fileSystemPath) {
}
requestFileSystems() {
}
/**
* @param {string} url
* @param {string} content
* @param {boolean} forceSaveAs
*/
save(url, content, forceSaveAs) {
}
/**
* @param {string} url
* @param {string} content
*/
append(url, content) {
}
/**
* @param {string} url
*/
close(url) {
}
/**
* @param {number} requestId
* @param {string} fileSystemPath
* @param {string} query
*/
searchInPath(requestId, fileSystemPath, query) {
}
/**
* @param {number} requestId
*/
stopIndexing(requestId) {
}
bringToFront() {
}
closeWindow() {
}
/**
* @param {?(string|undefined)} text
*/
copyText(text) {
}
/**
* @param {string} url
*/
inspectedURLChanged(url) {
}
/**
* @param {string} fileSystemId
* @param {string} registeredName
* @return {?FileSystem}
*/
isolatedFileSystem(fileSystemId, registeredName) {
throw new Error('not implemented');
}
/**
* @param {string} url
* @param {string} headers
* @param {number} streamId
* @param {function(!LoadNetworkResourceResult):void} callback
*/
loadNetworkResource(url, headers, streamId, callback) {
}
/**
* @param {function(!Object<string, string>):void} callback
*/
getPreferences(callback) {
}
/**
* @param {string} name
* @param {string} value
*/
setPreference(name, value) {
}
/**
* @param {string} name
*/
removePreference(name) {
}
clearPreferences() {
}
/**
* @param {!FileSystem} fileSystem
*/
upgradeDraggedFileSystemPermissions(fileSystem) {
}
/**
* @return {string}
*/
platform() {
throw new Error('Not implemented');
}
/**
* @param {!EnumeratedHistogram} actionName
* @param {number} actionCode
* @param {number} bucketSize
*/
recordEnumeratedHistogram(actionName, actionCode, bucketSize) {
}
/**
* @param {string} histogramName
* @param {number} duration
*/
recordPerformanceHistogram(histogramName, duration) {
}
/**
* @param {string} umaName
*/
recordUserMetricsAction(umaName) {
}
/**
* @param {string} message
*/
sendMessageToBackend(message) {
}
/**
* @param {!Adb.Config} config
*/
setDevicesDiscoveryConfig(config) {
}
/**
* @param {boolean} enabled
*/
setDevicesUpdatesEnabled(enabled) {
}
/**
* @param {string} pageId
* @param {string} action
*/
performActionOnRemotePage(pageId, action) {
}
/**
* @param {string} browserId
* @param {string} url
*/
openRemotePage(browserId, url) {
}
openNodeFrontend() {
}
/**
* @param {string} origin
* @param {string} script
*/
setInjectedScriptForOrigin(origin, script) {
}
/**
* @param {boolean} isDocked
* @param {function():void} callback
*/
setIsDocked(isDocked, callback) {
}
/**
* @return {number}
*/
zoomFactor() {
throw new Error('Not implemented');
}
zoomIn() {
}
zoomOut() {
}
resetZoom() {
}
/**
* @param {number} x
* @param {number} y
* @param {!Array.<!ContextMenuDescriptor>} items
* @param {!Document} document
*/
showContextMenuAtPoint(x, y, items, document) {
}
/**
* @param {function():void} callback
*/
reattach(callback) {
}
readyForTest() {
}
connectionReady() {
}
/**
* @param {boolean} value
*/
setOpenNewWindowForPopups(value) {
}
/**
* @return {boolean}
*/
isHostedMode() {
throw new Error('Not implemented');
}
/**
* @param {function(!Root.Runtime.RuntimeExtensionDescriptor):void} callback
*/
setAddExtensionCallback(callback) {
}
}
/** @typedef
{{
type: string,
id: (number|undefined),
label: (string|undefined),
enabled: (boolean|undefined),
checked: (boolean|undefined),
subItems: (!Array.<!ContextMenuDescriptor>|undefined)
}} */
// @ts-ignore typedef
export let ContextMenuDescriptor;
/** @typedef
{{
statusCode: number,
headers: (!Object.<string, string>|undefined),
netError: (number|undefined),
netErrorName: (string|undefined),
urlValid: (boolean|undefined),
messageOverride: (string|undefined)
}} */
// @ts-ignore typedef
export let LoadNetworkResourceResult;
/** @typedef
{{
startPage: string,
name: string,
exposeExperimentalAPIs: boolean
}} */
// @ts-ignore typedef
export let ExtensionDescriptor;
/**
* Enum for recordPerformanceHistogram
* Warning: There are three definitions of this enum in the DevTools code base, keep them in sync.
* @readonly
* @enum {string}
*/
export const EnumeratedHistogram = {
ActionTaken: 'DevTools.ActionTaken',
ColorPickerFixedColor: 'DevTools.ColorPicker.FixedColor',
PanelClosed: 'DevTools.PanelClosed',
PanelShown: 'DevTools.PanelShown',
SidebarPaneShown: 'DevTools.SidebarPaneShown',
KeyboardShortcutFired: 'DevTools.KeyboardShortcutFired',
IssuesPanelOpenedFrom: 'DevTools.IssuesPanelOpenedFrom',
KeybindSetSettingChanged: 'DevTools.KeybindSetSettingChanged',
DualScreenDeviceEmulated: 'DevTools.DualScreenDeviceEmulated',
CSSGridSettings: 'DevTools.CSSGridSettings2',
HighlightedPersistentCSSGridCount: 'DevTools.HighlightedPersistentCSSGridCount',
ExperimentEnabledAtLaunch: 'DevTools.ExperimentEnabledAtLaunch',
ExperimentEnabled: 'DevTools.ExperimentEnabled',
ExperimentDisabled: 'DevTools.ExperimentDisabled',
ComputedStyleGrouping: 'DevTools.ComputedStyleGrouping',
};