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