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