File: README.md

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; 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 (11)
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.