#include "components/omnibox/browser/actions/history_clusters_action.h"
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/history_clusters/core/config.h"
#include "components/history_clusters/core/features.h"
#include "components/history_clusters/core/history_clusters_service.h"
#include "components/history_clusters/core/history_clusters_util.h"
#include "components/history_clusters/core/url_constants.h"
#include "components/omnibox/browser/actions/omnibox_action.h"
#include "components/omnibox/browser/actions/omnibox_action_concepts.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_result.h"
#include "components/strings/grit/components_strings.h"
#include "net/base/url_util.h"
#if defined(SUPPORT_PEDALS_VECTOR_ICONS)
#include "components/omnibox/browser/vector_icons.h"
#endif
namespace history_clusters {
namespace {
template <class EnumT>
void RecordShownUsedEnumAndCtrMetrics(std::string_view metric_name,
EnumT val,
std::string_view label,
bool executed) { … }
}
int TopRelevance(std::vector<AutocompleteMatch>::const_iterator matches_begin,
std::vector<AutocompleteMatch>::const_iterator matches_end,
TopRelevanceFilter filter) { … }
bool IsNavigationIntent(int top_search_relevance,
int top_navigation_relevance,
int navigation_intent_score_threshold) { … }
GURL GetFullJourneysUrlForQuery(const std::string& query) { … }
HistoryClustersAction::HistoryClustersAction(
const std::string& query,
const history::ClusterKeywordData& matched_keyword_data)
: … { … }
void HistoryClustersAction::RecordActionShown(size_t position,
bool executed) const { … }
void HistoryClustersAction::Execute(ExecutionContext& context) const { … }
OmniboxActionId HistoryClustersAction::ActionId() const { … }
#if defined(SUPPORT_PEDALS_VECTOR_ICONS)
const gfx::VectorIcon& HistoryClustersAction::GetVectorIcon() const { … }
#endif
HistoryClustersAction::~HistoryClustersAction() = default;
void AttachHistoryClustersActions(
history_clusters::HistoryClustersService* service,
AutocompleteResult& result) { … }
}