1 // Copyright 2013 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.
5 #ifndef COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_
6 #define COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_
11 #include "base/metrics/field_trial.h"
13 namespace variations
{
17 // Wrapper over Study with extra information computed during pre-processing,
18 // such as whether the study is expired and its total probability.
19 class ProcessedStudy
{
24 bool Init(const Study
* study
, bool is_expired
);
26 const Study
* study() const { return study_
; }
28 base::FieldTrial::Probability
total_probability() const {
29 return total_probability_
;
32 bool is_expired() const { return is_expired_
; }
34 // Gets the index of the experiment with the given |name|. Returns -1 if no
35 // experiment is found.
36 int GetExperimentIndexByName(const std::string
& name
) const;
38 static bool ValidateAndAppendStudy(
41 std::vector
<ProcessedStudy
>* processed_studies
);
44 // Corresponding Study object. Weak reference.
47 // Computed total group probability for the study.
48 base::FieldTrial::Probability total_probability_
;
50 // Whether the study is expired.
54 } // namespace variations
56 #endif // COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_