tree: a3c85b1a436b290afce8cef88b437c4da3a38c07 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. README.md
  5. about_ui/
  6. account_id/
  7. apdu/
  8. app_modal/
  9. app_modal_strings.grdp
  10. app_modal_strings_grdp/
  11. arc/
  12. assist_ranker/
  13. autofill/
  14. autofill_assistant/
  15. autofill_assistant_strings.grdp
  16. autofill_payments_strings.grdp
  17. autofill_payments_strings_grdp/
  18. autofill_strings.grdp
  19. autofill_strings_grdp/
  20. background_task_scheduler/
  21. base32/
  22. blacklist/
  23. bookmark_bar_strings.grdp
  24. bookmark_bar_strings_grdp/
  25. bookmark_component_strings.grdp
  26. bookmarks/
  27. browser_sync/
  28. browser_watcher/
  29. browsing_data/
  30. browsing_data_strings.grdp
  31. browsing_data_strings_grdp/
  32. bubble/
  33. captive_portal/
  34. cast_certificate/
  35. cast_channel/
  36. cbor/
  37. cdm/
  38. certificate_matching/
  39. certificate_transparency/
  40. chrome_cleaner/
  41. chromeos_camera/
  42. client_update_protocol/
  43. cloud_devices/
  44. component_updater/
  45. components_chromium_strings.grd
  46. components_google_chrome_strings.grd
  47. components_locale_settings.grd
  48. components_settings_strings.grdp
  49. components_strings.grd
  50. components_strings_grd/
  51. consent_auditor/
  52. constrained_window/
  53. content_capture/
  54. content_settings/
  55. contextual_search/
  56. cookie_config/
  57. country_codes/
  58. crash/
  59. crash_strings.grdp
  60. crash_strings_grdp/
  61. cronet/
  62. crx_file/
  63. data_reduction_proxy/
  64. data_use_measurement/
  65. dbus/
  66. device_event_log/
  67. dialog_strings.grdp
  68. discardable_memory/
  69. dom_distiller/
  70. dom_distiller_strings.grdp
  71. dom_distiller_strings_grdp/
  72. domain_reliability/
  73. download/
  74. drive/
  75. embedder_support/
  76. encrypted_messages/
  77. error_page/
  78. error_page_strings.grdp
  79. error_page_strings_grdp/
  80. exo/
  81. favicon/
  82. favicon_base/
  83. feature_engagement/
  84. feed/
  85. feedback/
  86. filename_generation/
  87. find_in_page_strings.grdp
  88. flags_ui/
  89. gcm_driver/
  90. google/
  91. grpc_support/
  92. guest_view/
  93. gwp_asan/
  94. handoff/
  95. heap_profiling/
  96. history/
  97. history_strings.grdp
  98. image_fetcher/
  99. infobars/
  100. invalidation/
  101. keep_alive_registry/
  102. keyed_service/
  103. language/
  104. language_usage_metrics/
  105. leveldb_proto/
  106. link_header_util/
  107. location/
  108. login/
  109. login_dialog_strings.grdp
  110. management_strings.grdp
  111. media_message_center/
  112. media_message_center_strings.grdp
  113. metrics/
  114. metrics_services_manager/
  115. minidump_uploader/
  116. mirroring/
  117. module_installer/
  118. nacl/
  119. navigation_interception/
  120. navigation_metrics/
  121. net_log/
  122. neterror/
  123. network_hints/
  124. network_session_configurator/
  125. network_time/
  126. new_or_sad_tab_strings.grdp
  127. ntp_snippets/
  128. ntp_snippets_strings.grdp
  129. ntp_snippets_strings_grdp/
  130. ntp_tiles/
  131. ntp_tiles_strings.grdp
  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. password_manager/
  146. password_manager_strings.grdp
  147. payments/
  148. payments_strings.grdp
  149. payments_strings_grdp/
  150. pdf/
  151. pdf_strings.grdp
  152. pdf_strings_grdp/
  153. plugins/
  154. policy/
  155. policy_strings.grdp
  156. policy_strings_grdp/
  157. pref_registry/
  158. prefs/
  159. previews/
  160. print_media_strings.grdp
  161. printing/
  162. printing_component_strings.grdp
  163. printing_component_strings_grdp/
  164. profile_metrics/
  165. proxy_config/
  166. pwg_encoder/
  167. query_parser/
  168. quirks/
  169. rappor/
  170. reading_list/
  171. remote_cocoa/
  172. renderer_context_menu/
  173. reset_password_strings.grdp
  174. reset_password_strings_grdp/
  175. resources/
  176. rlz/
  177. safe_browsing/
  178. safe_browsing_strings.grdp
  179. safe_search_api/
  180. scheduling_metrics/
  181. search/
  182. search_engines/
  183. search_provider_logos/
  184. security_interstitials/
  185. security_interstitials_strings.grdp
  186. security_interstitials_strings_grdp/
  187. security_state/
  188. security_state_strings.grdp
  189. security_state_strings_grdp/
  190. send_tab_to_self/
  191. services/
  192. session_manager/
  193. sessions/
  194. signin/
  195. spellcheck/
  196. ssl_errors/
  197. ssl_errors_strings.grdp
  198. ssl_errors_strings_grdp/
  199. startup_metric_utils/
  200. storage_monitor/
  201. strings/
  202. subresource_filter/
  203. suggestions/
  204. supervised_user_error_page/
  205. supervised_user_error_page_strings.grdp
  206. supervised_user_error_page_strings_grdp/
  207. sync/
  208. sync_bookmarks/
  209. sync_device_info/
  210. sync_preferences/
  211. sync_sessions/
  212. sync_ui_strings.grdp
  213. sync_ui_strings_grdp/
  214. sync_user_events/
  215. tab_count_metrics/
  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. webcrypto/
  250. webdata/
  251. webdata_services/
  252. webrtc_logging/
  253. wifi/
  254. zoom/
  255. 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.