Open adryd325 opened 5 years ago
With a quick look into chrome/browser/browser_resources.grd#L4, it seems that the ID of each resource is generated on build-time, when headers defining the resource name, like IDR_FIRST_RUN_HTML
, to whose generated ID, are also generated.
In sources like chrome/browser/ui/webui/conflicts/conflicts_ui.cc, generated headers are included, and resourced are used by name, compiled to numeric ID.
There has to be some sort of mappings, as within the compiled version of chrome, you're able to access chrome://resources/.
After some looking at grit-i18n there's a "resource_ids" file which references many "grd" files, I haven't looked much at the code, but I'm assuming these "grd" files contain some form of mappings from resource id to resource path, though I am unsure where these files are stored (I'm assuming they are somewhere within the "pak" file or compiled into an executable)
If I find anything else I'll add it to this issue.
As mentioned in docs/webui_in_components.md, web-ui accessible resources are handled specially by classes extending content::WebUIController
.
Probably related: tools/grit/grit/format/resource_map.py
Is there an index or a map that contains the file locations or file names within a built version of chromium? If so where would it be located and how would it be encoded?
I'm not nearly smart enough to sift through chromium's source, but, from what I found in i18n-grit, no such index is contained within the pak file itself. Right now I'm assuming the index is kept within an executable file or some other binary.