tree: fcfad4bb78d722177f2541ed4520a86c1b50fbbf [path history] [tgz]
  1. android/
  2. enterprise/
  3. search_engine_choice/
  4. BUILD.gn
  5. choice_made_location.h
  6. COMMON_METADATA
  7. COMPLIANCE_OWNERS
  8. default_search_manager.cc
  9. default_search_manager.h
  10. default_search_manager_unittest.cc
  11. DEPS
  12. DIR_METADATA
  13. keyword_table.cc
  14. keyword_table.h
  15. keyword_table_unittest.cc
  16. keyword_web_data_service.cc
  17. keyword_web_data_service.h
  18. OWNERS
  19. PRESUBMIT.py
  20. README.md
  21. reconciling_template_url_data_holder.cc
  22. reconciling_template_url_data_holder.h
  23. reconciling_template_url_data_holder_unittest.cc
  24. regulatory_extension_type.h
  25. search_engine_type.h
  26. search_engine_utils.cc
  27. search_engine_utils.h
  28. search_engines_pref_names.h
  29. search_engines_switches.cc
  30. search_engines_switches.h
  31. search_engines_test_environment.cc
  32. search_engines_test_environment.h
  33. search_engines_test_util.cc
  34. search_engines_test_util.h
  35. search_host_to_urls_map.cc
  36. search_host_to_urls_map.h
  37. search_host_to_urls_map_unittest.cc
  38. search_terms_data.cc
  39. search_terms_data.h
  40. template_url.cc
  41. template_url.h
  42. template_url_data.cc
  43. template_url_data.h
  44. template_url_data_unittest.cc
  45. template_url_data_util.cc
  46. template_url_data_util.h
  47. template_url_fetcher.cc
  48. template_url_fetcher.h
  49. template_url_id.h
  50. template_url_parser.cc
  51. template_url_parser.h
  52. template_url_prepopulate_data.cc
  53. template_url_prepopulate_data.h
  54. template_url_prepopulate_data_resolver.cc
  55. template_url_prepopulate_data_resolver.h
  56. template_url_prepopulate_data_unittest.cc
  57. template_url_service.cc
  58. template_url_service.h
  59. template_url_service_client.h
  60. template_url_service_observer.h
  61. template_url_service_test_util.cc
  62. template_url_service_test_util.h
  63. template_url_service_unittest.cc
  64. template_url_service_util_unittest.cc
  65. template_url_starter_pack_data.cc
  66. template_url_starter_pack_data.h
  67. template_url_unittest.cc
  68. testing_search_terms_data.cc
  69. testing_search_terms_data.h
  70. util.cc
  71. util.h
components/search_engines/README.md

Search Engines Component

What is the Search Engines Component?

This component provides the core logic for managing search engines in Chromium. It includes the data structures and services for storing, retrieving, and managing the set of available search engines. It is also responsible for determining and setting the default search engine.

The component handles a variety of search engine-related tasks, including:

  • Persistence: Storing and retrieving search engine data from the web database.
  • Sync: Syncing search engines across devices using syncer::SyncableService.
  • Prepopulation: Providing a default set of search engines based on the user's country.
  • Dynamic Fetching: Discovering and adding new search engines from websites via OpenSearch Description Documents (OSDD).
  • Default Search Management: Determining the default search engine based on a hierarchy of sources (policy, extensions, user choice, and fallback).

How to Use the Search Engines Component

The primary entry point for interacting with this component is the TemplateURLService. All modifications to the set of search engines must be done through this service to ensure that changes are correctly persisted and synchronized.

Key Classes

  • TemplateURLService: A KeyedService that manages the lifecycle of TemplateURL objects. Use this service to add, remove, update, and retrieve search engines.
  • TemplateURL: Represents a single search engine, containing its name, keyword, and various URL templates (for search, suggestions, etc.).
  • TemplateURLData: A plain data struct that holds all the information about a search engine. It is used to create TemplateURL objects and for persistence and synchronization.
  • DefaultSearchManager: Determines the default search engine based on a hierarchy of sources: policy, extensions, user settings, and prepopulated data.
  • KeywordWebDataService: A specialization of WebDataServiceBase that manages the keywords table in the web database. It is responsible for persisting search engine data.
  • TemplateURLFetcher: A KeyedService that asynchronously downloads OpenSearch Description Documents (OSDD) from websites to discover and add new search engines.
  • TemplateURLParser: Parses OpenSearch Description Documents and creates TemplateURL objects from them.

Lay of the Land

The components/search_engines directory is structured as follows:

  • template_url_service.h / .cc: The main service for managing search engines.
  • template_url.h / .cc: The data model for a single search engine.
  • default_search_manager.h / .cc: Logic for managing the default search provider.
  • keyword_web_data_service.h / .cc: Handles persistence of search engine data to the WebDatabase via the KeywordTable.
  • template_url_prepopulate_data.h / .cc: Provides the initial, country-specific set of search engines.
  • template_url_fetcher.h / .cc: Asynchronously downloads OpenSearch Description Documents (OSDD) to add new search engines discovered on websites.
  • android/: Contains Android-specific logic for search engines.
  • enterprise/: Contains logic for managing search engines in an enterprise environment, including support for policy-defined search providers.
  • search_engine_choice/: Contains logic related to the search engine choice screen, which is shown to users in certain regions (e.g., the EEA).

Contacts

For questions about this component, please contact the owners listed in the OWNERS file.