1 // Copyright (c) 2012 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 ASH_PUBLIC_CPP_SHELL_WINDOW_IDS_H_
6 #define ASH_PUBLIC_CPP_SHELL_WINDOW_IDS_H_
7 
8 #include <array>
9 #include <vector>
10 
11 #include "ash/public/cpp/ash_public_export.h"
12 
13 // Declarations of ids of special shell windows.
14 
15 namespace ash {
16 
17 enum ShellWindowId {
18   // Used to indicate no shell window id.
19   kShellWindowId_Invalid = -1,
20 
21   // This container is used for animations which take a screenshot of the
22   // contents, place them on top of the root and animate the screenshot layer.
23   // We can't take a screenshot of the root itself, otherwise subsequent
24   // screenshots will screenshot previous screenshots.
25   kShellWindowId_ScreenAnimationContainer = 0,
26 
27   // The magnified container which contains everything that would be magnified
28   // when docked magnifier is enabled.
29   kShellWindowId_MagnifiedContainer,
30 
31   // The container for the Docked Magnifier viewport widget and the separator.
32   kShellWindowId_DockedMagnifierContainer,
33 
34   // A higher-level container that holds all of the containers stacked below
35   // kShellWindowId_LockScreenContainer.  Only used by PowerButtonController for
36   // animating lower-level containers.
37   kShellWindowId_NonLockScreenContainersContainer,
38 
39   // A higher-level container that holds containers that hold lock-screen
40   // windows.  Only used by PowerButtonController for animating lower-level
41   // containers.
42   kShellWindowId_LockScreenContainersContainer,
43 
44   // A higher-level container that holds containers that hold
45   // lock-screen-related windows (which are displayed regardless of the screen
46   // lock state, effectively containers stacked above
47   // kShellWindowId_LockSystemModalContainer). Used by the shelf, status area,
48   // virtual keyboard, settings bubble, menus, etc.  Also used by the
49   // PowerButtonController for animating lower-level containers.
50   kShellWindowId_LockScreenRelatedContainersContainer,
51 
52   // A container used for windows of WINDOW_TYPE_CONTROL that have no parent.
53   // This container is not visible.
54   kShellWindowId_UnparentedControlContainer,
55 
56   // The wallpaper (desktop background) window.
57   kShellWindowId_WallpaperContainer,
58 
59   // The containers for standard top-level windows per active desks.
60   // * Notes:
61   //   - There are no direct mapping between `kShellWindowId_DeskContainerA` and
62   //     Desk 1, or `kShellWindowId_DeskContainerB` and Desk 2. The containers
63   //     are reused as desks are created and deleted.
64   //   - **DO NOT** use these container IDs directly, instead use
65   //     `desks_util::GetActiveDeskContainerId()`.
66   // TODO(afakhry): Rename this container, unexpose it, and add the rest of the
67   // containers.
68   kShellWindowId_DefaultContainerDeprecated,
69   kShellWindowId_DeskContainerB,
70   kShellWindowId_DeskContainerC,
71   kShellWindowId_DeskContainerD,
72 
73   // The container for top-level windows with the 'always-on-top' flag set.
74   kShellWindowId_AlwaysOnTopContainer,
75 
76   // The container for the app list.
77   kShellWindowId_AppListContainer,
78 
79   // The container for the home screen, e.g. the app list in tablet mode.
80   kShellWindowId_HomeScreenContainer,
81 
82   // The container for the PIP window.
83   kShellWindowId_PipContainer,
84 
85   // The parent container that holds the ARC IME container and windows created
86   // by ARC IME other than the virtual keyboard window.
87   // This container window is to ensure that the ARC IME window is stacked above
88   // top-level windows and the app list window but below the shelf.
89   kShellWindowId_ArcImeWindowParentContainer,
90 
91   // The container for Virtual Keyboard from ARC IMEs.
92   kShellWindowId_ArcVirtualKeyboardContainer,
93 
94   // The container for UI on the shelf (shelf, navigation, hotseat,
95   // status area).
96   kShellWindowId_ShelfContainer,
97 
98   // The container for bubbles which float over the shelf.
99   kShellWindowId_ShelfBubbleContainer,
100 
101   // The container for user-specific modal windows.
102   kShellWindowId_SystemModalContainer,
103 
104   // The container for the lock screen wallpaper (lock screen background).
105   kShellWindowId_LockScreenWallpaperContainer,
106 
107   // The container for the lock screen.
108   kShellWindowId_LockScreenContainer,
109 
110   // The container for windows that handle lock tray actions (e.g. new note
111   // action). The action handler container's children should be visible on lock
112   // screen, but only when an action is being handled - i.e. action handling
113   // state is either:
114   //  *  active - the container is stacked above LockScreenContainer
115   //  *  background - the container is stacked below LockScreenContainer
116   kShellWindowId_LockActionHandlerContainer,
117 
118   // The container for the lock screen modal windows.
119   kShellWindowId_LockSystemModalContainer,
120 
121   // A parent container that holds the virtual keyboard container and ime
122   // windows if any. This is to ensure that the virtual keyboard or ime window
123   // is stacked above most containers but below the mouse cursor and the power
124   // off animation.
125   kShellWindowId_ImeWindowParentContainer,
126 
127   // The virtual keyboard container.
128   kShellWindowId_VirtualKeyboardContainer,
129 
130   // The container for menus.
131   kShellWindowId_MenuContainer,
132 
133   // The container for drag/drop images and tooltips.
134   kShellWindowId_DragImageAndTooltipContainer,
135 
136   // The container for the fullscreen power button menu.
137   kShellWindowId_PowerMenuContainer,
138 
139   // The container for bubbles briefly overlaid onscreen to show settings
140   // changes (volume, brightness, input method bubbles, etc.).
141   kShellWindowId_SettingBubbleContainer,
142 
143   // Contains special accessibility windows that can inset the display work area
144   // (e.g. the ChromeVox spoken feedback window).
145   // TODO(jamescook): Consolidate this with DockedMagnifierContainer.
146   kShellWindowId_AccessibilityPanelContainer,
147 
148   // The container for accessibility bubbles that overlay the work area and any
149   // other menus and bubbles, but appear under the Autoclick mouse UX in
150   // kShellWindowId_OverlayContainer. Both Autoclick and Switch Access have
151   // bubbles that appear in this layer. These features need to work with dialogs
152   // and menus, so they must be shown above
153   // kShellWindowId_SettingBubbleContainer to allow the user to access these
154   // settings. However, these bubbles may have buttons with tooltips which must
155   // be shown above the bubbles, so it must be under
156   // kShellWindowId_DragImageAndTooltipContainer.
157   // TODO(crbug/1076973): Investigate merging this container with
158   // AccessibilityPanelContainer.
159   kShellWindowId_AccessibilityBubbleContainer,
160 
161   // The container for special components overlaid onscreen, such as the
162   // region selector for partial screenshots.
163   kShellWindowId_OverlayContainer,
164 
165   // The container for ambient mode screen saver.
166   kShellWindowId_AmbientModeContainer,
167 
168   // The container for mouse cursor.
169   kShellWindowId_MouseCursorContainer,
170 
171   // The container for an image that should stay on top of everything except for
172   // the power off animation.
173   kShellWindowId_AlwaysOnTopWallpaperContainer,
174 
175   // The topmost container, used for power off animation.
176   kShellWindowId_PowerButtonAnimationContainer,
177 
178   kShellWindowId_MinContainer = kShellWindowId_ScreenAnimationContainer,
179   kShellWindowId_MaxContainer = kShellWindowId_PowerButtonAnimationContainer,
180 };
181 
182 // Special shell windows that are not containers.
183 enum NonContainerWindowId {
184   // The window created by PhantomWindowController or DragWindowController.
185   kShellWindowId_PhantomWindow = kShellWindowId_MaxContainer + 1,
186 
187   // The window that shows the Virtual Desks bar at the top of overview. There's
188   // only one such window on each display when overview mode is active.
189   kShellWindowId_DesksBarWindow,
190 
191   // The window that shows a blue highlight on the edges of a selected display.
192   // Only one window exists whenever the display settings page is open with
193   // multiple displays connected.
194   kShellWindowId_DisplayIdentificationHighlightWindow,
195 };
196 
197 // A list of system modal container IDs. The order of the list is important that
198 // the more restrictive container appears before the less restrictive ones.
199 constexpr int kSystemModalContainerIds[] = {
200     kShellWindowId_LockSystemModalContainer,
201     kShellWindowId_SystemModalContainer};
202 
203 // Returns the list of container ids of containers which may contain windows
204 // that need to be activated. this list is ordered by the activation order; that
205 // is, windows in containers appearing earlier in the list are activated before
206 // windows in containers appearing later in the list. This list is used by
207 // AshFocusRules to determine which container to start the search from when
208 // looking for the next activatable window.
209 ASH_PUBLIC_EXPORT const std::array<int, 18>& GetActivatableShellWindowIds();
210 
211 // Returns true if |id| is in |kActivatableContainersIds|.
212 ASH_PUBLIC_EXPORT bool IsActivatableShellWindowId(int id);
213 
214 }  // namespace ash
215 
216 #endif  // ASH_PUBLIC_CPP_SHELL_WINDOW_IDS_H_
217