shell_window_ids.cc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2016 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. #include "ash/public/cpp/shell_window_ids.h"
  5. #include <array>
  6. #include "base/containers/contains.h"
  7. namespace ash {
  8. namespace {
  9. // TODO(minch): Consolidate the below lists when we launch Bento.
  10. // List of IDs of the containers whose windows are actiavated *before* windows
  11. // in the desks containers.
  12. constexpr std::array<int, 11> kPreDesksActivatableContainersIds = {
  13. kShellWindowId_OverlayContainer,
  14. kShellWindowId_LockSystemModalContainer,
  15. kShellWindowId_AccessibilityBubbleContainer,
  16. kShellWindowId_AccessibilityPanelContainer,
  17. kShellWindowId_SettingBubbleContainer,
  18. kShellWindowId_PowerMenuContainer,
  19. kShellWindowId_LockActionHandlerContainer,
  20. kShellWindowId_LockScreenContainer,
  21. kShellWindowId_SystemModalContainer,
  22. kShellWindowId_AlwaysOnTopContainer,
  23. kShellWindowId_AppListContainer,
  24. };
  25. // List of IDs of the containers whose windows are actiavated *after* windows in
  26. // the desks containers.
  27. constexpr std::array<int, 5> kPostDesksActivatableContainersIds = {
  28. kShellWindowId_HomeScreenContainer,
  29. // Launcher and status are intentionally checked after other containers
  30. // even though these layers are higher. The user expects their windows
  31. // to be focused before these elements.
  32. kShellWindowId_FloatContainer,
  33. kShellWindowId_PipContainer,
  34. kShellWindowId_ShelfContainer,
  35. kShellWindowId_ShelfBubbleContainer,
  36. };
  37. } // namespace
  38. std::vector<int> GetActivatableShellWindowIds() {
  39. std::vector<int> ids(kPreDesksActivatableContainersIds.begin(),
  40. kPreDesksActivatableContainersIds.end());
  41. // Add the desks containers IDs. Can't use desks_util since we're in
  42. // ash/public here.
  43. ids.emplace_back(kShellWindowId_DefaultContainerDeprecated);
  44. ids.emplace_back(kShellWindowId_DeskContainerB);
  45. ids.emplace_back(kShellWindowId_DeskContainerC);
  46. ids.emplace_back(kShellWindowId_DeskContainerD);
  47. ids.emplace_back(kShellWindowId_DeskContainerE);
  48. ids.emplace_back(kShellWindowId_DeskContainerF);
  49. ids.emplace_back(kShellWindowId_DeskContainerG);
  50. ids.emplace_back(kShellWindowId_DeskContainerH);
  51. ids.insert(ids.end(), kPostDesksActivatableContainersIds.begin(),
  52. kPostDesksActivatableContainersIds.end());
  53. return ids;
  54. }
  55. bool IsActivatableShellWindowId(int id) {
  56. return base::Contains(GetActivatableShellWindowIds(), id);
  57. }
  58. } // namespace ash