platformKeys: Add per-extension sign permissions.
[chromium-blink-merge.git] / ash / wm / maximize_mode / maximize_mode_window_state.h
blob0512bbadf39f386430b19e45e75704b0115cabdd
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,
21 bool animated);
23 // The |window|'s state object will be modified to use this new window mode
24 // state handler. Upon destruction it will restore the previous state handler
25 // and call |creator::WindowStateDestroyed()| to inform that the window mode
26 // was reverted to the old window manager.
27 MaximizeModeWindowState(aura::Window* window,
28 MaximizeModeWindowManager* creator);
29 ~MaximizeModeWindowState() override;
31 // Leaves the maximize mode by reverting to previous state object.
32 void LeaveMaximizeMode(wm::WindowState* window_state);
34 // Sets whether to ignore bounds updates. If set to false, immediately does a
35 // bounds update as the current window bounds may no longer be correct.
36 void SetDeferBoundsUpdates(bool defer_bounds_updates);
38 // WindowState::State overrides:
39 void OnWMEvent(wm::WindowState* window_state,
40 const wm::WMEvent* event) override;
42 wm::WindowStateType GetType() const override;
43 void AttachState(wm::WindowState* window_state,
44 wm::WindowState::State* previous_state) override;
45 void DetachState(wm::WindowState* window_state) override;
47 private:
48 // Updates the window to |new_state_type| and resulting bounds:
49 // Either full screen, maximized centered or minimized. If the state does not
50 // change, only the bounds will be changed. If |animate| is set, the bound
51 // change get animated.
52 void UpdateWindow(wm::WindowState* window_state,
53 wm::WindowStateType new_state_type,
54 bool animate);
56 // Depending on the capabilities of the window we either return
57 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|.
58 wm::WindowStateType GetMaximizedOrCenteredWindowType(
59 wm::WindowState* window_state);
61 // Updates the bounds to the maximum possible bounds according to the current
62 // window state. If |animated| is set we animate the change.
63 void UpdateBounds(wm::WindowState* window_state, bool animated);
65 // The original state object of the window.
66 scoped_ptr<wm::WindowState::State> old_state_;
68 // The state object for this object which owns this instance.
69 aura::Window* window_;
71 // The creator which needs to be informed when this state goes away.
72 MaximizeModeWindowManager* creator_;
74 // The current state type. Due to the nature of this state, this can only be
75 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}.
76 wm::WindowStateType current_state_type_;
78 // If true, do not update bounds.
79 bool defer_bounds_updates_;
81 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState);
84 } // namespace ash
86 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_