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