feature_entry_macros.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_
  5. #define COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_
  6. #include "build/chromeos_buildflags.h"
  7. // Macros to simplify specifying the type of FeatureEntry. Please refer to
  8. // the comments on FeatureEntry::Type in feature_entry.h, which explain the
  9. // different entry types and when they should be used.
  10. #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
  11. flags_ui::FeatureEntry::SINGLE_VALUE, { \
  12. .switches = { command_line_switch, switch_value, nullptr, nullptr } \
  13. }
  14. #define SINGLE_VALUE_TYPE(command_line_switch) \
  15. SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
  16. #define ORIGIN_LIST_VALUE_TYPE(command_line_switch, switch_value) \
  17. flags_ui::FeatureEntry::ORIGIN_LIST_VALUE, { \
  18. .switches = { command_line_switch, switch_value, nullptr, nullptr } \
  19. }
  20. #define SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
  21. flags_ui::FeatureEntry::SINGLE_DISABLE_VALUE, { \
  22. .switches = { command_line_switch, switch_value, nullptr, nullptr } \
  23. }
  24. #define SINGLE_DISABLE_VALUE_TYPE(command_line_switch) \
  25. SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
  26. #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
  27. disable_switch, disable_value) \
  28. flags_ui::FeatureEntry::ENABLE_DISABLE_VALUE, { \
  29. .switches = { enable_switch, enable_value, disable_switch, disable_value } \
  30. }
  31. #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \
  32. ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "")
  33. #define MULTI_VALUE_TYPE(choices_list) \
  34. flags_ui::FeatureEntry::MULTI_VALUE, { .choices = choices_list }
  35. #define FEATURE_VALUE_TYPE(feature_entry) \
  36. flags_ui::FeatureEntry::FEATURE_VALUE, { \
  37. .feature = { &feature_entry, {}, nullptr } \
  38. }
  39. #define FEATURE_WITH_PARAMS_VALUE_TYPE(feature_entry, feature_variations, \
  40. feature_trial) \
  41. flags_ui::FeatureEntry::FEATURE_WITH_PARAMS_VALUE, { \
  42. .feature = { &feature_entry, feature_variations, feature_trial } \
  43. }
  44. #if BUILDFLAG(IS_CHROMEOS_ASH)
  45. #define PLATFORM_FEATURE_NAME_TYPE(name) \
  46. flags_ui::FeatureEntry::PLATFORM_FEATURE_NAME_VALUE, { \
  47. .platform_feature_name = { name, {}, nullptr } \
  48. }
  49. #define PLATFORM_FEATURE_WITH_PARAMS_VALUE_TYPE(name, feature_variations, \
  50. feature_trial) \
  51. flags_ui::FeatureEntry::PLATFORM_FEATURE_NAME_WITH_PARAMS_VALUE, { \
  52. .platform_feature_name = { name, feature_variations, feature_trial } \
  53. }
  54. #endif // BUILDFLAG(IS_CHROMEOS_ASH)
  55. #endif // COMPONENTS_FLAGS_UI_FEATURE_ENTRY_MACROS_H_