Prevents double-clicks on a tab close button from aslo maximizing the browser
[chromium-blink-merge.git] / ash / wm / wm_types.cc
blobca2101445411d7a1e02f51f04f25f21e435e442e
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.
5 #include "ash/wm/wm_types.h"
7 #include "base/basictypes.h"
8 #include "base/logging.h"
10 namespace ash {
11 namespace wm {
13 // This is to catch the change to WindowShowState.
14 COMPILE_ASSERT(
15 ui::SHOW_STATE_END ==
16 static_cast<ui::WindowShowState>(WINDOW_STATE_TYPE_END),
17 show_enum_mismatch);
19 WindowStateType ToWindowStateType(ui::WindowShowState state) {
20 return static_cast<WindowStateType>(state);
23 ui::WindowShowState ToWindowShowState(WindowStateType type) {
24 switch (type) {
25 case WINDOW_STATE_TYPE_DEFAULT:
26 return ui::SHOW_STATE_DEFAULT;
27 case WINDOW_STATE_TYPE_NORMAL:
28 case WINDOW_STATE_TYPE_RIGHT_SNAPPED:
29 case WINDOW_STATE_TYPE_LEFT_SNAPPED:
30 case WINDOW_STATE_TYPE_AUTO_POSITIONED:
31 return ui::SHOW_STATE_NORMAL;
32 case WINDOW_STATE_TYPE_MINIMIZED:
33 return ui::SHOW_STATE_MINIMIZED;
34 case WINDOW_STATE_TYPE_MAXIMIZED:
35 return ui::SHOW_STATE_MAXIMIZED;
36 case WINDOW_STATE_TYPE_INACTIVE:
37 return ui::SHOW_STATE_INACTIVE;
38 case WINDOW_STATE_TYPE_FULLSCREEN:
39 return ui::SHOW_STATE_FULLSCREEN;
40 case WINDOW_STATE_TYPE_DETACHED:
41 return ui::SHOW_STATE_DETACHED;
42 case WINDOW_STATE_TYPE_END:
43 NOTREACHED();
45 NOTREACHED();
46 return ui::SHOW_STATE_DEFAULT;
49 bool IsMaximizedOrFullscreenWindowStateType(WindowStateType type) {
50 return type == WINDOW_STATE_TYPE_MAXIMIZED ||
51 type == WINDOW_STATE_TYPE_FULLSCREEN;
54 } // namespace wm
55 } // namespace ash