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