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