Enable compilation of angle_end2end_tests on Linux
[chromium-blink-merge.git] / ash / wm / default_state.h
blobf03adb8cd380534230aa4a416c5e3b18d7bafc64
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_DEFAULT_STATE_H_
6 #define ASH_WM_DEFAULT_STATE_H_
8 #include "ash/wm/window_state.h"
9 #include "ui/gfx/display.h"
11 namespace ash {
12 namespace wm {
13 class SetBoundsEvent;
15 // DefaultState implements Ash behavior without state machine.
16 class DefaultState : public WindowState::State {
17 public:
18 explicit DefaultState(WindowStateType initial_state_type);
19 ~DefaultState() override;
21 // WindowState::State overrides:
22 void OnWMEvent(WindowState* window_state, const WMEvent* event) override;
23 WindowStateType GetType() const override;
24 void AttachState(WindowState* window_state,
25 WindowState::State* previous_state) override;
26 void DetachState(WindowState* window_state) override;
28 private:
29 // Process state dependent events, such as TOGGLE_MAXIMIZED,
30 // TOGGLE_FULLSCREEN.
31 static bool ProcessCompoundEvents(WindowState* window_state,
32 const WMEvent* event);
34 // Process workspace related events, such as DISPLAY_BOUNDS_CHANGED.
35 static bool ProcessWorkspaceEvents(WindowState* window_state,
36 const WMEvent* event);
38 // Set the fullscreen/maximized bounds without animation.
39 static bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
41 static void SetBounds(WindowState* window_state,
42 const SetBoundsEvent* bounds_event);
44 static void CenterWindow(WindowState* window_state);
46 // Enters next state. This is used when the state moves from one to another
47 // within the same desktop mode.
48 void EnterToNextState(wm::WindowState* window_state,
49 wm::WindowStateType next_state_type);
51 // Reenters the current state. This is called when migrating from
52 // previous desktop mode, and the window's state needs to re-construct the
53 // state/bounds for this state.
54 void ReenterToCurrentState(wm::WindowState* window_state,
55 wm::WindowState::State* state_in_previous_mode);
57 // Animates to new window bounds based on the current and previous state type.
58 void UpdateBoundsFromState(wm::WindowState* window_state,
59 wm::WindowStateType old_state_type);
61 // The current type of the window.
62 WindowStateType state_type_;
64 // The saved window state for the case that the state gets de-/activated.
65 gfx::Rect stored_bounds_;
66 gfx::Rect stored_restore_bounds_;
68 // The display state in which the mode got started.
69 gfx::Display stored_display_state_;
71 // The window state only gets remembered for DCHECK reasons.
72 WindowState* stored_window_state_;
74 DISALLOW_COPY_AND_ASSIGN(DefaultState);
77 } // namespace wm
78 } // namespace ash
80 #endif // ASH_WM_DEFAULT_STATE_H_