Chromium Code Reviews| Index: mash/wm/container_ids.cc |
| diff --git a/mash/wm/container_ids.cc b/mash/wm/container_ids.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..abdae0b1748e1f0ac994fb80e6fd85f81a34f68a |
| --- /dev/null |
| +++ b/mash/wm/container_ids.cc |
| @@ -0,0 +1,140 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "mash/wm/container_ids.h" |
| + |
| +#include "ash/wm/common/wm_shell_window_ids.h" |
| + |
| +namespace mash { |
| +namespace wm { |
| + |
| +const mojom::Container kActivationContainers[] = { |
| + mojom::Container::USER_PRIVATE_CONTAINER, |
| + // Bubble windows must be allowed to activate because some of them rely on |
| + // deactivation to close. |
| + mojom::Container::BUBBLES, |
| +}; |
|
James Cook
2016/05/13 17:14:44
Do login windows need to be able to activate?
sky
2016/05/13 19:14:06
I think this list is woefully wrong. I added a TOD
|
| + |
| +const size_t kNumActivationContainers = arraysize(kActivationContainers); |
| + |
| +mojom::Container AshContainerToMashContainer(int ash_id) { |
| + switch (ash_id) { |
| + case ash::kShellWindowId_UnparentedControlContainer: |
| + case ash::kShellWindowId_LockScreenContainer: |
| + case ash::kShellWindowId_LockSystemModalContainer: |
| + // We should never be asked to parent windows of these types. |
| + NOTREACHED(); |
| + return mojom::Container::USER_PRIVATE_CONTAINER; |
| + |
| + case ash::kShellWindowId_DefaultContainer: |
| + return mojom::Container::USER_PRIVATE_WINDOWS; |
| + |
| + case ash::kShellWindowId_AlwaysOnTopContainer: |
| + return mojom::Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS; |
| + |
| + case ash::kShellWindowId_DockedContainer: |
| + return mojom::Container::USER_PRIVATE_DOCKED_WINDOWS; |
| + |
| + case ash::kShellWindowId_ShelfContainer: |
| + return mojom::Container::USER_PRIVATE_SHELF; |
| + |
| + case ash::kShellWindowId_PanelContainer: |
| + return mojom::Container::USER_PRIVATE_PANELS; |
| + |
| + case ash::kShellWindowId_AppListContainer: |
| + return mojom::Container::USER_PRIVATE_APP_LIST; |
| + |
| + case ash::kShellWindowId_SystemModalContainer: |
| + return mojom::Container::USER_PRIVATE_SYSTEM_MODAL; |
| + |
| + case ash::kShellWindowId_MenuContainer: |
| + return mojom::Container::MENUS; |
| + |
| + case ash::kShellWindowId_DragImageAndTooltipContainer: |
| + return mojom::Container::DRAG_AND_TOOLTIPS; |
| + |
| + default: |
| + NOTREACHED(); |
| + } |
| + return mojom::Container::ALL_USER_BACKGROUND; |
|
James Cook
2016/05/13 17:14:44
If there's a bug where a window defaults to this,
sky
2016/05/13 19:14:06
Made it return USER_PRIVATE_WINDOWS.
|
| +} |
| + |
| +int MashContainerToAshContainer(mojom::Container container) { |
| + switch (container) { |
| + case mojom::Container::ROOT_CONTAINER: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::ALL_USER_BACKGROUND: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::USER_CONTAINER: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::USER_BACKGROUND: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::USER_PRIVATE_CONTAINER: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::USER_PRIVATE_WINDOWS: |
| + return ash::kShellWindowId_DefaultContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_ALWAYS_ON_TOP_WINDOWS: |
| + return ash::kShellWindowId_AlwaysOnTopContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_DOCKED_WINDOWS: |
| + return ash::kShellWindowId_DockedContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_PRESENTATION_WINDOWS: |
| + |
|
James Cook
2016/05/13 17:14:44
Something should go here.
sky
2016/05/13 19:14:06
Done.
|
| + case mojom::Container::USER_PRIVATE_SHELF: |
| + return ash::kShellWindowId_ShelfContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_PANELS: |
| + return ash::kShellWindowId_PanelContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_APP_LIST: |
| + return ash::kShellWindowId_AppListContainer; |
| + |
| + case mojom::Container::USER_PRIVATE_SYSTEM_MODAL: |
| + return ash::kShellWindowId_SystemModalContainer; |
| + |
| + case mojom::Container::LOGIN_CONTAINER: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::LOGIN_WINDOWS: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::LOGIN_APP: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::LOGIN_SHELF: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::STATUS: |
| + return kUnknownAshId; |
|
James Cook
2016/05/13 17:14:44
Do you want to move more IDs into ash/wm/common/wm
sky
2016/05/13 19:14:06
At this point wm_shell_window_ids is just the ids
|
| + |
| + case mojom::Container::BUBBLES: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::SYSTEM_MODAL_WINDOWS: |
| + return kUnknownAshId; |
|
James Cook
2016/05/13 17:14:44
kShellWindowId_SystemModalContainer? (It's already
sky
2016/05/13 19:14:06
SYSTEM_MODAL_WINDOWS is intended for non user spec
|
| + |
| + case mojom::Container::KEYBOARD: |
| + return kUnknownAshId; |
| + |
| + case mojom::Container::MENUS: |
| + return ash::kShellWindowId_MenuContainer; |
| + |
| + case mojom::Container::DRAG_AND_TOOLTIPS: |
| + return ash::kShellWindowId_DragImageAndTooltipContainer; |
| + |
| + case mojom::Container::COUNT: |
| + return kUnknownAshId; |
| + } |
| + return kUnknownAshId; |
| +} |
| + |
| +} // namespace wm |
| +} // namespace mash |