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..8087b01d4787fe8c15da74a13aad21b30745ba58 100644 |
| --- a/chrome/browser/about_flags.cc |
| +++ b/chrome/browser/about_flags.cc |
| @@ -42,6 +42,21 @@ namespace { |
| const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS; |
| +void AddOsStrings(unsigned bitmask, ListValue* list) { |
|
Nico
2011/12/17 03:34:27
Needs a very short comment above it describing wha
Tyler Breisacher (Chromium)
2011/12/17 04:20:34
Done. Although writing the comment is making me th
Nico
2011/12/17 05:14:20
It's fine either way I think
|
| + struct { |
| + unsigned bit; |
| + const char str[10]; |
|
Tyler Breisacher (Chromium)
2011/12/17 03:29:01
This "10" is super ugly. Without it, I get a compi
Nico
2011/12/17 03:34:27
const char* const str
Also, "name" is probably be
Tyler Breisacher (Chromium)
2011/12/17 04:20:34
Done.
|
| + } kBitsToOs[] = { |
| + {kOsMac, "Mac"}, |
| + {kOsWin, "Windows"}, |
| + {kOsLinux, "Linux"}, |
| + {kOsCrOS, "Chrome OS"}, |
| + }; |
| + for (unsigned i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i) |
|
Nico
2011/12/17 03:34:27
does "int" not work?
Tyler Breisacher (Chromium)
2011/12/17 04:20:34
chrome/browser/about_flags.cc:59: error: compariso
|
| + if (bitmask & kBitsToOs[i].bit) |
| + list->Append(new StringValue(kBitsToOs[i].str)); |
| +} |
| + |
| // Names for former Chrome OS Labs experiments, shared with prefs migration |
| // code. |
| const char kMediaPlayerExperimentName[] = "media-player"; |
| @@ -631,8 +646,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 +654,12 @@ 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(); |
| + AddOsStrings(experiment.supported_platforms, supported_platforms); |
| + data->Set("supported_platforms", supported_platforms); |
| switch (experiment.type) { |
| case Experiment::SINGLE_VALUE: |