OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/flags_ui/flags_state.h" | 5 #include "components/flags_ui/flags_state.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 std::map<std::string, SwitchEntry> name_to_switch_map; | 273 std::map<std::string, SwitchEntry> name_to_switch_map; |
274 GenerateFlagsToSwitchesMapping(flags_storage, &enabled_entries, | 274 GenerateFlagsToSwitchesMapping(flags_storage, &enabled_entries, |
275 &name_to_switch_map); | 275 &name_to_switch_map); |
276 | 276 |
277 std::set<std::string> switches; | 277 std::set<std::string> switches; |
278 for (const std::string& entry_name : enabled_entries) { | 278 for (const std::string& entry_name : enabled_entries) { |
279 const auto& entry_it = name_to_switch_map.find(entry_name); | 279 const auto& entry_it = name_to_switch_map.find(entry_name); |
280 DCHECK(entry_it != name_to_switch_map.end()); | 280 DCHECK(entry_it != name_to_switch_map.end()); |
281 | 281 |
282 const SwitchEntry& entry = entry_it->second; | 282 const SwitchEntry& entry = entry_it->second; |
283 if (!entry.switch_name.empty()) | 283 if (!entry.switch_name.empty()) { |
Alexei Svitkine (slow)
2016/09/15 19:59:18
Nit: No {}'s if the body is a single line. Please
lawrencewu
2016/09/16 15:34:56
Done.
| |
284 switches.insert("--" + entry.switch_name); | 284 switches.insert(entry.switch_name); |
285 } | |
286 | |
287 if (!entry.feature_name.empty()) { | |
288 if (entry.feature_state) { | |
289 switches.insert(entry.feature_name + ":enabled"); | |
290 } else { | |
291 switches.insert(entry.feature_name + ":disabled"); | |
292 } | |
293 } | |
285 } | 294 } |
286 return switches; | 295 return switches; |
287 } | 296 } |
288 | 297 |
289 bool FlagsState::IsRestartNeededToCommitChanges() { | 298 bool FlagsState::IsRestartNeededToCommitChanges() { |
290 return needs_restart_; | 299 return needs_restart_; |
291 } | 300 } |
292 | 301 |
293 void FlagsState::SetFeatureEntryEnabled(FlagsStorage* flags_storage, | 302 void FlagsState::SetFeatureEntryEnabled(FlagsStorage* flags_storage, |
294 const std::string& internal_name, | 303 const std::string& internal_name, |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 state == FeatureEntry::FeatureState::ENABLED, | 758 state == FeatureEntry::FeatureState::ENABLED, |
750 name_to_switch_map); | 759 name_to_switch_map); |
751 } | 760 } |
752 } | 761 } |
753 break; | 762 break; |
754 } | 763 } |
755 } | 764 } |
756 } | 765 } |
757 | 766 |
758 } // namespace flags_ui | 767 } // namespace flags_ui |
OLD | NEW |