Port Android relocation packer to chromium build
[chromium-blink-merge.git] / ash / wm / wm_event.h
blob6630026005d7d1cf02b43def21ce222470fb705b
1 // Copyright 2014 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 #ifndef ASH_WM_WM_EVENT_H_
6 #define ASH_WM_WM_EVENT_H_
8 #include "ash/ash_export.h"
9 #include "ash/wm/wm_types.h"
10 #include "ui/gfx/geometry/rect.h"
12 namespace ash {
13 namespace wm {
15 // WMEventType defines a set of operations that can change the
16 // window's state type and bounds.
17 enum WMEventType {
18 // Following events are the request to become corresponding state.
19 // Note that this does not mean the window will be in corresponding
20 // state and the request may not be fullfilled.
22 // NORMAL is used as a restore operation with a few exceptions.
23 WM_EVENT_NORMAL,
24 WM_EVENT_MAXIMIZE,
25 WM_EVENT_MINIMIZE,
26 WM_EVENT_FULLSCREEN,
27 WM_EVENT_SNAP_LEFT,
28 WM_EVENT_SNAP_RIGHT,
29 WM_EVENT_DOCK,
31 // A window is requested to be the given bounds. The request may or
32 // may not be fulfilled depending on the requested bounds and window's
33 // state. This will not change the window state type.
34 WM_EVENT_SET_BOUNDS,
36 // Following events are compond events which may lead to different
37 // states depending on the current state.
39 // A user requested to toggle maximized state by double clicking window
40 // header.
41 WM_EVENT_TOGGLE_MAXIMIZE_CAPTION,
43 // A user requested to toggle maximized state using shortcut.
44 WM_EVENT_TOGGLE_MAXIMIZE,
46 // A user requested to toggle vertical maximize by double clicking
47 // top/bottom edge.
48 WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE,
50 // A user requested to toggle horizontal maximize by double clicking
51 // left/right edge.
52 WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE,
54 // A user requested to toggle fullscreen state.
55 WM_EVENT_TOGGLE_FULLSCREEN,
57 // A user requested a cycle of dock and snap left.
58 // The way this event is processed is the current window state is used as
59 // the starting state. Assuming normal window start state; if the window can
60 // be snapped left, snap it; otherwise progress to next state. If the window
61 // can be docked left, dock it; otherwise progress to next state. If the
62 // window can be restored; and this isn't the entry condition restore it;
63 // otherwise apply the bounce animation to the window.
64 WM_EVENT_CYCLE_SNAP_DOCK_LEFT,
66 // A user requested a cycle of dock and snap right.
67 // See decription of WM_EVENT_CYCLE_SNAP_DOCK_LEFT.
68 WM_EVENT_CYCLE_SNAP_DOCK_RIGHT,
70 // A user requested to center a window.
71 WM_EVENT_CENTER,
73 // TODO(oshima): Investigate if this can be removed from ash.
74 // Widget requested to show in inactive state.
75 WM_EVENT_SHOW_INACTIVE,
77 // Following events are generated when the workspace envrionment has changed.
78 // The window's state type will not be changed by these events.
80 // The window is added to the workspace, either as a new window, due to
81 // display disconnection or dragging.
82 WM_EVENT_ADDED_TO_WORKSPACE,
84 // Bounds of the display has changed.
85 WM_EVENT_DISPLAY_BOUNDS_CHANGED,
87 // Bounds of the work area has changed. This will not occur when the work
88 // area has changed as a result of DISPLAY_BOUNDS_CHANGED.
89 WM_EVENT_WORKAREA_BOUNDS_CHANGED,
92 class ASH_EXPORT WMEvent {
93 public:
94 explicit WMEvent(WMEventType type);
95 virtual ~WMEvent();
97 WMEventType type() const { return type_; }
99 private:
100 WMEventType type_;
101 DISALLOW_COPY_AND_ASSIGN(WMEvent);
104 // An WMEvent to request new bounds for the window.
105 class SetBoundsEvent : public WMEvent {
106 public:
107 SetBoundsEvent(WMEventType type, const gfx::Rect& requested_bounds);
108 ~SetBoundsEvent() override;
110 const gfx::Rect& requested_bounds() const { return requested_bounds_; }
112 private:
113 gfx::Rect requested_bounds_;
115 DISALLOW_COPY_AND_ASSIGN(SetBoundsEvent);
118 } // namespace wm
119 } // namespace ash
121 #endif // ASH_WM_WM_EVENT_H_