Skip to content
Branch: master
Find file History
Pull request Compare This branch is 1110 commits ahead, 28345 commits behind chromium:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
about_ui
account_id
apdu
app_modal
app_modal_strings_grdp
arc
assist_ranker
autofill
autofill_assistant
autofill_payments_strings_grdp
autofill_strings_grdp
background_task_scheduler
base32
blacklist
bookmark_bar_strings_grdp
bookmarks
browser_sync
browser_watcher
browsing_data
browsing_data_strings_grdp
bubble
captive_portal
cast_certificate
cast_channel
cbor
cdm
certificate_matching
certificate_transparency
chrome_cleaner
chromeos_camera
client_update_protocol
cloud_devices
component_updater
components_strings_grd
consent_auditor
constrained_window
content_capture
content_settings
contextual_search
cookie_config
country_codes
crash
crash_strings_grdp
cronet
crx_file
data_reduction_proxy
data_use_measurement
dbus
device_event_log
discardable_memory
dom_distiller
dom_distiller_strings_grdp
domain_reliability
download
drive
embedder_support/android
encrypted_messages
error_page
error_page_strings_grdp
exo
favicon
favicon_base
feature_engagement
feed
feedback
filename_generation
flags_ui
games
gcm_driver
google
grpc_support
guest_os
guest_view
gwp_asan
handoff
heap_profiling
history
image_fetcher
infobars
invalidation
keep_alive_registry
keyed_service
language
language_usage_metrics
leveldb_proto
link_header_util
location
login
media_message_center
metrics
metrics_services_manager
minidump_uploader
mirroring
module_installer
nacl
navigation_interception
navigation_metrics
net_log
neterror
network_hints
network_session_configurator
network_time
ntp_snippets
ntp_snippets_strings_grdp
ntp_tiles
offline_items_collection
offline_pages
omnibox
omnibox_strings_grdp
onc
open_from_clipboard
optimization_guide
os_crypt
ownership
page_image_annotation
page_info_strings_grdp
page_load_metrics
paint_preview
password_manager
password_manager_strings_grdp
payments
payments_strings_grdp
pdf
pdf_strings_grdp
performance_manager
plugins
policy
policy_strings_grdp
pref_registry
prefs
previews
printing
printing_component_strings_grdp
profile_metrics
proxy_config
pwg_encoder
query_parser
quirks
rappor
reading_list
remote_cocoa
renderer_context_menu
reset_password_strings_grdp
resources
rlz
safe_browsing
safe_search_api
scheduling_metrics
search
search_engines
search_provider_logos
security_interstitials
security_interstitials_strings_grdp
security_state
security_state_strings_grdp
send_tab_to_self
services
session_manager
sessions
signin
spellcheck
ssl_errors
ssl_errors_strings_grdp
startup_metric_utils
storage_monitor
strings
subresource_filter
suggestions
sync
sync_bookmarks
sync_device_info
sync_preferences
sync_sessions
sync_ui_strings_grdp
sync_user_events
tab_count_metrics
test
timers
tracing
translate
translate_strings_grdp
ui_devtools
ui_metrics
ukm
undo
undo_strings_grdp
unified_consent
update_client
upload_list
url_formatter
url_matcher
url_pattern_index
user_actions_ui
user_manager
user_prefs
variations
vector_icons
version_info
version_ui
version_ui_strings_grdp
visitedlink
viz
web_cache
web_modal
web_resource
webcrypto
webdata
webdata_services
webrtc_logging
wifi
zoom
zucchini
BUILD.gn
DEPS
OWNERS
README.md
app_modal_strings.grdp
autofill_assistant_strings.grdp
autofill_payments_strings.grdp
autofill_strings.grdp
bookmark_bar_strings.grdp
bookmark_component_strings.grdp
browsing_data_strings.grdp
components_chromium_strings.grd
components_google_chrome_strings.grd
components_locale_settings.grd
components_settings_strings.grdp
components_strings.grd
crash_strings.grdp
dialog_strings.grdp
dom_distiller_strings.grdp
error_page_strings.grdp
find_in_page_strings.grdp
flags_strings.grdp
history_strings.grdp
login_dialog_strings.grdp
management_strings.grdp
media_message_center_strings.grdp
new_or_sad_tab_strings.grdp
ntp_snippets_strings.grdp
omnibox_strings.grdp
page_info_strings.grdp
password_manager_strings.grdp
payments_strings.grdp
pdf_strings.grdp
policy_strings.grdp
print_media_strings.grdp
printing_component_strings.grdp
reset_password_strings.grdp
safe_browsing_strings.grdp
security_interstitials_strings.grdp
security_state_strings.grdp
ssl_errors_strings.grdp
sync_ui_strings.grdp
translate_strings.grdp
typemaps.gni
undo_strings.grdp
version_ui_strings.grdp

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.

You can’t perform that action at this time.