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