File: README.md

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (37 lines) | stat: -rw-r--r-- 1,719 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
This directory contains code that is shared between

 * Browser Settings (chrome://settings)
 * CrOS Settings (chrome://os-settings)

The pattern used here is referred to as "limited sharing" unlike the
chrome://resources approach which is "unlimited sharing".

This approach has the following advantages over moving shared code under
chrome://resources/:

 * It allows a limited number of WebUI surfaces to use it, instead of exposing
   to all WebUI surfaces (hence the "limited sharing" name).
 * It also allows leveraging $i18n{} C++ string replacements, which is not
   possible in cr_elements/ or cr_components/. WebUIs that use the shared code
   are still responsible for registering all necessary strings.

The "limited sharing" mechanism works as follows

 * Code to be shared is built on its own, with a dedicated
   build_webui() target.
 * The resulting grd file entries `kSettingsSharedResources` are included in the
   build once and registered at runtime under all WebUIDataSource instances that
   need to use this code.
 * Shared code is exposed under /shared/settings/* URLs (same as
   chrome://settings/shared/settings/ or chrome://os-settings/shared/settings/
   respectively).
 * build_webui()'s `ts_path_mappings` and `optimize_webui_external_paths`
   parameters are leveraged so that the respective underlying tools (TS compiler
   and Rollup) can correctly resolve such paths.

A similar approach is also followed in c/b/r/side_panel/shared.

Note: The files in this folder are only added as standalone files to the build
when `optimize_webui=false`. In other cases the same files are already bundled
within the UIs that use them and therefore adding them as standalone files is
unnecessary.