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