Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / ash / wm / maximize_mode / maximize_mode_window_state.h
blobb5627688ea1d9b23a8922e968179de5a8efad6ea
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_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_
8 #include "ash/wm/window_state.h"
10 namespace ash {
11 class MaximizeModeWindowManager;
13 // The MaximizeModeWindowState implementation which reduces all possible window
14 // states to minimized and maximized. If a window cannot be maximized it will be
15 // set to normal. If a window cannot fill the entire workspace it will be
16 // centered within the workspace.
17 class MaximizeModeWindowState : public wm::WindowState::State {
18 public:
19 // Called when the window position might need to be updated.
20 static void UpdateWindowPosition(wm::WindowState* window_state);
22 // The |window|'s state object will be modified to use this new window mode
23 // state handler. Upon destruction it will restore the previous state handler
24 // and call |creator::WindowStateDestroyed()| to inform that the window mode
25 // was reverted to the old window manager.
26 MaximizeModeWindowState(aura::Window* window,
27 MaximizeModeWindowManager* creator);
28 ~MaximizeModeWindowState() override;
30 // Leaves the maximize mode by reverting to previous state object.
31 void LeaveMaximizeMode(wm::WindowState* window_state);
33 // Sets whether to ignore bounds updates. If set to false, immediately does a
34 // bounds update as the current window bounds may no longer be correct.
35 void SetDeferBoundsUpdates(bool defer_bounds_updates);
37 // WindowState::State overrides:
38 void OnWMEvent(wm::WindowState* window_state,
39 const wm::WMEvent* event) override;
41 wm::WindowStateType GetType() const override;
42 void AttachState(wm::WindowState* window_state,
43 wm::WindowState::State* previous_state) override;
44 void DetachState(wm::WindowState* window_state) override;
46 private:
47 // Updates the window to |new_state_type| and resulting bounds:
48 // Either full screen, maximized centered or minimized. If the state does not
49 // change, only the bounds will be changed. If |animate| is set, the bound
50 // change get animated.
51 void UpdateWindow(wm::WindowState* window_state,
52 wm::WindowStateType new_state_type,
53 bool animate);
55 // Depending on the capabilities of the window we either return
56 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|.
57 wm::WindowStateType GetMaximizedOrCenteredWindowType(
58 wm::WindowState* window_state);
60 // Updates the bounds to the maximum possible bounds according to the current
61 // window state. If |animated| is set we animate the change.
62 void UpdateBounds(wm::WindowState* window_state, bool animated);
64 // The original state object of the window.
65 scoped_ptr<wm::WindowState::State> old_state_;
67 // The state object for this object which owns this instance.
68 aura::Window* window_;
70 // The creator which needs to be informed when this state goes away.
71 MaximizeModeWindowManager* creator_;
73 // The current state type. Due to the nature of this state, this can only be
74 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}.
75 wm::WindowStateType current_state_type_;
77 // If true, do not update bounds.
78 bool defer_bounds_updates_;
80 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState);
83 } // namespace ash
85 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_