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