| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 5 #ifndef ASH_WM_TABLET_MODE_TABLET_MODE_WINDOW_STATE_H_ |
| 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 6 #define ASH_WM_TABLET_MODE_TABLET_MODE_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 class MaximizeModeWindowManager; | 14 class TabletModeWindowManager; |
| 15 | 15 |
| 16 // The MaximizeModeWindowState implementation which reduces all possible window | 16 // The TabletModeWindowState implementation which reduces all possible window |
| 17 // states to minimized and maximized. If a window cannot be maximized it will be | 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 | 18 // set to normal. If a window cannot fill the entire workspace it will be |
| 19 // centered within the workspace. | 19 // centered within the workspace. |
| 20 class MaximizeModeWindowState : public wm::WindowState::State { | 20 class TabletModeWindowState : public wm::WindowState::State { |
| 21 public: | 21 public: |
| 22 // Called when the window position might need to be updated. | 22 // Called when the window position might need to be updated. |
| 23 static void UpdateWindowPosition(wm::WindowState* window_state); | 23 static void UpdateWindowPosition(wm::WindowState* window_state); |
| 24 | 24 |
| 25 // The |window|'s state object will be modified to use this new window mode | 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 | 26 // state handler. Upon destruction it will restore the previous state handler |
| 27 // and call |creator::WindowStateDestroyed()| to inform that the window mode | 27 // and call |creator::WindowStateDestroyed()| to inform that the window mode |
| 28 // was reverted to the old window manager. | 28 // was reverted to the old window manager. |
| 29 MaximizeModeWindowState(aura::Window* window, | 29 TabletModeWindowState(aura::Window* window, TabletModeWindowManager* creator); |
| 30 MaximizeModeWindowManager* creator); | 30 ~TabletModeWindowState() override; |
| 31 ~MaximizeModeWindowState() override; | |
| 32 | 31 |
| 33 void set_ignore_wm_events(bool ignore) { ignore_wm_events_ = ignore; } | 32 void set_ignore_wm_events(bool ignore) { ignore_wm_events_ = ignore; } |
| 34 | 33 |
| 35 // Leaves the maximize mode by reverting to previous state object. | 34 // Leaves the tablet mode by reverting to previous state object. |
| 36 void LeaveMaximizeMode(wm::WindowState* window_state); | 35 void LeaveTabletMode(wm::WindowState* window_state); |
| 37 | 36 |
| 38 // Sets whether to ignore bounds updates. If set to false, immediately does a | 37 // 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. | 38 // bounds update as the current window bounds may no longer be correct. |
| 40 void SetDeferBoundsUpdates(bool defer_bounds_updates); | 39 void SetDeferBoundsUpdates(bool defer_bounds_updates); |
| 41 | 40 |
| 42 // WindowState::State overrides: | 41 // WindowState::State overrides: |
| 43 void OnWMEvent(wm::WindowState* window_state, | 42 void OnWMEvent(wm::WindowState* window_state, |
| 44 const wm::WMEvent* event) override; | 43 const wm::WMEvent* event) override; |
| 45 | 44 |
| 46 wm::WindowStateType GetType() const override; | 45 wm::WindowStateType GetType() const override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 // window state. If |animated| is set we animate the change. | 65 // window state. If |animated| is set we animate the change. |
| 67 void UpdateBounds(wm::WindowState* window_state, bool animated); | 66 void UpdateBounds(wm::WindowState* window_state, bool animated); |
| 68 | 67 |
| 69 // The original state object of the window. | 68 // The original state object of the window. |
| 70 std::unique_ptr<wm::WindowState::State> old_state_; | 69 std::unique_ptr<wm::WindowState::State> old_state_; |
| 71 | 70 |
| 72 // The window whose WindowState owns this instance. | 71 // The window whose WindowState owns this instance. |
| 73 aura::Window* window_; | 72 aura::Window* window_; |
| 74 | 73 |
| 75 // The creator which needs to be informed when this state goes away. | 74 // The creator which needs to be informed when this state goes away. |
| 76 MaximizeModeWindowManager* creator_; | 75 TabletModeWindowManager* creator_; |
| 77 | 76 |
| 78 // The current state type. Due to the nature of this state, this can only be | 77 // The current state type. Due to the nature of this state, this can only be |
| 79 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. | 78 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. |
| 80 wm::WindowStateType current_state_type_; | 79 wm::WindowStateType current_state_type_; |
| 81 | 80 |
| 82 // If true, do not update bounds. | 81 // If true, do not update bounds. |
| 83 bool defer_bounds_updates_; | 82 bool defer_bounds_updates_; |
| 84 | 83 |
| 85 // If true, the state will not process events. | 84 // If true, the state will not process events. |
| 86 bool ignore_wm_events_ = false; | 85 bool ignore_wm_events_ = false; |
| 87 | 86 |
| 88 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState); | 87 DISALLOW_COPY_AND_ASSIGN(TabletModeWindowState); |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace ash | 90 } // namespace ash |
| 92 | 91 |
| 93 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 92 #endif // ASH_WM_TABLET_MODE_TABLET_MODE_WINDOW_STATE_H_ |
| OLD | NEW |