tree: 65c37625825b8cb0a6969bba324f6b73d7b743bd [path history] [tgz]
  1. about_ui/
  2. access_code_cast/
  3. account_id/
  4. account_manager_core/
  5. affiliations/
  6. aggregation_service/
  7. allocation_recorder/
  8. android_autofill/
  9. android_system_error_page/
  10. android_system_error_page_strings_grdp/
  11. apdu/
  12. app_constants/
  13. app_restore/
  14. arc/
  15. arc_strings_grdp/
  16. assist_ranker/
  17. attribution_reporting/
  18. autofill/
  19. autofill_payments_strings_grdp/
  20. autofill_strings_grdp/
  21. back_forward_cache/
  22. background_fetch/
  23. background_sync/
  24. background_task_scheduler/
  25. base32/
  26. blocked_content/
  27. blocklist/
  28. bookmark_bar_strings_grdp/
  29. bookmark_component_strings_grdp/
  30. bookmarks/
  31. breadcrumbs/
  32. browser_sync/
  33. browser_ui/
  34. browsing_data/
  35. browsing_data_strings_grdp/
  36. browsing_topics/
  37. captive_portal/
  38. capture_mode/
  39. cast/
  40. cast_receiver/
  41. cast_streaming/
  42. cbor/
  43. cdm/
  44. certificate_matching/
  45. certificate_transparency/
  46. chromeos_camera/
  47. client_hints/
  48. client_update_protocol/
  49. cloud_devices/
  50. color/
  51. commerce/
  52. commerce_strings_grdp/
  53. component_updater/
  54. components_chromium_strings_grd/
  55. components_google_chrome_strings_grd/
  56. components_strings_grd/
  57. compose/
  58. compose_strings_grdp/
  59. consent_auditor/
  60. constrained_window/
  61. content_capture/
  62. content_relationship_verification/
  63. content_settings/
  64. contextual_search/
  65. continuous_search/
  66. cookie_config/
  67. country_codes/
  68. crash/
  69. crash_strings_grdp/
  70. cronet/
  71. cross_device/
  72. crx_file/
  73. custom_handlers/
  74. data_sharing/
  75. database_utils/
  76. dbus/
  77. desks_storage/
  78. device_event_log/
  79. device_reauth/
  80. device_signals/
  81. devtools/
  82. digital_goods/
  83. discardable_memory/
  84. dom_distiller/
  85. dom_distiller_strings_grdp/
  86. domain_reliability/
  87. download/
  88. drive/
  89. embedder_support/
  90. encrypted_messages/
  91. endpoint_fetcher/
  92. enterprise/
  93. enterprise_strings_grdp/
  94. error_page/
  95. error_page_strings_grdp/
  96. exo/
  97. external_intents/
  98. external_intents_strings_grdp/
  99. externalauth/
  100. eye_dropper/
  101. facilitated_payments/
  102. facilitated_payments_strings_grdp/
  103. favicon/
  104. favicon_base/
  105. feature_engagement/
  106. feed/
  107. feedback/
  108. file_access/
  109. filename_generation/
  110. find_in_page/
  111. fingerprinting_protection_filter/
  112. flags_strings_grdp/
  113. flags_ui/
  114. fuchsia_component_support/
  115. fuchsia_legacymetrics/
  116. fullscreen_control/
  117. fullscreen_control_strings_grdp/
  118. gcm_driver/
  119. global_media_controls/
  120. global_media_controls_strings_grdp/
  121. google/
  122. grpc_support/
  123. guest_os/
  124. guest_view/
  125. gwp_asan/
  126. handoff/
  127. headless/
  128. heap_profiling/
  129. heavy_ad_intervention/
  130. heavy_ad_intervention_strings_grdp/
  131. history/
  132. history_clusters/
  133. history_clusters_strings_grdp/
  134. history_embeddings/
  135. history_strings_grdp/
  136. image_fetcher/
  137. infobars/
  138. installedapp/
  139. invalidation/
  140. ip_protection/
  141. javascript_dialogs/
  142. javascript_dialogs_strings_grdp/
  143. js_injection/
  144. keep_alive_registry/
  145. keyed_service/
  146. language/
  147. lens/
  148. leveldb_proto/
  149. link_header_util/
  150. live_caption/
  151. live_caption_strings_grdp/
  152. local_state/
  153. location/
  154. login/
  155. lookalikes/
  156. management/
  157. management_ios_strings_grdp/
  158. management_strings_grdp/
  159. manta/
  160. media_control/
  161. media_device_salt/
  162. media_effects/
  163. media_message_center/
  164. media_message_center_strings_grdp/
  165. media_router/
  166. memory_pressure/
  167. memory_system/
  168. messages/
  169. metal_util/
  170. metrics/
  171. metrics_services_manager/
  172. minidump_uploader/
  173. miracle_parameter/
  174. mirroring/
  175. ml/
  176. module_installer/
  177. nacl/
  178. named_mojo_ipc_server/
  179. navigation_interception/
  180. navigation_metrics/
  181. net_log/
  182. neterror/
  183. network_hints/
  184. network_session_configurator/
  185. network_time/
  186. new_or_sad_tab_strings_grdp/
  187. no_state_prefetch/
  188. ntp_snippets/
  189. ntp_tiles/
  190. offline_items_collection/
  191. offline_pages/
  192. omnibox/
  193. omnibox_pedal_ui_strings_grdp/
  194. omnibox_strings_grdp/
  195. on_load_script_injector/
  196. onc/
  197. open_from_clipboard/
  198. openscreen_platform/
  199. optimization_guide/
  200. origin_trials/
  201. os_crypt/
  202. ownership/
  203. page_content_annotations/
  204. page_image_annotation/
  205. page_image_service/
  206. page_info/
  207. page_info_strings_grdp/
  208. page_load_metrics/
  209. paint_preview/
  210. password_manager/
  211. password_manager_strings_grdp/
  212. payments/
  213. payments_strings_grdp/
  214. pdf/
  215. pdf_strings_grdp/
  216. performance_manager/
  217. peripherals/
  218. permissions/
  219. permissions_strings_grdp/
  220. plugins/
  221. plus_addresses/
  222. plus_addresses_strings_grdp/
  223. policy/
  224. policy_strings_grdp/
  225. power_bookmarks/
  226. power_metrics/
  227. power_monitor/
  228. pref_registry/
  229. prefs/
  230. previous_session_info/
  231. print_media_strings_grdp/
  232. printing/
  233. printing_component_strings_grdp/
  234. privacy_sandbox/
  235. privacy_sandbox_chrome_strings_grdp/
  236. privacy_sandbox_strings_grd/
  237. profile_metrics/
  238. proxy_config/
  239. push_notification/
  240. pwg_encoder/
  241. qr_code_generator/
  242. query_parser/
  243. query_tiles/
  244. quirks/
  245. reading_list/
  246. reduce_accept_language/
  247. remote_cocoa/
  248. renderer_context_menu/
  249. reporting/
  250. reset_password_strings_grdp/
  251. resources/
  252. rlz/
  253. robolectric/
  254. safe_browsing/
  255. safe_search_api/
  256. safety_check/
  257. saved_tab_groups/
  258. schema_org/
  259. search/
  260. search_engine_choice_strings_grdp/
  261. search_engines/
  262. search_provider_logos/
  263. security_interstitials/
  264. security_interstitials_strings_grdp/
  265. security_state/
  266. segmentation_platform/
  267. send_tab_to_self/
  268. send_tab_to_self_strings_grdp/
  269. services/
  270. session_manager/
  271. session_proto_db/
  272. sessions/
  273. shared_highlighting/
  274. signin/
  275. site_engagement/
  276. site_isolation/
  277. site_settings_strings_grdp/
  278. sms_strings_grdp/
  279. soda/
  280. speech/
  281. spellcheck/
  282. sqlite_proto/
  283. ssl_errors/
  284. ssl_errors_strings_grdp/
  285. stability_report/
  286. startup_metric_utils/
  287. storage_monitor/
  288. strictmode/
  289. strings/
  290. stylus_handwriting/
  291. subresource_filter/
  292. subresource_filter_strings_grdp/
  293. supervised_user/
  294. supervised_user_strings_grdp/
  295. sync/
  296. sync_bookmarks/
  297. sync_device_info/
  298. sync_preferences/
  299. sync_sessions/
  300. sync_ui_strings_grdp/
  301. sync_user_events/
  302. system_cpu/
  303. system_media_controls/
  304. tab_groups/
  305. tab_groups_strings_grdp/
  306. test/
  307. thin_webview/
  308. tpcd/
  309. tracing/
  310. translate/
  311. translate_strings_grdp/
  312. trusted_vault/
  313. ui_devtools/
  314. ui_metrics/
  315. ukm/
  316. undo/
  317. undo_strings_grdp/
  318. unexportable_keys/
  319. unified_consent/
  320. update_client/
  321. upload_list/
  322. url_formatter/
  323. url_matcher/
  324. url_pattern/
  325. url_pattern_index/
  326. url_rewrite/
  327. user_actions_ui/
  328. user_education/
  329. user_education_strings_grdp/
  330. user_manager/
  331. user_notes/
  332. user_prefs/
  333. value_store/
  334. variations/
  335. vector_icons/
  336. version_info/
  337. version_ui/
  338. version_ui_strings_grdp/
  339. visited_url_ranking/
  340. visitedlink/
  341. viz/
  342. web_app_resources/
  343. web_cache/
  344. web_modal/
  345. web_package/
  346. web_resource/
  347. webapk/
  348. webapps/
  349. webauthn/
  350. webcrypto/
  351. webdata/
  352. webdata_services/
  353. webid/
  354. webrtc/
  355. webrtc_logging/
  356. webxr/
  357. webxr_strings_grdp/
  358. wifi/
  359. winhttp/
  360. zoom/
  361. zucchini/
  362. .eslintrc.js
  363. android_system_error_page_strings.grdp
  364. arc_strings.grdp
  365. autofill_payments_strings.grdp
  366. autofill_strings.grdp
  367. blocked_content_strings.grdp
  368. bookmark_bar_strings.grdp
  369. bookmark_component_strings.grdp
  370. browsing_data_strings.grdp
  371. BUILD.gn
  372. commerce_strings.grdp
  373. components_chromium_strings.grd
  374. components_google_chrome_strings.grd
  375. components_locale_settings.grd
  376. components_settings_strings.grdp
  377. components_strings.grd
  378. compose_strings.grdp
  379. crash_strings.grdp
  380. DEPS
  381. dialog_strings.grdp
  382. dom_distiller_strings.grdp
  383. enterprise_strings.grdp
  384. error_page_strings.grdp
  385. external_intents_strings.grdp
  386. facilitated_payments_strings.grdp
  387. find_in_page_strings.grdp
  388. flags_strings.grdp
  389. fullscreen_control_strings.grdp
  390. global_media_controls_strings.grdp
  391. heavy_ad_intervention_strings.grdp
  392. history_clusters_strings.grdp
  393. history_strings.grdp
  394. javascript_dialogs_strings.grdp
  395. live_caption_strings.grdp
  396. login_dialog_strings.grdp
  397. management_ios_strings.grdp
  398. management_strings.grdp
  399. media_message_center_strings.grdp
  400. new_or_sad_tab_strings.grdp
  401. omnibox_pedal_ui_strings.grdp
  402. omnibox_strings.grdp
  403. OWNERS
  404. page_info_strings.grdp
  405. paint_preview_strings.grdp
  406. password_manager_strings.grdp
  407. payments_strings.grdp
  408. pdf_strings.grdp
  409. permissions_strings.grdp
  410. plus_addresses_strings.grdp
  411. policy_strings.grdp
  412. PRESUBMIT.py
  413. print_media_strings.grdp
  414. printing_component_strings.grdp
  415. privacy_sandbox_chrome_strings.grdp
  416. privacy_sandbox_strings.grd
  417. protocol_handler_strings.grdp
  418. README.md
  419. reset_password_strings.grdp
  420. search_engine_choice_strings.grdp
  421. search_engine_descriptions_strings.grd
  422. security_interstitials_strings.grdp
  423. send_tab_to_self_strings.grdp
  424. site_settings_strings.grdp
  425. sms_strings.grdp
  426. ssl_errors_strings.grdp
  427. subresource_filter_strings.grdp
  428. supervised_user_strings.grdp
  429. sync_ui_strings.grdp
  430. tab_groups_strings.grdp
  431. translate_strings.grdp
  432. undo_strings.grdp
  433. user_education_strings.grdp
  434. version_ui_strings.grdp
  435. webapps_strings.grdp
  436. 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.

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).

Note that the above list is meant to be exhaustive. A component should not be added just to separate it from other code in the same layer that is the only consumer; that can be done with strict DEPS or GN visibility rules.

Before adding a new component

  • Is there an existing component that you can leverage instead of introducing a new component?
    • Can you restructure an existing component to logically encompass the proposed new code?
    • As a general rule, we prefer fewer top level components. So, consider whether adding sub-features within an existing component is more appropriate for your use case.
    • Historically, dependency issues were simply addressed by adding new components. But, you can (and it is preferred to) solve that by restructing an existing component and its dependencies where possible.

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.
    • You must specify at least two OWNERS for any new component.
  • A //components/OWNER must approve of the location of your code.
  • The CL (either commit message or comment) must explicitly specify what use case(s) justify the new component.
  • 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.).
  • The CL adding a new component should be substantial enough so that //components/OWNERS can see its basic intended structure and usage before approving the addition (e.g., it should not just be an empty shell).
  • You must add a DIR_METADATA file under //components/{your component} with an appropriately specified bug-component.

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. In particular, code that is shared with iOS cannot depend on any of the above modules; those dependencies must be injected into the shared code (either via a layered component structure or directly from the embedder for simple dependencies such as booleans that can be passed as constructor parameters). It is not an acceptable solution to conditionally depend on the above modules in code shared with iOS.

//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 - BUILD.gn, DEPS, DIR_METADATA, OWNERS, README.md
  • 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.