tab_group_info.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2022 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_APP_RESTORE_TAB_GROUP_INFO_H_
  5. #define COMPONENTS_APP_RESTORE_TAB_GROUP_INFO_H_
  6. #include "base/component_export.h"
  7. #include "components/tab_groups/tab_group_visual_data.h"
  8. #include "ui/gfx/range/range.h"
  9. namespace app_restore {
  10. // String kConstants used by TabGroupColorToString.
  11. constexpr char kTabGroupColorUnknown[] = "UNKNONW";
  12. constexpr char kTabGroupColorGrey[] = "GREY";
  13. constexpr char kTabGroupColorBlue[] = "BLUE";
  14. constexpr char kTabGroupColorRed[] = "RED";
  15. constexpr char kTabGroupColorYellow[] = "YELLOW";
  16. constexpr char kTabGroupColorGreen[] = "GREEN";
  17. constexpr char kTabGroupColorPink[] = "PINK";
  18. constexpr char kTabGroupColorPurple[] = "PURPLE";
  19. constexpr char kTabGroupColorCyan[] = "CYAN";
  20. constexpr char kTabGroupColorOrange[] = "ORANGE";
  21. // Used in ToString as well as in Conversion Logic for
  22. // components/desks_storage/core/desk_template_conversion.cc
  23. std::string COMPONENT_EXPORT(APP_RESTORE)
  24. TabGroupColorToString(tab_groups::TabGroupColorId color);
  25. // Tab group info is a structure representing a tab group that
  26. // is associated with a specific browser window. This struct lives
  27. // in a list of instances of its kind located under the tab_group_infos
  28. // field of an AppRestoreData struct. This structure is used by saved desks
  29. // to store data relating to tab groups and is not directly used by full
  30. // restore.
  31. struct COMPONENT_EXPORT(APP_RESTORE) TabGroupInfo {
  32. TabGroupInfo(const gfx::Range& tab_range,
  33. const tab_groups::TabGroupVisualData& visual_data);
  34. TabGroupInfo(const TabGroupInfo&);
  35. TabGroupInfo& operator=(const TabGroupInfo& other);
  36. // Move constructor used for vector allocation.
  37. TabGroupInfo(TabGroupInfo&& other);
  38. ~TabGroupInfo();
  39. // Checks whether or not two TabGroupInfos are semantically equivalent.
  40. // Used in testing.
  41. bool operator==(const TabGroupInfo& other) const;
  42. // Produces a string representation of this tab group used in debugging.
  43. std::string ToString() const;
  44. // Range of tabs this group is associated with.
  45. gfx::Range tab_range;
  46. // Human readable data associated with this tab group.
  47. tab_groups::TabGroupVisualData visual_data;
  48. };
  49. } // namespace app_restore
  50. #endif // COMPONENTS_APP_RESTORE_TAB_GROUP_INFO_H_