keyword_cluster_finalizer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_HISTORY_CLUSTERS_CORE_KEYWORD_CLUSTER_FINALIZER_H_
  5. #define COMPONENTS_HISTORY_CLUSTERS_CORE_KEYWORD_CLUSTER_FINALIZER_H_
  6. #include <string>
  7. #include "base/containers/flat_set.h"
  8. #include "components/history_clusters/core/cluster_finalizer.h"
  9. namespace optimization_guide {
  10. struct EntityMetadata;
  11. } // namespace optimization_guide
  12. namespace history_clusters {
  13. // A cluster finalizer that determines the set of keywords for a given cluster.
  14. class KeywordClusterFinalizer : public ClusterFinalizer {
  15. public:
  16. explicit KeywordClusterFinalizer(
  17. const base::flat_map<std::string, optimization_guide::EntityMetadata>&
  18. entity_metadata_map);
  19. ~KeywordClusterFinalizer() override;
  20. // ClusterFinalizer:
  21. void FinalizeCluster(history::Cluster& cluster) override;
  22. private:
  23. // A map from human readable entity name to the metadata associated with that
  24. // entity name.
  25. const base::flat_map<std::string, optimization_guide::EntityMetadata>
  26. entity_metadata_map_;
  27. };
  28. } // namespace history_clusters
  29. #endif // COMPONENTS_HISTORY_CLUSTERS_CORE_KEYWORD_CLUSTER_FINALIZER_H_