#include "components/omnibox/browser/most_visited_sites_provider.h"
#include <string>
#include <vector>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/escape.h"
#include "components/history/core/browser/top_sites.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_match_classification.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/template_url_service.h"
#include "components/url_formatter/url_formatter.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
#include "third_party/omnibox_proto/types.pb.h"
#include "ui/base/device_form_factor.h"
#include "url/gurl.h"
namespace {
constexpr const int kMostVisitedTilesAggregateRelevance = …;
constexpr const int kMostVisitedTilesIndividualHighRelevance = …;
constexpr const int kMostVisitedTilesIndividualLowRelevance = …;
constexpr const int kLastHighRelevanceIndividualTile = …;
constexpr const int kMaxRecordedTileIndex = …;
constexpr char kHistogramTileTypeCountSearch[] = …;
constexpr char kHistogramTileTypeCountURL[] = …;
constexpr char kHistogramDeletedTileType[] = …;
constexpr char kHistogramDeletedTileIndex[] = …;
enum SuggestTileType { … };
AutocompleteMatch BuildMatch(AutocompleteProvider* provider,
AutocompleteProviderClient* client,
const std::u16string& description,
const GURL& url,
int relevance,
AutocompleteMatchType::Type type) { … }
template <typename TileContainer>
bool BuildTileSuggest(AutocompleteProvider* provider,
AutocompleteProviderClient* const client,
ui::DeviceFormFactor device_form_factor,
const TileContainer& container,
ACMatches& matches) { … }
}
void MostVisitedSitesProvider::Start(const AutocompleteInput& input,
bool minimal_changes) { … }
void MostVisitedSitesProvider::Stop(bool clear_cached_results,
bool due_to_user_inactivity) { … }
MostVisitedSitesProvider::MostVisitedSitesProvider(
AutocompleteProviderClient* client,
AutocompleteProviderListener* listener)
: … { … }
MostVisitedSitesProvider::~MostVisitedSitesProvider() = default;
void MostVisitedSitesProvider::OnMostVisitedUrlsAvailable(
const history::MostVisitedURLList& urls) { … }
bool MostVisitedSitesProvider::AllowMostVisitedSitesSuggestions(
const AutocompleteInput& input) const { … }
void MostVisitedSitesProvider::BlockURL(const GURL& site_url) { … }
void MostVisitedSitesProvider::DeleteMatch(const AutocompleteMatch& match) { … }
void MostVisitedSitesProvider::DeleteMatchElement(
const AutocompleteMatch& source_match,
size_t element_index) { … }