OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/about_flags.h" | 5 #include "chrome/browser/about_flags.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // Takes a set of enabled lab experiments | 423 // Takes a set of enabled lab experiments |
424 void SetEnabledFlags( | 424 void SetEnabledFlags( |
425 PrefService* prefs, const std::set<std::string>& enabled_experiments) { | 425 PrefService* prefs, const std::set<std::string>& enabled_experiments) { |
426 ListPrefUpdate update(prefs, prefs::kEnabledLabsExperiments); | 426 ListPrefUpdate update(prefs, prefs::kEnabledLabsExperiments); |
427 ListValue* experiments_list = update.Get(); | 427 ListValue* experiments_list = update.Get(); |
428 | 428 |
429 experiments_list->Clear(); | 429 experiments_list->Clear(); |
430 for (std::set<std::string>::const_iterator it = enabled_experiments.begin(); | 430 for (std::set<std::string>::const_iterator it = enabled_experiments.begin(); |
431 it != enabled_experiments.end(); | 431 it != enabled_experiments.end(); |
432 ++it) { | 432 ++it) { |
433 experiments_list->Append(new StringValue(*it)); | 433 experiments_list->Append(base::StringValue::New(*it)); |
434 } | 434 } |
435 } | 435 } |
436 | 436 |
437 // Returns the name used in prefs for the choice at the specified index. | 437 // Returns the name used in prefs for the choice at the specified index. |
438 std::string NameForChoice(const Experiment& e, int index) { | 438 std::string NameForChoice(const Experiment& e, int index) { |
439 DCHECK_EQ(Experiment::MULTI_VALUE, e.type); | 439 DCHECK_EQ(Experiment::MULTI_VALUE, e.type); |
440 DCHECK_LT(index, e.num_choices); | 440 DCHECK_LT(index, e.num_choices); |
441 return std::string(e.internal_name) + about_flags::testing::kMultiSeparator + | 441 return std::string(e.internal_name) + about_flags::testing::kMultiSeparator + |
442 base::IntToString(index); | 442 base::IntToString(index); |
443 } | 443 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } | 804 } |
805 | 805 |
806 const Experiment* GetExperiments(size_t* count) { | 806 const Experiment* GetExperiments(size_t* count) { |
807 *count = num_experiments; | 807 *count = num_experiments; |
808 return experiments; | 808 return experiments; |
809 } | 809 } |
810 | 810 |
811 } // namespace testing | 811 } // namespace testing |
812 | 812 |
813 } // namespace about_flags | 813 } // namespace about_flags |
OLD | NEW |