Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: chrome/browser/about_flags.cc

Issue 8898039: Show all experiments, even those that are unavailable on the current platform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Avoid implicit cast from unsigned to bool Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/flags.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/about_flags.cc
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 543a83007afbb6ab9edb377abe51fd274787f4ca..d1acec8430ea7cb48bbbbf2c97f5527005b26a3c 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -42,6 +42,23 @@ namespace {
const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS;
+// Adds a |StringValue| to |list| for each platform where |bitmask| indicates
+// whether the experiment is available on that platform.
+void AddOsStrings(unsigned bitmask, ListValue* list) {
+ struct {
+ unsigned bit;
+ const char* const name;
+ } kBitsToOs[] = {
+ {kOsMac, "Mac"},
+ {kOsWin, "Windows"},
+ {kOsLinux, "Linux"},
+ {kOsCrOS, "Chrome OS"},
+ };
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i)
+ if (bitmask & kBitsToOs[i].bit)
+ list->Append(new StringValue(kBitsToOs[i].name));
+}
+
// Names for former Chrome OS Labs experiments, shared with prefs migration
// code.
const char kMediaPlayerExperimentName[] = "media-player";
@@ -631,8 +648,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 +656,12 @@ ListValue* GetFlagsExperimentsData(PrefService* prefs) {
data->SetString("description",
l10n_util::GetStringUTF16(
experiment.visible_description_id));
+ bool supported = !!(experiment.supported_platforms & current_platform);
Tyler Breisacher (Chromium) 2011/12/19 23:23:26 This should fix the compile error on Windows: warn
+ 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:
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/flags.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698