Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_state.h

Issue 2906803002: Rename MaximizeMode to TabletMode (Closed)
Patch Set: updated filter Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_
7
8 #include <memory>
9
10 #include "ash/wm/window_state.h"
11 #include "base/macros.h"
12
13 namespace ash {
14 class MaximizeModeWindowManager;
15
16 // The MaximizeModeWindowState implementation which reduces all possible window
17 // states to minimized and maximized. If a window cannot be maximized it will be
18 // set to normal. If a window cannot fill the entire workspace it will be
19 // centered within the workspace.
20 class MaximizeModeWindowState : public wm::WindowState::State {
21 public:
22 // Called when the window position might need to be updated.
23 static void UpdateWindowPosition(wm::WindowState* window_state);
24
25 // The |window|'s state object will be modified to use this new window mode
26 // state handler. Upon destruction it will restore the previous state handler
27 // and call |creator::WindowStateDestroyed()| to inform that the window mode
28 // was reverted to the old window manager.
29 MaximizeModeWindowState(aura::Window* window,
30 MaximizeModeWindowManager* creator);
31 ~MaximizeModeWindowState() override;
32
33 void set_ignore_wm_events(bool ignore) { ignore_wm_events_ = ignore; }
34
35 // Leaves the maximize mode by reverting to previous state object.
36 void LeaveMaximizeMode(wm::WindowState* window_state);
37
38 // Sets whether to ignore bounds updates. If set to false, immediately does a
39 // bounds update as the current window bounds may no longer be correct.
40 void SetDeferBoundsUpdates(bool defer_bounds_updates);
41
42 // WindowState::State overrides:
43 void OnWMEvent(wm::WindowState* window_state,
44 const wm::WMEvent* event) override;
45
46 wm::WindowStateType GetType() const override;
47 void AttachState(wm::WindowState* window_state,
48 wm::WindowState::State* previous_state) override;
49 void DetachState(wm::WindowState* window_state) override;
50
51 private:
52 // Updates the window to |new_state_type| and resulting bounds:
53 // Either full screen, maximized centered or minimized. If the state does not
54 // change, only the bounds will be changed. If |animate| is set, the bound
55 // change get animated.
56 void UpdateWindow(wm::WindowState* window_state,
57 wm::WindowStateType new_state_type,
58 bool animate);
59
60 // Depending on the capabilities of the window we either return
61 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|.
62 wm::WindowStateType GetMaximizedOrCenteredWindowType(
63 wm::WindowState* window_state);
64
65 // Updates the bounds to the maximum possible bounds according to the current
66 // window state. If |animated| is set we animate the change.
67 void UpdateBounds(wm::WindowState* window_state, bool animated);
68
69 // The original state object of the window.
70 std::unique_ptr<wm::WindowState::State> old_state_;
71
72 // The window whose WindowState owns this instance.
73 aura::Window* window_;
74
75 // The creator which needs to be informed when this state goes away.
76 MaximizeModeWindowManager* creator_;
77
78 // The current state type. Due to the nature of this state, this can only be
79 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}.
80 wm::WindowStateType current_state_type_;
81
82 // If true, do not update bounds.
83 bool defer_bounds_updates_;
84
85 // If true, the state will not process events.
86 bool ignore_wm_events_ = false;
87
88 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState);
89 };
90
91 } // namespace ash
92
93 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698