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