[go: nahoru, domu]

tree: 6e7ee0db479f54566334bfb00fc2446d6b8c2f99 [path history] [tgz]
  1. COMMON_METADATA
  2. DIR_METADATA
  3. font_access_manager.cc
  4. font_access_manager.h
  5. font_access_manager_browsertest.cc
  6. font_access_manager_unittest.cc
  7. font_access_test_utils.cc
  8. font_access_test_utils.h
  9. font_enumeration_cache.cc
  10. font_enumeration_cache.h
  11. font_enumeration_data_source.cc
  12. font_enumeration_data_source.h
  13. font_enumeration_data_source_fuchsia.cc
  14. font_enumeration_data_source_fuchsia.h
  15. font_enumeration_data_source_linux.cc
  16. font_enumeration_data_source_linux.h
  17. font_enumeration_data_source_mac.h
  18. font_enumeration_data_source_mac.mm
  19. font_enumeration_data_source_unittest.cc
  20. font_enumeration_data_source_win.cc
  21. font_enumeration_data_source_win.h
  22. OWNERS
  23. README.md
content/browser/font_access/README.md

Font Access API

This directory contains the browser-side implementation of Font Access API.

Related directories

//third_party/blink/renderer/modules/font_access/ contains the renderer-side implementation, and //third_party/blink/public/mojom/font_access contains the mojom interface for this API.

Code map

It consists of the following parts:

  • FontAccessManager: content::FontAccessManager implements blink::mojom::FontAccessManager, providing a way to enumerate local fonts. It checks for the requirements to access local fonts such as user permission, page visibility and transient user activation. Once all the requirements are met, it returns the fonts data from FontEnumerationCache. In terms of code ownership, there is one FontAccessManager per StoragePartitionImpl; Frames are bound to FontAccessManager via a BindingContext.

  • FontEnumerationCache: content::FontEnumerationCache is a cache-like object that memoizes the data about locally installed fonts as well as the operation status, given the user locale. The data is read via content::FontEnumerationDataSource.GetFonts() and is stored and served in ReadOnlySharedMemoryRegion. This class is not thread-safe. Each instance must be accessed from a single sequence, which must allow blocking.

  • FontEnumerationDataSource: content::FontEnumerationDataSource, inherited by OS-specific subclasses, reads locally installed fonts from the underlying OS. While the subclasses of this class contains the implementation for reading font data, this class itself does not, as it is instantiated for non-supported OS. It is not thread-safe; all methods except for the constructor must be used on the same sequence, and the sequence must allow blocking I/O operations.