tree: 07bfdc8ecfa383111a8b3eabb36f477d8285de09 [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. device_reauth/
  93. dialog_strings.grdp
  94. digital_asset_links/
  95. discardable_memory/
  96. dom_distiller/
  97. dom_distiller_strings.grdp
  98. dom_distiller_strings_grdp/
  99. domain_reliability/
  100. download/
  101. drive/
  102. embedder_support/
  103. encrypted_messages/
  104. enterprise/
  105. error_page/
  106. error_page_strings.grdp
  107. error_page_strings_grdp/
  108. exo/
  109. external_intents/
  110. externalauth/
  111. favicon/
  112. favicon_base/
  113. feature_engagement/
  114. federated_learning/
  115. feed/
  116. feedback/
  117. filename_generation/
  118. find_in_page/
  119. find_in_page_strings.grdp
  120. flags_strings.grdp
  121. flags_ui/
  122. full_restore/
  123. fullscreen_control/
  124. fullscreen_control_strings.grdp
  125. fullscreen_control_strings_grdp/
  126. gcm_driver/
  127. google/
  128. grpc_support/
  129. guest_os/
  130. guest_view/
  131. gwp_asan/
  132. handoff/
  133. heap_profiling/
  134. heavy_ad_intervention/
  135. heavy_ad_intervention_strings.grdp
  136. heavy_ad_intervention_strings_grdp/
  137. history/
  138. history_clusters/
  139. history_clusters_strings.grdp
  140. history_strings.grdp
  141. history_strings_grdp/
  142. image_fetcher/
  143. infobars/
  144. installedapp/
  145. invalidation/
  146. javascript_dialogs/
  147. javascript_dialogs_strings.grdp
  148. javascript_dialogs_strings_grdp/
  149. js_injection/
  150. keep_alive_registry/
  151. keyed_service/
  152. language/
  153. lens/
  154. leveldb_proto/
  155. link_header_util/
  156. live_caption/
  157. live_caption_strings.grdp
  158. live_caption_strings_grdp/
  159. location/
  160. login/
  161. login_dialog_strings.grdp
  162. lookalikes/
  163. management/
  164. management_ios_strings.grdp
  165. management_ios_strings_grdp/
  166. management_strings.grdp
  167. management_strings_grdp/
  168. media_control/
  169. media_message_center/
  170. media_message_center_strings.grdp
  171. media_router/
  172. messages/
  173. metal_util/
  174. metrics/
  175. metrics_services_manager/
  176. minidump_uploader/
  177. mirroring/
  178. module_installer/
  179. nacl/
  180. navigation_interception/
  181. navigation_metrics/
  182. net_log/
  183. neterror/
  184. network_hints/
  185. network_session_configurator/
  186. network_time/
  187. new_or_sad_tab_strings.grdp
  188. new_or_sad_tab_strings_grdp/
  189. no_state_prefetch/
  190. ntp_snippets/
  191. ntp_snippets_strings.grdp
  192. ntp_snippets_strings_grdp/
  193. ntp_tiles/
  194. offline_items_collection/
  195. offline_pages/
  196. omnibox/
  197. omnibox_strings.grdp
  198. omnibox_strings_grdp/
  199. on_load_script_injector/
  200. onc/
  201. open_from_clipboard/
  202. openscreen_platform/
  203. optimization_guide/
  204. os_crypt/
  205. ownership/
  206. page_image_annotation/
  207. page_info/
  208. page_info_strings.grdp
  209. page_info_strings_grdp/
  210. page_load_metrics/
  211. paint_preview/
  212. paint_preview_strings.grdp
  213. password_manager/
  214. password_manager_strings.grdp
  215. password_manager_strings_grdp/
  216. payments/
  217. payments_strings.grdp
  218. payments_strings_grdp/
  219. pdf/
  220. pdf_strings.grdp
  221. pdf_strings_grdp/
  222. performance_manager/
  223. permissions/
  224. permissions_strings.grdp
  225. permissions_strings_grdp/
  226. plugins/
  227. policy/
  228. policy_strings.grdp
  229. policy_strings_grdp/
  230. power_scheduler/
  231. pref_registry/
  232. prefs/
  233. previous_session_info/
  234. print_media_strings.grdp
  235. printing/
  236. printing_component_strings.grdp
  237. printing_component_strings_grdp/
  238. privacy_sandbox/
  239. privacy_sandbox_strings.grdp
  240. privacy_sandbox_strings_grdp/
  241. profile_metrics/
  242. proxy_config/
  243. pwg_encoder/
  244. qr_code_generator/
  245. query_parser/
  246. query_tiles/
  247. quirks/
  248. reading_list/
  249. remote_cocoa/
  250. renderer_context_menu/
  251. reporting/
  252. reputation/
  253. reset_password_strings.grdp
  254. reset_password_strings_grdp/
  255. resources/
  256. rlz/
  257. safe_browsing/
  258. safe_browsing_strings.grdp
  259. safe_search_api/
  260. safety_check/
  261. scheduling_metrics/
  262. schema_org/
  263. search/
  264. search_engines/
  265. search_provider_logos/
  266. security_interstitials/
  267. security_interstitials_strings.grdp
  268. security_interstitials_strings_grdp/
  269. security_state/
  270. security_state_strings.grdp
  271. security_state_strings_grdp/
  272. segmentation_platform/
  273. send_tab_to_self/
  274. send_tab_to_self_strings.grdp
  275. send_tab_to_self_strings_grdp/
  276. services/
  277. session_manager/
  278. sessions/
  279. shared_highlighting/
  280. signin/
  281. site_engagement/
  282. site_isolation/
  283. sms_strings.grdp
  284. sms_strings_grdp/
  285. soda/
  286. soda_strings.grdp
  287. soda_strings_grdp/
  288. speech/
  289. spellcheck/
  290. sqlite_proto/
  291. ssl_errors/
  292. ssl_errors_strings.grdp
  293. ssl_errors_strings_grdp/
  294. startup_metric_utils/
  295. storage_monitor/
  296. strictmode/
  297. strings/
  298. subresource_filter/
  299. subresource_filter_strings.grdp
  300. subresource_redirect/
  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.