sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_ |
| 6 | #define COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_ |
| 7 | |
avi | bc5337b | 2015-12-25 23:16:33 | [diff] [blame] | 8 | |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 9 | // Macros to simplify specifying the type of FeatureEntry. Please refer to |
| 10 | // the comments on FeatureEntry::Type in feature_entry.h, which explain the |
| 11 | // different entry types and when they should be used. |
Jeremy Roman | 3908697 | 2020-06-15 17:55:43 | [diff] [blame] | 12 | #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
| 13 | flags_ui::FeatureEntry::SINGLE_VALUE, { \ |
| 14 | .switches = { command_line_switch, switch_value, nullptr, nullptr } \ |
| 15 | } |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 16 | #define SINGLE_VALUE_TYPE(command_line_switch) \ |
| 17 | SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
Jeremy Roman | 3908697 | 2020-06-15 17:55:43 | [diff] [blame] | 18 | #define ORIGIN_LIST_VALUE_TYPE(command_line_switch, switch_value) \ |
| 19 | flags_ui::FeatureEntry::ORIGIN_LIST_VALUE, { \ |
| 20 | .switches = { command_line_switch, switch_value, nullptr, nullptr } \ |
| 21 | } |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 22 | #define SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
Jeremy Roman | 3908697 | 2020-06-15 17:55:43 | [diff] [blame] | 23 | flags_ui::FeatureEntry::SINGLE_DISABLE_VALUE, { \ |
| 24 | .switches = { command_line_switch, switch_value, nullptr, nullptr } \ |
| 25 | } |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 26 | #define SINGLE_DISABLE_VALUE_TYPE(command_line_switch) \ |
| 27 | SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
Jeremy Roman | 3908697 | 2020-06-15 17:55:43 | [diff] [blame] | 28 | #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ |
| 29 | disable_switch, disable_value) \ |
| 30 | flags_ui::FeatureEntry::ENABLE_DISABLE_VALUE, { \ |
| 31 | .switches = { enable_switch, enable_value, disable_switch, disable_value } \ |
| 32 | } |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 33 | #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \ |
| 34 | ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "") |
Jeremy Roman | 3908697 | 2020-06-15 17:55:43 | [diff] [blame] | 35 | #define MULTI_VALUE_TYPE(choices_list) \ |
| 36 | flags_ui::FeatureEntry::MULTI_VALUE, { .choices = choices_list } |
| 37 | #define FEATURE_VALUE_TYPE(feature_entry) \ |
| 38 | flags_ui::FeatureEntry::FEATURE_VALUE, { \ |
| 39 | .feature = { &feature_entry, {}, nullptr } \ |
| 40 | } |
| 41 | #define FEATURE_WITH_PARAMS_VALUE_TYPE(feature_entry, feature_variations, \ |
| 42 | feature_trial) \ |
| 43 | flags_ui::FeatureEntry::FEATURE_WITH_PARAMS_VALUE, { \ |
| 44 | .feature = { &feature_entry, feature_variations, feature_trial } \ |
| 45 | } |
sdefresne | 246c564 | 2015-11-16 21:47:29 | [diff] [blame] | 46 | |
| 47 | #endif // COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_ |