[docs] base::Feature
documentation for devtools-frontend
.
Bug: 354102605 Change-Id: Ifad75f8a5ea560831e34d443c447e64d06dfac82 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6218299 Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> Cr-Commit-Position: refs/heads/main@{#1413335}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
317dd56cfe
commit
e02f5b17fc
@ -48,6 +48,36 @@ feature needs to be runtime-enabled, read also Blink's
|
||||
|
||||
[blink-rte]: ../third_party/blink/renderer/platform/RuntimeEnabledFeatures.md
|
||||
|
||||
### To Use the Flag in `third_party/devtools-frontend/`
|
||||
|
||||
Add a `base::Feature` to the following files
|
||||
|
||||
* [chrome/browser/devtools/features.cc](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/features.cc)
|
||||
* [chrome/browser/devtools/features.h](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/features.h)
|
||||
|
||||
and add appropriate logic to `DevToolsUIBindings::GetHostConfig()` in
|
||||
|
||||
* [chrome/browser/devtools/devtools_ui_bindings.cc](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/devtools_ui_bindings.cc)
|
||||
|
||||
to expose the feature to DevTools' front-end ([example CL](https://crrev.com/c/6084996)).
|
||||
Afterwards hook up the feature in `devtools-frontend` by updating the following files
|
||||
([example CL](https://crrev.com/c/6085435)):
|
||||
|
||||
* [front_end/core/host/InspectorFrontendHost.ts](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/core/host/InspectorFrontendHost.ts) (add default state to `getHostConfig()`)
|
||||
* [front_end/core/root/Runtime.ts](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/core/root/Runtime.ts) (add type definitions for your host config additions)
|
||||
* [front_end/testing/EnvironmentHelpers.ts](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/testing/EnvironmentHelpers.ts) (add default state for unit tests)
|
||||
|
||||
You can access the host config via `Common.Settings.Settings.instance().getHostConfig()`
|
||||
in your code and check for your feature. Refer to the [documentation][devtools-cli-docs]
|
||||
for more information.
|
||||
|
||||
Historically, DevTools front-end used [Experiments][devtools-experiments] to gate
|
||||
new (experimental) features, but going forward the `base::Feature` mechanism should
|
||||
be used.
|
||||
|
||||
[devtools-experiments]: https://developer.chrome.com/docs/devtools/settings/experiments
|
||||
[devtools-cli-docs]: https://chromium.googlesource.com/devtools/devtools-frontend/+/HEAD/docs/contributing/settings-experiments-features.md#how-to-add-command-line-flags
|
||||
|
||||
### Examples
|
||||
|
||||
You can refer to [this CL](https://chromium-review.googlesource.com/c/554510/)
|
||||
|
Reference in New Issue
Block a user