| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/mus/container_ids.h" | 5 #include "ash/mus/container_ids.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/public/interfaces/container.mojom.h" | 8 #include "ash/public/interfaces/container.mojom.h" |
| 9 | 9 |
| 10 using ash::mojom::Container; | 10 using ash::mojom::Container; |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 namespace mus { | 13 namespace mus { |
| 14 | 14 |
| 15 const Container kActivationContainers[] = { | 15 int MashContainerToAshShellWindowId(Container container) { |
| 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 kShellWindowId_UnparentedControlContainer: | |
| 34 case kShellWindowId_LockScreenContainer: | |
| 35 case kShellWindowId_LockSystemModalContainer: | |
| 36 // We should never be asked to parent windows of these types. | |
| 37 NOTREACHED(); | |
| 38 return Container::USER_PRIVATE; | |
| 39 | |
| 40 case kShellWindowId_DefaultContainer: | |
| 41 return Container::USER_PRIVATE_WINDOWS; | |
| 42 | |
| 43 case kShellWindowId_AlwaysOnTopContainer: | |
| 44 return Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS; | |
| 45 | |
| 46 case kShellWindowId_DockedContainer: | |
| 47 return Container::USER_PRIVATE_DOCKED_WINDOWS; | |
| 48 | |
| 49 case kShellWindowId_ShelfContainer: | |
| 50 return Container::USER_PRIVATE_SHELF; | |
| 51 | |
| 52 case kShellWindowId_PanelContainer: | |
| 53 return Container::USER_PRIVATE_PANELS; | |
| 54 | |
| 55 case kShellWindowId_AppListContainer: | |
| 56 return Container::USER_PRIVATE_APP_LIST; | |
| 57 | |
| 58 case kShellWindowId_SystemModalContainer: | |
| 59 return Container::USER_PRIVATE_SYSTEM_MODAL; | |
| 60 | |
| 61 case kShellWindowId_MenuContainer: | |
| 62 return Container::MENUS; | |
| 63 | |
| 64 case 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) { | 16 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: | 17 case Container::USER_BACKGROUND: |
| 85 return kUnknownAshId; | 18 return kShellWindowId_DesktopBackgroundContainer; |
| 86 | |
| 87 case Container::USER_PRIVATE: | |
| 88 return kUnknownAshId; | |
| 89 | |
| 90 case Container::USER_PRIVATE_WINDOWS: | |
| 91 return kShellWindowId_DefaultContainer; | |
| 92 | |
| 93 case Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS: | |
| 94 return kShellWindowId_AlwaysOnTopContainer; | |
| 95 | |
| 96 case Container::USER_PRIVATE_DOCKED_WINDOWS: | |
| 97 return kShellWindowId_DockedContainer; | |
| 98 | |
| 99 case Container::USER_PRIVATE_PRESENTATION_WINDOWS: | |
| 100 return kUnknownAshId; | |
| 101 | 19 |
| 102 case Container::USER_PRIVATE_SHELF: | 20 case Container::USER_PRIVATE_SHELF: |
| 103 return kShellWindowId_ShelfContainer; | 21 return kShellWindowId_ShelfContainer; |
| 104 | 22 |
| 105 case Container::USER_PRIVATE_PANELS: | |
| 106 return kShellWindowId_PanelContainer; | |
| 107 | |
| 108 case Container::USER_PRIVATE_APP_LIST: | |
| 109 return kShellWindowId_AppListContainer; | |
| 110 | |
| 111 case Container::USER_PRIVATE_SYSTEM_MODAL: | |
| 112 return kShellWindowId_SystemModalContainer; | |
| 113 | |
| 114 case Container::LOGIN: | |
| 115 return kUnknownAshId; | |
| 116 | |
| 117 case Container::LOGIN_WINDOWS: | 23 case Container::LOGIN_WINDOWS: |
| 118 return kUnknownAshId; | 24 return kShellWindowId_LockScreenContainer; |
| 119 | |
| 120 case Container::LOGIN_APP: | |
| 121 return kUnknownAshId; | |
| 122 | |
| 123 case Container::LOGIN_SHELF: | |
| 124 return kUnknownAshId; | |
| 125 | 25 |
| 126 case Container::STATUS: | 26 case Container::STATUS: |
| 127 return kUnknownAshId; | 27 return kShellWindowId_StatusContainer; |
| 128 | 28 |
| 129 case Container::BUBBLES: | 29 case Container::BUBBLES: |
| 130 return kUnknownAshId; | 30 // TODO(sky): this mapping isn't right, but BUBBLES should go away once |
| 131 | 31 // http://crbug.com/616859 lands. |
| 132 case Container::SYSTEM_MODAL_WINDOWS: | 32 return kShellWindowId_SettingBubbleContainer; |
| 133 return kUnknownAshId; | |
| 134 | |
| 135 case Container::KEYBOARD: | |
| 136 return kUnknownAshId; | |
| 137 | 33 |
| 138 case Container::MENUS: | 34 case Container::MENUS: |
| 139 return kShellWindowId_MenuContainer; | 35 return kShellWindowId_MenuContainer; |
| 140 | 36 |
| 141 case Container::DRAG_AND_TOOLTIPS: | 37 case Container::DRAG_AND_TOOLTIPS: |
| 142 return kShellWindowId_DragImageAndTooltipContainer; | 38 return kShellWindowId_DragImageAndTooltipContainer; |
| 143 | |
| 144 case Container::COUNT: | |
| 145 return kUnknownAshId; | |
| 146 } | 39 } |
| 147 return kUnknownAshId; | 40 return kShellWindowId_Invalid; |
| 148 } | 41 } |
| 149 | 42 |
| 150 } // namespace mus | 43 } // namespace mus |
| 151 } // namespace ash | 44 } // namespace ash |
| OLD | NEW |