Chromium Code Reviews| Index: chrome/browser/about_flags.cc |
| diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc |
| index 543a83007afbb6ab9edb377abe51fd274787f4ca..2750089f7271586b7c3ada53a16aa1529667e699 100644 |
| --- a/chrome/browser/about_flags.cc |
| +++ b/chrome/browser/about_flags.cc |
| @@ -42,6 +42,18 @@ namespace { |
| const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS; |
| +std::map<int, std::string> nameMap; |
|
Nico
2011/12/16 20:25:07
Global non-pods need both static initialization an
|
| + |
| +std::map<int, std::string> OSNames() { |
| + if (nameMap.empty()) { |
| + nameMap[kOsMac] = "Mac"; |
| + nameMap[kOsWin] = "Windows"; |
| + nameMap[kOsLinux] = "Linux"; |
| + nameMap[kOsCrOS] = "Chrome OS"; |
|
Nico
2011/12/16 20:25:07
std::map<int, ...> with less than many keys is alm
|
| + } |
| + return nameMap; |
| +} |
| + |
| // Names for former Chrome OS Labs experiments, shared with prefs migration |
| // code. |
| const char kMediaPlayerExperimentName[] = "media-player"; |
| @@ -631,8 +643,6 @@ ListValue* GetFlagsExperimentsData(PrefService* prefs) { |
| ListValue* experiments_data = new ListValue(); |
| for (size_t i = 0; i < num_experiments; ++i) { |
| const Experiment& experiment = experiments[i]; |
| - if (!(experiment.supported_platforms & current_platform)) |
| - continue; |
| DictionaryValue* data = new DictionaryValue(); |
| data->SetString("internal_name", experiment.internal_name); |
| @@ -641,6 +651,18 @@ ListValue* GetFlagsExperimentsData(PrefService* prefs) { |
| data->SetString("description", |
| l10n_util::GetStringUTF16( |
| experiment.visible_description_id)); |
| + bool supported = experiment.supported_platforms & current_platform; |
| + data->SetBoolean("supported", supported); |
| + |
| + ListValue* supported_platforms = new ListValue(); |
| + std::map<int, std::string> os_names = OSNames(); |
| + for (std::map<int, std::string>::const_iterator iter = os_names.begin(); |
| + iter != os_names.end(); ++iter) { |
| + if (experiment.supported_platforms & iter->first) { |
| + supported_platforms->Append(new StringValue(iter->second)); |
| + } |
| + } |
|
Nico
2011/12/16 20:25:07
supported_platforms->Append(new StringValue("Mac")
Tyler Breisacher (Chromium)
2011/12/16 21:18:11
Wouldn't that append all four platforms to every s
Nico
2011/12/16 21:38:04
Ah, right. Either write the function you have abov
|
| + data->Set("supported_platforms", supported_platforms); |
| switch (experiment.type) { |
| case Experiment::SINGLE_VALUE: |