tree: 5ac2ff9d96f518550cba0070d5a3fde80814d082 [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. commerce/
  62. component_updater/
  63. components_chromium_strings.grd
  64. components_chromium_strings_grd/
  65. components_google_chrome_strings.grd
  66. components_google_chrome_strings_grd/
  67. components_locale_settings.grd
  68. components_settings_strings.grdp
  69. components_strings.grd
  70. components_strings_grd/
  71. consent_auditor/
  72. constrained_window/
  73. content_capture/
  74. content_creation/
  75. content_creation_strings.grdp
  76. content_creation_strings_grdp/
  77. content_settings/
  78. contextual_search/
  79. continuous_search/
  80. cookie_config/
  81. country_codes/
  82. crash/
  83. crash_strings.grdp
  84. crash_strings_grdp/
  85. cronet/
  86. crx_file/
  87. data_reduction_proxy/
  88. data_use_measurement/
  89. database_utils/
  90. dbus/
  91. desks_storage/
  92. device_event_log/
  93. device_reauth/
  94. dialog_strings.grdp
  95. digital_asset_links/
  96. discardable_memory/
  97. dom_distiller/
  98. dom_distiller_strings.grdp
  99. dom_distiller_strings_grdp/
  100. domain_reliability/
  101. download/
  102. drive/
  103. embedder_support/
  104. encrypted_messages/
  105. enterprise/
  106. error_page/
  107. error_page_strings.grdp
  108. error_page_strings_grdp/
  109. exo/
  110. external_intents/
  111. externalauth/
  112. favicon/
  113. favicon_base/
  114. feature_engagement/
  115. federated_learning/
  116. feed/
  117. feedback/
  118. filename_generation/
  119. find_in_page/
  120. find_in_page_strings.grdp
  121. flags_strings.grdp
  122. flags_ui/
  123. full_restore/
  124. fullscreen_control/
  125. fullscreen_control_strings.grdp
  126. fullscreen_control_strings_grdp/
  127. gcm_driver/
  128. google/
  129. grpc_support/
  130. guest_os/
  131. guest_view/
  132. gwp_asan/
  133. handoff/
  134. heap_profiling/
  135. heavy_ad_intervention/
  136. heavy_ad_intervention_strings.grdp
  137. heavy_ad_intervention_strings_grdp/
  138. history/
  139. history_clusters/
  140. history_clusters_strings.grdp
  141. history_strings.grdp
  142. history_strings_grdp/
  143. image_fetcher/
  144. infobars/
  145. installedapp/
  146. invalidation/
  147. javascript_dialogs/
  148. javascript_dialogs_strings.grdp
  149. javascript_dialogs_strings_grdp/
  150. js_injection/
  151. keep_alive_registry/
  152. keyed_service/
  153. language/
  154. lens/
  155. leveldb_proto/
  156. link_header_util/
  157. live_caption/
  158. live_caption_strings.grdp
  159. live_caption_strings_grdp/
  160. location/
  161. login/
  162. login_dialog_strings.grdp
  163. lookalikes/
  164. management/
  165. management_ios_strings.grdp
  166. management_ios_strings_grdp/
  167. management_strings.grdp
  168. management_strings_grdp/
  169. media_control/
  170. media_message_center/
  171. media_message_center_strings.grdp
  172. media_router/
  173. messages/
  174. metal_util/
  175. metrics/
  176. metrics_services_manager/
  177. minidump_uploader/
  178. mirroring/
  179. module_installer/
  180. nacl/
  181. navigation_interception/
  182. navigation_metrics/
  183. net_log/
  184. neterror/
  185. network_hints/
  186. network_session_configurator/
  187. network_time/
  188. new_or_sad_tab_strings.grdp
  189. new_or_sad_tab_strings_grdp/
  190. no_state_prefetch/
  191. ntp_snippets/
  192. ntp_snippets_strings.grdp
  193. ntp_snippets_strings_grdp/
  194. ntp_tiles/
  195. offline_items_collection/
  196. offline_pages/
  197. omnibox/
  198. omnibox_strings.grdp
  199. omnibox_strings_grdp/
  200. on_load_script_injector/
  201. onc/
  202. open_from_clipboard/
  203. openscreen_platform/
  204. optimization_guide/
  205. os_crypt/
  206. ownership/
  207. page_image_annotation/
  208. page_info/
  209. page_info_strings.grdp
  210. page_info_strings_grdp/
  211. page_load_metrics/
  212. paint_preview/
  213. paint_preview_strings.grdp
  214. password_manager/
  215. password_manager_strings.grdp
  216. password_manager_strings_grdp/
  217. payments/
  218. payments_strings.grdp
  219. payments_strings_grdp/
  220. pdf/
  221. pdf_strings.grdp
  222. pdf_strings_grdp/
  223. performance_manager/
  224. permissions/
  225. permissions_strings.grdp
  226. permissions_strings_grdp/
  227. plugins/
  228. policy/
  229. policy_strings.grdp
  230. policy_strings_grdp/
  231. power_scheduler/
  232. pref_registry/
  233. prefs/
  234. previous_session_info/
  235. print_media_strings.grdp
  236. printing/
  237. printing_component_strings.grdp
  238. printing_component_strings_grdp/
  239. privacy_sandbox/
  240. privacy_sandbox_strings.grdp
  241. privacy_sandbox_strings_grdp/
  242. profile_metrics/
  243. proxy_config/
  244. pwg_encoder/
  245. qr_code_generator/
  246. query_parser/
  247. query_tiles/
  248. quirks/
  249. reading_list/
  250. remote_cocoa/
  251. renderer_context_menu/
  252. reporting/
  253. reputation/
  254. reset_password_strings.grdp
  255. reset_password_strings_grdp/
  256. resources/
  257. rlz/
  258. safe_browsing/
  259. safe_browsing_strings.grdp
  260. safe_search_api/
  261. safety_check/
  262. scheduling_metrics/
  263. schema_org/
  264. search/
  265. search_engines/
  266. search_provider_logos/
  267. security_interstitials/
  268. security_interstitials_strings.grdp
  269. security_interstitials_strings_grdp/
  270. security_state/
  271. security_state_strings.grdp
  272. security_state_strings_grdp/
  273. segmentation_platform/
  274. send_tab_to_self/
  275. send_tab_to_self_strings.grdp
  276. send_tab_to_self_strings_grdp/
  277. services/
  278. session_manager/
  279. sessions/
  280. shared_highlighting/
  281. signin/
  282. site_engagement/
  283. site_isolation/
  284. sms_strings.grdp
  285. sms_strings_grdp/
  286. soda/
  287. soda_strings.grdp
  288. soda_strings_grdp/
  289. speech/
  290. spellcheck/
  291. sqlite_proto/
  292. ssl_errors/
  293. ssl_errors_strings.grdp
  294. ssl_errors_strings_grdp/
  295. startup_metric_utils/
  296. storage_monitor/
  297. strictmode/
  298. strings/
  299. subresource_filter/
  300. subresource_filter_strings.grdp
  301. subresource_redirect/
  302. sync/
  303. sync_bookmarks/
  304. sync_device_info/
  305. sync_preferences/
  306. sync_sessions/
  307. sync_ui_strings.grdp
  308. sync_ui_strings_grdp/
  309. sync_user_events/
  310. system_media_controls/
  311. tab_count_metrics/
  312. tab_groups/
  313. tab_groups_strings.grdp
  314. tab_groups_strings_grdp/
  315. test/
  316. thin_webview/
  317. tracing/
  318. translate/
  319. translate_strings.grdp
  320. translate_strings_grdp/
  321. ui_devtools/
  322. ui_metrics/
  323. ukm/
  324. undo/
  325. undo_strings.grdp
  326. undo_strings_grdp/
  327. unified_consent/
  328. update_client/
  329. upload_list/
  330. url_formatter/
  331. url_matcher/
  332. url_pattern_index/
  333. user_actions_ui/
  334. user_manager/
  335. user_prefs/
  336. variations/
  337. vector_icons/
  338. version_info/
  339. version_ui/
  340. version_ui_strings.grdp
  341. version_ui_strings_grdp/
  342. visitedlink/
  343. viz/
  344. web_cache/
  345. web_modal/
  346. web_package/
  347. web_resource/
  348. webapk/
  349. webapps/
  350. webapps_strings.grdp
  351. webauthn/
  352. webcrypto/
  353. webdata/
  354. webdata_services/
  355. webrtc/
  356. webrtc_logging/
  357. webxr/
  358. webxr_strings.grdp
  359. webxr_strings_grdp/
  360. wifi/
  361. zoom/
  362. 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.