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