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