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. 4 5 #ifndef COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_ 6 #define COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_ 7 8 #include <vector> 9 10 #include "base/metrics/field_trial.h" 11 12 namespace chrome_variations { 13 14 class Study; 15 16 // Wrapper over Study with extra information computed during pre-processing, 17 // such as whether the study is expired and its total probability. 18 class ProcessedStudy { 19 public: 20 ProcessedStudy(); 21 ~ProcessedStudy(); 22 23 bool Init(const Study* study, bool is_expired); 24 25 const Study* study() const { return study_; } 26 27 base::FieldTrial::Probability total_probability() const { 28 return total_probability_; 29 } 30 31 bool is_expired() const { return is_expired_; } 32 33 static bool ValidateAndAppendStudy( 34 const Study* study, 35 bool is_expired, 36 std::vector<ProcessedStudy>* processed_studies); 37 38 private: 39 // Corresponding Study object. Weak reference. 40 const Study* study_; 41 42 // Computed total group probability for the study. 43 base::FieldTrial::Probability total_probability_; 44 45 // Whether the study is expired. 46 bool is_expired_; 47 }; 48 49 } // namespace chrome_variations 50 51 #endif // COMPONENTS_VARIATIONS_PROCESSED_STUDY_H_ 52