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