tree: 7b2d184921f0955349378c786eabefd939f3d761 [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. bookmarks/
  39. breadcrumbs/
  40. browser_sync/
  41. browser_ui/
  42. browser_watcher/
  43. browsing_data/
  44. browsing_data_strings.grdp
  45. browsing_data_strings_grdp/
  46. captive_portal/
  47. cast/
  48. cast_certificate/
  49. cast_channel/
  50. cast_streaming/
  51. cbor/
  52. cdm/
  53. certificate_matching/
  54. certificate_transparency/
  55. chrome_cleaner/
  56. chromeos_camera/
  57. client_hints/
  58. client_update_protocol/
  59. cloud_devices/
  60. component_updater/
  61. components_chromium_strings.grd
  62. components_chromium_strings_grd/
  63. components_google_chrome_strings.grd
  64. components_google_chrome_strings_grd/
  65. components_locale_settings.grd
  66. components_settings_strings.grdp
  67. components_strings.grd
  68. components_strings_grd/
  69. consent_auditor/
  70. constrained_window/
  71. content_capture/
  72. content_creation/
  73. content_creation_strings.grdp
  74. content_creation_strings_grdp/
  75. content_settings/
  76. contextual_search/
  77. continuous_search/
  78. cookie_config/
  79. country_codes/
  80. crash/
  81. crash_strings.grdp
  82. crash_strings_grdp/
  83. cronet/
  84. crx_file/
  85. data_reduction_proxy/
  86. data_use_measurement/
  87. database_utils/
  88. dbus/
  89. desks_storage/
  90. device_event_log/
  91. dialog_strings.grdp
  92. digital_asset_links/
  93. discardable_memory/
  94. dom_distiller/
  95. dom_distiller_strings.grdp
  96. dom_distiller_strings_grdp/
  97. domain_reliability/
  98. download/
  99. drive/
  100. embedder_support/
  101. encrypted_messages/
  102. enterprise/
  103. error_page/
  104. error_page_strings.grdp
  105. error_page_strings_grdp/
  106. exo/
  107. external_intents/
  108. externalauth/
  109. favicon/
  110. favicon_base/
  111. feature_engagement/
  112. federated_learning/
  113. feed/
  114. feedback/
  115. filename_generation/
  116. find_in_page/
  117. find_in_page_strings.grdp
  118. flags_strings.grdp
  119. flags_ui/
  120. full_restore/
  121. fullscreen_control/
  122. fullscreen_control_strings.grdp
  123. fullscreen_control_strings_grdp/
  124. gcm_driver/
  125. google/
  126. grpc_support/
  127. guest_os/
  128. guest_view/
  129. gwp_asan/
  130. handoff/
  131. heap_profiling/
  132. heavy_ad_intervention/
  133. heavy_ad_intervention_strings.grdp
  134. heavy_ad_intervention_strings_grdp/
  135. history/
  136. history_clusters/
  137. history_clusters_strings.grdp
  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. suggestions/
  301. sync/
  302. sync_bookmarks/
  303. sync_device_info/
  304. sync_preferences/
  305. sync_sessions/
  306. sync_ui_strings.grdp
  307. sync_ui_strings_grdp/
  308. sync_user_events/
  309. system_media_controls/
  310. tab_count_metrics/
  311. tab_groups/
  312. tab_groups_strings.grdp
  313. tab_groups_strings_grdp/
  314. test/
  315. thin_webview/
  316. tracing/
  317. translate/
  318. translate_strings.grdp
  319. translate_strings_grdp/
  320. ui_devtools/
  321. ui_metrics/
  322. ukm/
  323. undo/
  324. undo_strings.grdp
  325. undo_strings_grdp/
  326. unified_consent/
  327. update_client/
  328. upload_list/
  329. url_formatter/
  330. url_matcher/
  331. url_pattern_index/
  332. user_actions_ui/
  333. user_manager/
  334. user_prefs/
  335. variations/
  336. vector_icons/
  337. version_info/
  338. version_ui/
  339. version_ui_strings.grdp
  340. version_ui_strings_grdp/
  341. visitedlink/
  342. viz/
  343. web_cache/
  344. web_modal/
  345. web_package/
  346. web_resource/
  347. webapk/
  348. webapps/
  349. webapps_strings.grdp
  350. webauthn/
  351. webcrypto/
  352. webdata/
  353. webdata_services/
  354. webrtc/
  355. webrtc_logging/
  356. webxr/
  357. webxr_strings.grdp
  358. webxr_strings_grdp/
  359. wifi/
  360. zoom/
  361. 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.