[go: nahoru, domu]

tree: 9062232536d8d7d3de4895cb8fccd4d4fce4c288 [path history] [tgz]
  1. about_ui/
  2. access_code_cast/
  3. account_id/
  4. account_manager_core/
  5. aggregation_service/
  6. allocation_recorder/
  7. android_autofill/
  8. android_system_error_page/
  9. apdu/
  10. app_constants/
  11. app_restore/
  12. arc/
  13. arc_strings_grdp/
  14. assist_ranker/
  15. attribution_reporting/
  16. autofill/
  17. autofill_payments_strings_grdp/
  18. autofill_strings_grdp/
  19. back_forward_cache/
  20. background_fetch/
  21. background_sync/
  22. background_task_scheduler/
  23. base32/
  24. blocked_content/
  25. blocklist/
  26. bookmark_bar_strings_grdp/
  27. bookmark_component_strings_grdp/
  28. bookmarks/
  29. breadcrumbs/
  30. browser_sync/
  31. browser_ui/
  32. browsing_data/
  33. browsing_data_strings_grdp/
  34. browsing_topics/
  35. captive_portal/
  36. capture_mode/
  37. cast/
  38. cast_receiver/
  39. cast_streaming/
  40. cbor/
  41. cdm/
  42. certificate_matching/
  43. certificate_transparency/
  44. chrome_cleaner/
  45. chromeos_camera/
  46. client_hints/
  47. client_update_protocol/
  48. cloud_devices/
  49. commerce/
  50. commerce_strings_grdp/
  51. component_updater/
  52. components_chromium_strings_grd/
  53. components_google_chrome_strings_grd/
  54. components_strings_grd/
  55. consent_auditor/
  56. constrained_window/
  57. content_capture/
  58. content_creation/
  59. content_creation_strings_grdp/
  60. content_relationship_verification/
  61. content_settings/
  62. contextual_search/
  63. continuous_search/
  64. cookie_config/
  65. country_codes/
  66. crash/
  67. crash_strings_grdp/
  68. cronet/
  69. crx_file/
  70. custom_handlers/
  71. database_utils/
  72. dbus/
  73. desks_storage/
  74. device_event_log/
  75. device_reauth/
  76. device_signals/
  77. devtools/
  78. digital_goods/
  79. discardable_memory/
  80. dom_distiller/
  81. dom_distiller_strings_grdp/
  82. domain_reliability/
  83. download/
  84. drive/
  85. embedder_support/
  86. encrypted_messages/
  87. endpoint_fetcher/
  88. enterprise/
  89. enterprise_strings_grdp/
  90. environment_integrity/
  91. error_page/
  92. error_page_strings_grdp/
  93. exo/
  94. external_intents/
  95. external_intents_strings_grdp/
  96. externalauth/
  97. favicon/
  98. favicon_base/
  99. feature_engagement/
  100. feed/
  101. feedback/
  102. file_access/
  103. filename_generation/
  104. find_in_page/
  105. flags_strings_grdp/
  106. flags_ui/
  107. fuchsia_component_support/
  108. fuchsia_legacymetrics/
  109. fullscreen_control/
  110. fullscreen_control_strings_grdp/
  111. gcm_driver/
  112. global_media_controls/
  113. global_media_controls_strings_grdp/
  114. google/
  115. grpc_support/
  116. guest_os/
  117. guest_view/
  118. gwp_asan/
  119. handoff/
  120. headless/
  121. heap_profiling/
  122. heavy_ad_intervention/
  123. heavy_ad_intervention_strings_grdp/
  124. history/
  125. history_clusters/
  126. history_clusters_strings_grdp/
  127. history_strings_grdp/
  128. image_fetcher/
  129. infobars/
  130. installedapp/
  131. invalidation/
  132. javascript_dialogs/
  133. javascript_dialogs_strings_grdp/
  134. js_injection/
  135. keep_alive_registry/
  136. keyed_service/
  137. language/
  138. lens/
  139. leveldb_proto/
  140. link_header_util/
  141. live_caption/
  142. live_caption_strings_grdp/
  143. local_state/
  144. location/
  145. login/
  146. lookalikes/
  147. management/
  148. management_ios_strings_grdp/
  149. management_strings_grdp/
  150. media_control/
  151. media_device_salt/
  152. media_message_center/
  153. media_message_center_strings_grdp/
  154. media_router/
  155. memory_pressure/
  156. memory_system/
  157. messages/
  158. metal_util/
  159. metrics/
  160. metrics_services_manager/
  161. minidump_uploader/
  162. mirroring/
  163. ml/
  164. module_installer/
  165. nacl/
  166. named_mojo_ipc_server/
  167. navigation_interception/
  168. navigation_metrics/
  169. net_log/
  170. neterror/
  171. network_hints/
  172. network_session_configurator/
  173. network_time/
  174. new_or_sad_tab_strings_grdp/
  175. no_state_prefetch/
  176. ntp_snippets/
  177. ntp_tiles/
  178. offline_items_collection/
  179. offline_pages/
  180. omnibox/
  181. omnibox_pedal_ui_strings_grdp/
  182. omnibox_strings_grdp/
  183. on_load_script_injector/
  184. onc/
  185. open_from_clipboard/
  186. openscreen_platform/
  187. optimization_guide/
  188. origin_trials/
  189. os_crypt/
  190. ownership/
  191. page_image_annotation/
  192. page_image_service/
  193. page_info/
  194. page_info_strings_grdp/
  195. page_load_metrics/
  196. paint_preview/
  197. password_manager/
  198. password_manager_strings_grdp/
  199. payments/
  200. payments_strings_grdp/
  201. pdf/
  202. pdf_strings_grdp/
  203. performance_manager/
  204. permissions/
  205. permissions_strings_grdp/
  206. plugins/
  207. plus_addresses/
  208. policy/
  209. policy_strings_grdp/
  210. power_bookmarks/
  211. power_metrics/
  212. power_monitor/
  213. pref_registry/
  214. prefs/
  215. previous_session_info/
  216. print_media_strings_grdp/
  217. printing/
  218. printing_component_strings_grdp/
  219. privacy_sandbox/
  220. privacy_sandbox_strings_grdp/
  221. profile_metrics/
  222. proxy_config/
  223. pwg_encoder/
  224. qr_code_generator/
  225. query_parser/
  226. query_tiles/
  227. quirks/
  228. reading_list/
  229. reduce_accept_language/
  230. remote_cocoa/
  231. renderer_context_menu/
  232. reporting/
  233. reset_password_strings_grdp/
  234. resources/
  235. rlz/
  236. safe_browsing/
  237. safe_search_api/
  238. safety_check/
  239. saved_tab_groups/
  240. schema_org/
  241. search/
  242. search_engines/
  243. search_provider_logos/
  244. security_interstitials/
  245. security_interstitials_strings_grdp/
  246. security_state/
  247. segmentation_platform/
  248. send_tab_to_self/
  249. send_tab_to_self_strings_grdp/
  250. services/
  251. session_manager/
  252. session_proto_db/
  253. sessions/
  254. shared_highlighting/
  255. signin/
  256. site_engagement/
  257. site_isolation/
  258. site_settings_strings_grdp/
  259. sms_strings_grdp/
  260. soda/
  261. speech/
  262. spellcheck/
  263. sqlite_proto/
  264. ssl_errors/
  265. ssl_errors_strings_grdp/
  266. stability_report/
  267. startup_metric_utils/
  268. storage_monitor/
  269. strictmode/
  270. strings/
  271. stylus_handwriting/
  272. subresource_filter/
  273. subresource_filter_strings_grdp/
  274. supervised_user/
  275. supervised_user_strings_grdp/
  276. sync/
  277. sync_bookmarks/
  278. sync_device_info/
  279. sync_preferences/
  280. sync_sessions/
  281. sync_ui_strings_grdp/
  282. sync_user_events/
  283. system_media_controls/
  284. tab_groups/
  285. tab_groups_strings_grdp/
  286. test/
  287. thin_webview/
  288. tracing/
  289. translate/
  290. translate_strings_grdp/
  291. trusted_vault/
  292. ui_devtools/
  293. ui_metrics/
  294. ukm/
  295. undo/
  296. undo_strings_grdp/
  297. unexportable_keys/
  298. unified_consent/
  299. update_client/
  300. upload_list/
  301. url_formatter/
  302. url_matcher/
  303. url_pattern_index/
  304. url_rewrite/
  305. user_actions_ui/
  306. user_education/
  307. user_education_strings_grdp/
  308. user_manager/
  309. user_notes/
  310. user_prefs/
  311. value_store/
  312. variations/
  313. vector_icons/
  314. version_info/
  315. version_ui/
  316. version_ui_strings_grdp/
  317. visitedlink/
  318. viz/
  319. web_app_resources/
  320. web_cache/
  321. web_modal/
  322. web_package/
  323. web_resource/
  324. webapk/
  325. webapps/
  326. webauthn/
  327. webcrypto/
  328. webdata/
  329. webdata_services/
  330. webrtc/
  331. webrtc_logging/
  332. webxr/
  333. webxr_strings_grdp/
  334. wifi/
  335. winhttp/
  336. zoom/
  337. zucchini/
  338. .eslintrc.js
  339. android_system_error_page_strings.grdp
  340. arc_strings.grdp
  341. autofill_payments_strings.grdp
  342. autofill_strings.grdp
  343. blocked_content_strings.grdp
  344. bookmark_bar_strings.grdp
  345. bookmark_component_strings.grdp
  346. browsing_data_strings.grdp
  347. BUILD.gn
  348. commerce_strings.grdp
  349. components_chromium_strings.grd
  350. components_google_chrome_strings.grd
  351. components_locale_settings.grd
  352. components_settings_strings.grdp
  353. components_strings.grd
  354. content_creation_strings.grdp
  355. crash_strings.grdp
  356. DEPS
  357. dialog_strings.grdp
  358. dom_distiller_strings.grdp
  359. enterprise_strings.grdp
  360. error_page_strings.grdp
  361. external_intents_strings.grdp
  362. find_in_page_strings.grdp
  363. flags_strings.grdp
  364. fullscreen_control_strings.grdp
  365. global_media_controls_strings.grdp
  366. heavy_ad_intervention_strings.grdp
  367. history_clusters_strings.grdp
  368. history_strings.grdp
  369. javascript_dialogs_strings.grdp
  370. live_caption_strings.grdp
  371. login_dialog_strings.grdp
  372. management_ios_strings.grdp
  373. management_strings.grdp
  374. media_message_center_strings.grdp
  375. new_or_sad_tab_strings.grdp
  376. omnibox_pedal_ui_strings.grdp
  377. omnibox_strings.grdp
  378. OWNERS
  379. page_info_strings.grdp
  380. paint_preview_strings.grdp
  381. password_manager_strings.grdp
  382. payments_strings.grdp
  383. pdf_strings.grdp
  384. permissions_strings.grdp
  385. policy_strings.grdp
  386. PRESUBMIT.py
  387. print_media_strings.grdp
  388. printing_component_strings.grdp
  389. privacy_sandbox_strings.grdp
  390. protocol_handler_strings.grdp
  391. README.md
  392. reset_password_strings.grdp
  393. security_interstitials_strings.grdp
  394. send_tab_to_self_strings.grdp
  395. site_settings_strings.grdp
  396. sms_strings.grdp
  397. ssl_errors_strings.grdp
  398. subresource_filter_strings.grdp
  399. supervised_user_strings.grdp
  400. sync_ui_strings.grdp
  401. tab_groups_strings.grdp
  402. translate_strings.grdp
  403. undo_strings.grdp
  404. user_education_strings.grdp
  405. version_ui_strings.grdp
  406. webapps_strings.grdp
  407. webxr_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.

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).

Note that the above list is meant to be exhaustive. A component should not be added just to separate it from other code in the same layer that is the only consumer; that can be done with strict DEPS or GN visibility rules.

Before adding a new component

  • Is there an existing component that you can leverage instead of introducing a new component?
    • Can you restructure an existing component to logically encompass the proposed new code?
    • As a general rule, we prefer fewer top level components. So, consider whether adding sub-features within an existing component is more appropriate for your use case.
    • Historically, dependency issues were simply addressed by adding new components. But, you can (and it is preferred to) solve that by restructing an existing component and its dependencies where possible.

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.
    • You must specify at least two OWNERS for any new component.
  • A //components/OWNER must approve of the location of your code.
  • The CL (either commit message or comment) must explicitly specify what use case(s) justify the new component.
  • 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.).
  • The CL adding a new component should be substantial enough so that //components/OWNERS can see its basic intended structure and usage before approving the addition (e.g., it should not just be an empty shell).
  • You must add a DIR_METADATA file under //components/{your component} with an appropriately specified bug-component.

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
  • //printing
  • //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, //ipc, and //third_party/blink/public. 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, //ipc, or third_party/blink/public 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 - BUILD.gn, DEPS, DIR_METADATA, OWNERS, README.md
  • 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 third_party/blink/public is a renderer process directory except for third_party/blink/public/common which can be used by all processes.

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.