OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 "ash/common/wm/wm_types.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 namespace ash { | |
10 namespace wm { | |
11 | |
12 // This is to catch the change to WindowShowState. | |
13 static_assert(ui::SHOW_STATE_END == | |
14 static_cast<ui::WindowShowState>(WINDOW_STATE_TYPE_END), | |
15 "show enum mismatch"); | |
16 | |
17 WindowStateType ToWindowStateType(ui::WindowShowState state) { | |
18 return static_cast<WindowStateType>(state); | |
19 } | |
20 | |
21 ui::WindowShowState ToWindowShowState(WindowStateType type) { | |
22 switch (type) { | |
23 case WINDOW_STATE_TYPE_DEFAULT: | |
24 return ui::SHOW_STATE_DEFAULT; | |
25 case WINDOW_STATE_TYPE_NORMAL: | |
26 case WINDOW_STATE_TYPE_RIGHT_SNAPPED: | |
27 case WINDOW_STATE_TYPE_LEFT_SNAPPED: | |
28 case WINDOW_STATE_TYPE_AUTO_POSITIONED: | |
29 return ui::SHOW_STATE_NORMAL; | |
30 | |
31 // TODO(afakhry): Remove Docked Windows in M58. | |
32 case WINDOW_STATE_TYPE_DOCKED: | |
33 return ui::SHOW_STATE_DOCKED; | |
34 case WINDOW_STATE_TYPE_MINIMIZED: | |
35 case WINDOW_STATE_TYPE_DOCKED_MINIMIZED: | |
36 return ui::SHOW_STATE_MINIMIZED; | |
37 case WINDOW_STATE_TYPE_MAXIMIZED: | |
38 return ui::SHOW_STATE_MAXIMIZED; | |
39 case WINDOW_STATE_TYPE_INACTIVE: | |
40 return ui::SHOW_STATE_INACTIVE; | |
41 case WINDOW_STATE_TYPE_FULLSCREEN: | |
42 case WINDOW_STATE_TYPE_PINNED: | |
43 case WINDOW_STATE_TYPE_TRUSTED_PINNED: | |
44 return ui::SHOW_STATE_FULLSCREEN; | |
45 case WINDOW_STATE_TYPE_END: | |
46 NOTREACHED(); | |
47 } | |
48 NOTREACHED(); | |
49 return ui::SHOW_STATE_DEFAULT; | |
50 } | |
51 | |
52 bool IsMaximizedOrFullscreenOrPinnedWindowStateType(WindowStateType type) { | |
53 return type == WINDOW_STATE_TYPE_MAXIMIZED || | |
54 type == WINDOW_STATE_TYPE_FULLSCREEN || | |
55 type == WINDOW_STATE_TYPE_PINNED || | |
56 type == WINDOW_STATE_TYPE_TRUSTED_PINNED; | |
57 } | |
58 | |
59 } // namespace wm | |
60 } // namespace ash | |
OLD | NEW |