tree: bd010a78a459fca3a717f4e99315f8ac98256ed2 [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. 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. supervised_user_error_page/
  166. supervised_user_error_page_strings_grdp/
  167. sync/
  168. sync_bookmarks/
  169. sync_preferences/
  170. sync_sessions/
  171. sync_ui_strings_grdp/
  172. test/
  173. thread_pool_util/
  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. web_restrictions/
  203. webcrypto/
  204. webdata/
  205. webdata_services/
  206. webrtc_logging/
  207. wifi/
  208. zoom/
  209. zucchini/
  210. BUILD.gn
  211. DEPS
  212. OWNERS
  213. README.md
  214. app_modal_strings.grdp
  215. autofill_assistant_strings.grdp
  216. autofill_payments_strings.grdp
  217. autofill_strings.grdp
  218. bookmark_bar_strings.grdp
  219. bookmark_component_strings.grdp
  220. browsing_data_strings.grdp
  221. components_chromium_strings.grd
  222. components_google_chrome_strings.grd
  223. components_locale_settings.grd
  224. components_settings_strings.grdp
  225. components_strings.grd
  226. crash_strings.grdp
  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. page_info_strings.grdp
  238. password_manager_strings.grdp
  239. payments_strings.grdp
  240. pdf_strings.grdp
  241. policy_strings.grdp
  242. print_media_strings.grdp
  243. printing_component_strings.grdp
  244. reset_password_strings.grdp
  245. safe_browsing_strings.grdp
  246. security_interstitials_strings.grdp
  247. security_state_strings.grdp
  248. ssl_errors_strings.grdp
  249. supervised_user_error_page_strings.grdp
  250. sync_ui_strings.grdp
  251. translate_strings.grdp
  252. typemaps.gni
  253. undo_strings.grdp
  254. 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.