#include "components/history_clusters/core/query_clusters_state.h"
#include <set>
#include "base/memory/ref_counted_delete_on_sequence.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
#include "components/strings/grit/components_strings.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_service_task.h"
#include "components/history_clusters/core/history_clusters_util.h"
#include "url/gurl.h"
#include "ui/base/l10n/l10n_util.h"
namespace history_clusters {
namespace {
QueryClustersFilterParams GetFilterParamsFromFlags(const std::string& query) { … }
}
class QueryClustersState::PostProcessor
: public base::RefCountedDeleteOnSequence<PostProcessor> { … };
QueryClustersState::QueryClustersState(
base::WeakPtr<HistoryClustersService> service,
history::HistoryService* history_service,
const std::string& query,
base::Time begin_time,
bool recluster)
: … { … }
QueryClustersState::~QueryClustersState() = default;
void QueryClustersState::LoadNextBatchOfClusters(ResultCallback callback) { … }
void QueryClustersState::GetUngroupedVisits(
base::TimeTicks query_start_time,
ResultCallback callback,
std::vector<history::Cluster> clusters,
QueryClustersContinuationParams new_continuation_params) { … }
void QueryClustersState::OnGotUngroupedVisits(
base::TimeTicks query_start_time,
ResultCallback callback,
std::vector<history::Cluster> clusters,
QueryClustersContinuationParams new_continuation_params,
std::vector<history::AnnotatedVisit> ungrouped_visits) { … }
void QueryClustersState::OnGotRawClusters(
base::TimeTicks query_start_time,
ResultCallback callback,
std::vector<history::Cluster> clusters,
QueryClustersContinuationParams new_continuation_params) { … }
void QueryClustersState::OnGotClusters(
base::ElapsedTimer post_processing_timer,
size_t clusters_from_backend_count,
base::TimeTicks query_start_time,
ResultCallback callback,
QueryClustersContinuationParams new_continuation_params,
std::vector<history::Cluster> clusters) { … }
void QueryClustersState::UpdateUniqueRawLabels(
const std::vector<history::Cluster>& clusters) { … }
}