1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BROWSING_TOPICS_CANDIDATE_TOPIC_H_
6 #define COMPONENTS_BROWSING_TOPICS_CANDIDATE_TOPIC_H_
8 #include "components/browsing_topics/common/common_types.h"
10 namespace browsing_topics {
12 // Contains a topic, the associated attributes, and flags that determine how
13 // the topic should be handled. This is used as the intermediate result type
14 // when calculating the topics for a site.
15 class CandidateTopic {
17 static CandidateTopic Create(Topic topic,
19 bool should_be_filtered,
22 int64_t model_version);
24 static CandidateTopic CreateInvalid();
26 CandidateTopic(const CandidateTopic&) = delete;
27 CandidateTopic& operator=(const CandidateTopic&) = delete;
29 CandidateTopic(CandidateTopic&&) = default;
30 CandidateTopic& operator=(CandidateTopic&&) = default;
32 bool IsValid() const { return topic_ != Topic(0); }
34 const Topic& topic() const { return topic_; }
36 bool is_true_topic() const { return is_true_topic_; }
38 bool should_be_filtered() const { return should_be_filtered_; }
40 int config_version() const { return config_version_; }
42 int taxonomy_version() const { return taxonomy_version_; }
44 int64_t model_version() const { return model_version_; }
47 CandidateTopic(Topic topic,
49 bool should_be_filtered,
52 int64_t model_version);
56 bool should_be_filtered_;
58 int taxonomy_version_;
59 int64_t model_version_;
62 } // namespace browsing_topics
64 #endif // COMPONENTS_BROWSING_TOPICS_UTIL_H_