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

Unified Diff: components/flags_ui/flags_state.cc

Issue 2345033002: Log base::Features in Launch.FlagsAtStartup (Closed)
Patch Set: Clean up test and localize ReportAboutFlagsHistogram{Switches, Features} Created 4 years, 3 months 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
Index: components/flags_ui/flags_state.cc
diff --git a/components/flags_ui/flags_state.cc b/components/flags_ui/flags_state.cc
index f7d0eb8233b34927472867ef4525f4c9c54412a5..7f039633e7a8a258dee0fc149f8e6838c52d76ef 100644
--- a/components/flags_ui/flags_state.cc
+++ b/components/flags_ui/flags_state.cc
@@ -286,6 +286,29 @@ std::set<std::string> FlagsState::GetSwitchesFromFlags(
return switches;
}
+std::set<std::string> FlagsState::GetFeaturesFromFlags(
+ FlagsStorage* flags_storage) {
+ std::set<std::string> enabled_entries;
+ std::map<std::string, SwitchEntry> name_to_switch_map;
+ GenerateFlagsToSwitchesMapping(flags_storage, &enabled_entries,
+ &name_to_switch_map);
+
+ std::set<std::string> features;
+ for (const std::string& entry_name : enabled_entries) {
+ const auto& entry_it = name_to_switch_map.find(entry_name);
+ DCHECK(entry_it != name_to_switch_map.end());
+
+ const SwitchEntry& entry = entry_it->second;
+ if (!entry.feature_name.empty()) {
+ if (entry.feature_state)
+ features.insert(entry.feature_name + ":enabled");
+ else
+ features.insert(entry.feature_name + ":disabled");
+ }
+ }
+ return features;
+}
+
bool FlagsState::IsRestartNeededToCommitChanges() {
return needs_restart_;
}

Powered by Google App Engine
This is Rietveld 408576698