| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/variations/variations_seed_processor.h" | 5 #include "components/variations/variations_seed_processor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 CreateTrialFromStudy(filtered_studies[i], override_callback); | 96 CreateTrialFromStudy(filtered_studies[i], override_callback); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void VariationsSeedProcessor::CreateTrialFromStudy( | 99 void VariationsSeedProcessor::CreateTrialFromStudy( |
| 100 const ProcessedStudy& processed_study, | 100 const ProcessedStudy& processed_study, |
| 101 const UIStringOverrideCallback& override_callback) { | 101 const UIStringOverrideCallback& override_callback) { |
| 102 const Study& study = *processed_study.study(); | 102 const Study& study = *processed_study.study(); |
| 103 | 103 |
| 104 // Check if any experiments need to be forced due to a command line | 104 // Check if any experiments need to be forced due to a command line |
| 105 // flag. Force the first experiment with an existing flag. | 105 // flag. Force the first experiment with an existing flag. |
| 106 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 106 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 107 for (int i = 0; i < study.experiment_size(); ++i) { | 107 for (int i = 0; i < study.experiment_size(); ++i) { |
| 108 const Study_Experiment& experiment = study.experiment(i); | 108 const Study_Experiment& experiment = study.experiment(i); |
| 109 if (experiment.has_forcing_flag() && | 109 if (experiment.has_forcing_flag() && |
| 110 command_line->HasSwitch(experiment.forcing_flag())) { | 110 command_line->HasSwitch(experiment.forcing_flag())) { |
| 111 scoped_refptr<base::FieldTrial> trial( | 111 scoped_refptr<base::FieldTrial> trial( |
| 112 base::FieldTrialList::CreateFieldTrial(study.name(), | 112 base::FieldTrialList::CreateFieldTrial(study.name(), |
| 113 experiment.name())); | 113 experiment.name())); |
| 114 // If |trial| is NULL, then there might already be a trial forced to a | 114 // If |trial| is NULL, then there might already be a trial forced to a |
| 115 // different group (e.g. via --force-fieldtrials). Break out of the loop, | 115 // different group (e.g. via --force-fieldtrials). Break out of the loop, |
| 116 // but don't return, so that variation ids and params for the selected | 116 // but don't return, so that variation ids and params for the selected |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // The field trial was defined from |study|, so the active experiment's name | 187 // The field trial was defined from |study|, so the active experiment's name |
| 188 // must be in the |study|. | 188 // must be in the |study|. |
| 189 DCHECK_NE(-1, experiment_index); | 189 DCHECK_NE(-1, experiment_index); |
| 190 | 190 |
| 191 ApplyUIStringOverrides(study.experiment(experiment_index), | 191 ApplyUIStringOverrides(study.experiment(experiment_index), |
| 192 override_callback); | 192 override_callback); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace variations | 196 } // namespace variations |
| OLD | NEW |