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