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