tree: 4076d819df62c4e8bc49356eff46cedfe06ea45b [path history] [tgz]
  1. command_line_top_host_provider.cc
  2. command_line_top_host_provider.h
  3. command_line_top_host_provider_unittest.cc
  4. fake_hints_fetcher.h
  5. hint_cache.cc
  6. hint_cache.h
  7. hint_cache_unittest.cc
  8. hints_fetcher.cc
  9. hints_fetcher.h
  10. hints_fetcher_factory.cc
  11. hints_fetcher_factory.h
  12. hints_fetcher_unittest.cc
  13. hints_manager.cc
  14. hints_manager.h
  15. hints_manager_unittest.cc
  16. hints_processing_util.cc
  17. hints_processing_util.h
  18. hints_processing_util_unittest.cc
  19. insertion_ordered_set.h
  20. insertion_ordered_set_unittest.cc
  21. memory_hint.cc
  22. memory_hint.h
  23. mock_optimization_guide_decider.cc
  24. mock_optimization_guide_decider.h
  25. mock_push_notification_manager.cc
  26. mock_push_notification_manager.h
  27. optimization_guide_decider.h
  28. optimization_guide_decision.h
  29. optimization_guide_navigation_data.cc
  30. optimization_guide_navigation_data.h
  31. optimization_guide_navigation_data_unittest.cc
  32. optimization_guide_store.cc
  33. optimization_guide_store.h
  34. optimization_guide_store_unittest.cc
  35. optimization_metadata.cc
  36. optimization_metadata.h
  37. optimization_metadata_unittest.cc
  38. push_notification_manager.cc
  39. push_notification_manager.h
  40. push_notification_manager_unittest.cc
  41. README.md
  42. store_update_data.cc
  43. store_update_data.h
  44. store_update_data_unittest.cc
  45. tab_url_provider.h
  46. test_hints_config.cc
  47. test_hints_config.h
  48. test_optimization_guide_decider.cc
  49. test_optimization_guide_decider.h
  50. top_host_provider.h
  51. url_pattern_with_wildcards.cc
  52. url_pattern_with_wildcards.h
  53. url_pattern_with_wildcards_unittest.cc
components/optimization_guide/core/hints/README.md

Optimization Guide Hints

This directory contains the implementation of the hints component of the Optimization Guide. Optimization “Hints” are small pieces of metadata about pages that can be fetched from the optimization guide service. This component is responsible for fetching, caching, and managing optimization hints.

Most hints can only be fetched from non-incognito profiles that have provided consent for anonymous data collection, but some simple hints are delivered as filters in the optimization guide hints component.

Overview

The core logic resides in HintsManager, which is the central class for managing optimization hints. It is responsible for fetching hints from the remote Optimization Guide Service, caching them, and providing Decisions and Metadata.

The public-facing API for consumers is the OptimizationGuideDecider interface. This interface is implemented by OptimizationGuideKeyedService (in //chrome/browser/optimization_guide), which acts as a facade. The keyed service owns the HintsManager and delegates all decision-making requests to it.

Other key classes in this directory include:

  • HintsFetcher: Responsible for fetching hints from the remote service.
  • HintCache: Responsible for caching hints in memory and on disk.
  • OptimizationGuideStore: The persistent store for hints, implemented using a LevelDB database.

Usage

Consumers should obtain an instance of the OptimizationGuideDecider interface from the OptimizationGuideKeyedService to get Decisions and Metadata.

The HintsManager (via the OptimizationGuideKeyedService) respects user preferences and policies when fetching and providing hints. For example, hint fetches are gated by the checks in the IsUserPermittedToFetchFromRemoteOptimizationGuide function, which considers incognito status and user consent for anonymous data collection.