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