tree: 475c66a5c026834aa807369b9e2371f71b3a8fcc [path history] [tgz]
  1. about_ui/
  2. account_id/
  3. account_manager_core/
  4. accuracy_tips/
  5. android_autofill/
  6. android_system_error_page/
  7. apdu/
  8. arc/
  9. arc_strings_grdp/
  10. assist_ranker/
  11. autofill/
  12. autofill_assistant/
  13. autofill_assistant_strings_grdp/
  14. autofill_payments_strings_grdp/
  15. autofill_strings_grdp/
  16. back_forward_cache/
  17. background_fetch/
  18. background_sync/
  19. background_task_scheduler/
  20. base32/
  21. blocked_content/
  22. blocklist/
  23. bookmark_bar_strings_grdp/
  24. bookmark_component_strings_grdp/
  25. bookmarks/
  26. breadcrumbs/
  27. browser_sync/
  28. browser_ui/
  29. browser_watcher/
  30. browsing_data/
  31. browsing_data_strings_grdp/
  32. captive_portal/
  33. cast/
  34. cast_certificate/
  35. cast_channel/
  36. cast_streaming/
  37. cbor/
  38. cdm/
  39. certificate_matching/
  40. certificate_transparency/
  41. chrome_cleaner/
  42. chromeos_camera/
  43. client_hints/
  44. client_update_protocol/
  45. cloud_devices/
  46. commerce/
  47. component_updater/
  48. components_chromium_strings_grd/
  49. components_google_chrome_strings_grd/
  50. components_strings_grd/
  51. consent_auditor/
  52. constrained_window/
  53. content_capture/
  54. content_creation/
  55. content_creation_strings_grdp/
  56. content_settings/
  57. contextual_search/
  58. continuous_search/
  59. cookie_config/
  60. country_codes/
  61. crash/
  62. crash_strings_grdp/
  63. cronet/
  64. crx_file/
  65. data_reduction_proxy/
  66. data_use_measurement/
  67. database_utils/
  68. dbus/
  69. desks_storage/
  70. device_event_log/
  71. device_reauth/
  72. digital_asset_links/
  73. discardable_memory/
  74. dom_distiller/
  75. dom_distiller_strings_grdp/
  76. domain_reliability/
  77. download/
  78. drive/
  79. embedder_support/
  80. encrypted_messages/
  81. enterprise/
  82. error_page/
  83. error_page_strings_grdp/
  84. exo/
  85. external_intents/
  86. externalauth/
  87. favicon/
  88. favicon_base/
  89. feature_engagement/
  90. federated_learning/
  91. feed/
  92. feedback/
  93. filename_generation/
  94. find_in_page/
  95. flags_ui/
  96. full_restore/
  97. fullscreen_control/
  98. fullscreen_control_strings_grdp/
  99. gcm_driver/
  100. google/
  101. grpc_support/
  102. guest_os/
  103. guest_view/
  104. gwp_asan/
  105. handoff/
  106. heap_profiling/
  107. heavy_ad_intervention/
  108. heavy_ad_intervention_strings_grdp/
  109. history/
  110. history_clusters/
  111. history_strings_grdp/
  112. image_fetcher/
  113. infobars/
  114. installedapp/
  115. invalidation/
  116. javascript_dialogs/
  117. javascript_dialogs_strings_grdp/
  118. js_injection/
  119. keep_alive_registry/
  120. keyed_service/
  121. language/
  122. lens/
  123. leveldb_proto/
  124. link_header_util/
  125. live_caption/
  126. live_caption_strings_grdp/
  127. location/
  128. login/
  129. lookalikes/
  130. management/
  131. management_ios_strings_grdp/
  132. management_strings_grdp/
  133. media_control/
  134. media_message_center/
  135. media_router/
  136. messages/
  137. metal_util/
  138. metrics/
  139. metrics_services_manager/
  140. minidump_uploader/
  141. mirroring/
  142. module_installer/
  143. nacl/
  144. navigation_interception/
  145. navigation_metrics/
  146. net_log/
  147. neterror/
  148. network_hints/
  149. network_session_configurator/
  150. network_time/
  151. new_or_sad_tab_strings_grdp/
  152. no_state_prefetch/
  153. ntp_snippets/
  154. ntp_snippets_strings_grdp/
  155. ntp_tiles/
  156. offline_items_collection/
  157. offline_pages/
  158. omnibox/
  159. omnibox_strings_grdp/
  160. on_load_script_injector/
  161. onc/
  162. open_from_clipboard/
  163. openscreen_platform/
  164. optimization_guide/
  165. os_crypt/
  166. ownership/
  167. page_image_annotation/
  168. page_info/
  169. page_info_strings_grdp/
  170. page_load_metrics/
  171. paint_preview/
  172. password_manager/
  173. password_manager_strings_grdp/
  174. payments/
  175. payments_strings_grdp/
  176. pdf/
  177. pdf_strings_grdp/
  178. performance_manager/
  179. permissions/
  180. permissions_strings_grdp/
  181. plugins/
  182. policy/
  183. policy_strings_grdp/
  184. power_scheduler/
  185. pref_registry/
  186. prefs/
  187. previous_session_info/
  188. printing/
  189. printing_component_strings_grdp/
  190. privacy_sandbox/
  191. privacy_sandbox_strings_grdp/
  192. profile_metrics/
  193. proxy_config/
  194. pwg_encoder/
  195. qr_code_generator/
  196. query_parser/
  197. query_tiles/
  198. quirks/
  199. reading_list/
  200. remote_cocoa/
  201. renderer_context_menu/
  202. reporting/
  203. reputation/
  204. reset_password_strings_grdp/
  205. resources/
  206. rlz/
  207. safe_browsing/
  208. safe_search_api/
  209. safety_check/
  210. scheduling_metrics/
  211. schema_org/
  212. search/
  213. search_engines/
  214. search_provider_logos/
  215. security_interstitials/
  216. security_interstitials_strings_grdp/
  217. security_state/
  218. security_state_strings_grdp/
  219. segmentation_platform/
  220. send_tab_to_self/
  221. send_tab_to_self_strings_grdp/
  222. services/
  223. session_manager/
  224. sessions/
  225. shared_highlighting/
  226. signin/
  227. site_engagement/
  228. site_isolation/
  229. sms_strings_grdp/
  230. soda/
  231. soda_strings_grdp/
  232. speech/
  233. spellcheck/
  234. sqlite_proto/
  235. ssl_errors/
  236. ssl_errors_strings_grdp/
  237. startup_metric_utils/
  238. storage_monitor/
  239. strictmode/
  240. strings/
  241. subresource_filter/
  242. subresource_redirect/
  243. sync/
  244. sync_bookmarks/
  245. sync_device_info/
  246. sync_preferences/
  247. sync_sessions/
  248. sync_ui_strings_grdp/
  249. sync_user_events/
  250. system_media_controls/
  251. tab_count_metrics/
  252. tab_groups/
  253. tab_groups_strings_grdp/
  254. test/
  255. thin_webview/
  256. tracing/
  257. translate/
  258. translate_strings_grdp/
  259. ui_devtools/
  260. ui_metrics/
  261. ukm/
  262. undo/
  263. undo_strings_grdp/
  264. unified_consent/
  265. update_client/
  266. upload_list/
  267. url_formatter/
  268. url_matcher/
  269. url_pattern_index/
  270. user_actions_ui/
  271. user_manager/
  272. user_prefs/
  273. variations/
  274. vector_icons/
  275. version_info/
  276. version_ui/
  277. version_ui_strings_grdp/
  278. visitedlink/
  279. viz/
  280. web_cache/
  281. web_modal/
  282. web_package/
  283. web_resource/
  284. webapk/
  285. webapps/
  286. webauthn/
  287. webcrypto/
  288. webdata/
  289. webdata_services/
  290. webrtc/
  291. webrtc_logging/
  292. webxr/
  293. webxr_strings_grdp/
  294. wifi/
  295. zoom/
  296. zucchini/
  297. .eslintrc.js
  298. android_system_error_page_strings.grdp
  299. arc_strings.grdp
  300. autofill_assistant_strings.grdp
  301. autofill_payments_strings.grdp
  302. autofill_strings.grdp
  303. blocked_content_strings.grdp
  304. bookmark_bar_strings.grdp
  305. bookmark_component_strings.grdp
  306. browsing_data_strings.grdp
  307. BUILD.gn
  308. components_chromium_strings.grd
  309. components_google_chrome_strings.grd
  310. components_locale_settings.grd
  311. components_settings_strings.grdp
  312. components_strings.grd
  313. content_creation_strings.grdp
  314. crash_strings.grdp
  315. DEPS
  316. dialog_strings.grdp
  317. dom_distiller_strings.grdp
  318. error_page_strings.grdp
  319. find_in_page_strings.grdp
  320. flags_strings.grdp
  321. fullscreen_control_strings.grdp
  322. heavy_ad_intervention_strings.grdp
  323. history_clusters_strings.grdp
  324. history_strings.grdp
  325. javascript_dialogs_strings.grdp
  326. live_caption_strings.grdp
  327. login_dialog_strings.grdp
  328. management_ios_strings.grdp
  329. management_strings.grdp
  330. media_message_center_strings.grdp
  331. new_or_sad_tab_strings.grdp
  332. ntp_snippets_strings.grdp
  333. omnibox_strings.grdp
  334. OWNERS
  335. page_info_strings.grdp
  336. paint_preview_strings.grdp
  337. password_manager_strings.grdp
  338. payments_strings.grdp
  339. pdf_strings.grdp
  340. permissions_strings.grdp
  341. policy_strings.grdp
  342. PRESUBMIT.py
  343. print_media_strings.grdp
  344. printing_component_strings.grdp
  345. privacy_sandbox_strings.grdp
  346. README.md
  347. reset_password_strings.grdp
  348. safe_browsing_strings.grdp
  349. security_interstitials_strings.grdp
  350. security_state_strings.grdp
  351. send_tab_to_self_strings.grdp
  352. sms_strings.grdp
  353. soda_strings.grdp
  354. ssl_errors_strings.grdp
  355. subresource_filter_strings.grdp
  356. sync_ui_strings.grdp
  357. tab_groups_strings.grdp
  358. translate_strings.grdp
  359. undo_strings.grdp
  360. version_ui_strings.grdp
  361. webapps_strings.grdp
  362. webxr_strings.grdp
components/README.md

About //components

This directory is meant to house features or subsystems that are used in more than one part of the Chromium codebase.

Example use cases:

  • Features that are shared by Chrome on iOS (//ios/chrome) and Chrome on other platforms (//chrome).
    • Note: //ios doesn't depend on //chrome.
  • Features that are shared between multiple embedders of content. For example, //chrome and //android_webview.
  • Features that are shared between Blink and the browser process.
    • Note: It is also possible to place code shared between Blink and the browser process into //third_party/blink/common. The distinction comes down to (a) whether Blink is the owner of the code in question or a consumer of it and (b) whether the code in question is shared by Chrome on iOS as well. If the code is conceptually its own cross-process feature with Blink as a consumer, then //components can make sense. If it‘s conceptually Blink code, then //third_party/blink/common likely makes more sense. (In the so-far hypothetical case where it’s conceptually Blink code that is shared by iOS, raise the question on chromium-dev@, where the right folks will see it).

Guidelines for adding a new component

  • You will be added to an OWNERS file under //components/{your component} and be responsible for maintaining your addition.
  • A //components/OWNER must approve of the location of your code.
  • Code must be needed in at least 2 places in Chrome that don't have a “higher layered” directory that could facilitate sharing (e.g. //content/common, //chrome/utility, etc.).

Dependencies of a component

Components cannot depend on the higher layers of the Chromium codebase:

  • //android_webview
  • //chrome
  • //chromecast
  • //headless
  • //ios/chrome
  • //content/shell

Components can depend on the lower layers of the Chromium codebase:

  • //base
  • //gpu
  • //mojo
  • //net
  • //printing
  • //ui

Components can depend on each other. This must be made explicit in the DEPS file of the component.

Components can depend on //content/public, //ipc, and //third_party/blink/public. This must be made explicit in the DEPS file of the component. If such a component is used by Chrome for iOS (which does not use content or IPC), the component will have to be in the form of a layered component.

//chrome, //ios/chrome, //content and //ios/web can depend on individual components. The dependency might have to be made explicit in the DEPS file of the higher layer (e.g. in //content/browser/DEPS). Circular dependencies are not allowed: if //content depends on a component, then that component cannot depend on //content/public, directly or indirectly.

Structure of a component

As mentioned above, components that depend on //content/public, //ipc, or third_party/blink/public might have to be in the form of a layered component.

Components that have bits of code that need to live in different processes (e.g. some code in the browser process, some in the renderer process, etc.) should separate the code into different subdirectories. Hence for a component named ‘foo’ you might end up with a structure like the following (assuming that foo is not used by iOS and thus does not need to be a layered component):

  • components/foo - DEPS, OWNERS, BUILD.gn
  • components/foo/browser - code that needs the browser process
  • components/foo/common - for e.g. Mojo interfaces and such
  • components/foo/renderer - code that needs renderer process

These subdirectories should have DEPS files with the relevant restrictions in place, i.e. only components/foo/browser should be allowed to #include from content/public/browser. Note that third_party/blink/public is a renderer process directory except for third_party/blink/public/common which can be used by all processes.

Note that there may also be an android subdir, with a Java source code structure underneath it where the package name is org.chromium.components.foo, and with subdirs after ‘foo’ to illustrate process, e.g. ‘browser’ or ‘renderer’:

  • components/foo/android/OWNERS, DEPS
  • components/foo/android/java/src/org/chromium/components/foo/browser/
  • components/foo/android/javatests/src/org/chromium/components/foo/browser/

Code in a component should be placed in a namespace corresponding to the name of the component; e.g. for a component living in //components/foo, code in that component should be in the foo:: namespace.

How does this differ from //base/util?

See the explanation in //base/util/README.md.