OLD | NEW |
| (Empty) |
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 | |
5 #include "mash/wm/container_ids.h" | |
6 | |
7 #include "ash/common/shell_window_ids.h" | |
8 #include "ash/public/interfaces/container.mojom.h" | |
9 | |
10 using ash::mojom::Container; | |
11 | |
12 namespace mash { | |
13 namespace wm { | |
14 | |
15 const Container kActivationContainers[] = { | |
16 // TODO(sky): figure out right set of containers. I suspect this should be | |
17 // all non containers. | |
18 Container::USER_PRIVATE_WINDOWS, | |
19 Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS, | |
20 Container::USER_PRIVATE_DOCKED_WINDOWS, | |
21 Container::USER_PRIVATE_PRESENTATION_WINDOWS, | |
22 Container::USER_PRIVATE_PANELS, Container::USER_PRIVATE_APP_LIST, | |
23 Container::USER_PRIVATE_SYSTEM_MODAL, Container::LOGIN, | |
24 // Bubble windows must be allowed to activate because some of them rely on | |
25 // deactivation to close. | |
26 Container::BUBBLES, | |
27 }; | |
28 | |
29 const size_t kNumActivationContainers = arraysize(kActivationContainers); | |
30 | |
31 Container AshContainerToMashContainer(int ash_id) { | |
32 switch (ash_id) { | |
33 case ash::kShellWindowId_UnparentedControlContainer: | |
34 case ash::kShellWindowId_LockScreenContainer: | |
35 case ash::kShellWindowId_LockSystemModalContainer: | |
36 // We should never be asked to parent windows of these types. | |
37 NOTREACHED(); | |
38 return Container::USER_PRIVATE; | |
39 | |
40 case ash::kShellWindowId_DefaultContainer: | |
41 return Container::USER_PRIVATE_WINDOWS; | |
42 | |
43 case ash::kShellWindowId_AlwaysOnTopContainer: | |
44 return Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS; | |
45 | |
46 case ash::kShellWindowId_DockedContainer: | |
47 return Container::USER_PRIVATE_DOCKED_WINDOWS; | |
48 | |
49 case ash::kShellWindowId_ShelfContainer: | |
50 return Container::USER_PRIVATE_SHELF; | |
51 | |
52 case ash::kShellWindowId_PanelContainer: | |
53 return Container::USER_PRIVATE_PANELS; | |
54 | |
55 case ash::kShellWindowId_AppListContainer: | |
56 return Container::USER_PRIVATE_APP_LIST; | |
57 | |
58 case ash::kShellWindowId_SystemModalContainer: | |
59 return Container::USER_PRIVATE_SYSTEM_MODAL; | |
60 | |
61 case ash::kShellWindowId_MenuContainer: | |
62 return Container::MENUS; | |
63 | |
64 case ash::kShellWindowId_DragImageAndTooltipContainer: | |
65 return Container::DRAG_AND_TOOLTIPS; | |
66 | |
67 default: | |
68 NOTREACHED(); | |
69 } | |
70 return Container::USER_PRIVATE_WINDOWS; | |
71 } | |
72 | |
73 int MashContainerToAshContainer(Container container) { | |
74 switch (container) { | |
75 case Container::ROOT: | |
76 return kUnknownAshId; | |
77 | |
78 case Container::ALL_USER_BACKGROUND: | |
79 return kUnknownAshId; | |
80 | |
81 case Container::USER: | |
82 return kUnknownAshId; | |
83 | |
84 case Container::USER_BACKGROUND: | |
85 return kUnknownAshId; | |
86 | |
87 case Container::USER_PRIVATE: | |
88 return kUnknownAshId; | |
89 | |
90 case Container::USER_PRIVATE_WINDOWS: | |
91 return ash::kShellWindowId_DefaultContainer; | |
92 | |
93 case Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS: | |
94 return ash::kShellWindowId_AlwaysOnTopContainer; | |
95 | |
96 case Container::USER_PRIVATE_DOCKED_WINDOWS: | |
97 return ash::kShellWindowId_DockedContainer; | |
98 | |
99 case Container::USER_PRIVATE_PRESENTATION_WINDOWS: | |
100 return kUnknownAshId; | |
101 | |
102 case Container::USER_PRIVATE_SHELF: | |
103 return ash::kShellWindowId_ShelfContainer; | |
104 | |
105 case Container::USER_PRIVATE_PANELS: | |
106 return ash::kShellWindowId_PanelContainer; | |
107 | |
108 case Container::USER_PRIVATE_APP_LIST: | |
109 return ash::kShellWindowId_AppListContainer; | |
110 | |
111 case Container::USER_PRIVATE_SYSTEM_MODAL: | |
112 return ash::kShellWindowId_SystemModalContainer; | |
113 | |
114 case Container::LOGIN: | |
115 return kUnknownAshId; | |
116 | |
117 case Container::LOGIN_WINDOWS: | |
118 return kUnknownAshId; | |
119 | |
120 case Container::LOGIN_APP: | |
121 return kUnknownAshId; | |
122 | |
123 case Container::LOGIN_SHELF: | |
124 return kUnknownAshId; | |
125 | |
126 case Container::STATUS: | |
127 return kUnknownAshId; | |
128 | |
129 case Container::BUBBLES: | |
130 return kUnknownAshId; | |
131 | |
132 case Container::SYSTEM_MODAL_WINDOWS: | |
133 return kUnknownAshId; | |
134 | |
135 case Container::KEYBOARD: | |
136 return kUnknownAshId; | |
137 | |
138 case Container::MENUS: | |
139 return ash::kShellWindowId_MenuContainer; | |
140 | |
141 case Container::DRAG_AND_TOOLTIPS: | |
142 return ash::kShellWindowId_DragImageAndTooltipContainer; | |
143 | |
144 case Container::COUNT: | |
145 return kUnknownAshId; | |
146 } | |
147 return kUnknownAshId; | |
148 } | |
149 | |
150 } // namespace wm | |
151 } // namespace mash | |
OLD | NEW |