OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_WORKSPACE_WINDOW_RESIZER_H_ |
| 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ash/wm/window_resizer.h" |
| 10 #include "base/compiler_specific.h" |
| 11 |
| 12 namespace ash { |
| 13 namespace internal { |
| 14 |
| 15 // WindowResizer implementation for workspaces. This enforces that windows are |
| 16 // not allowed to vertically move or resize outside of the work area. As windows |
| 17 // are moved outside the work area they are shrunk. We remember the height of |
| 18 // the window before it was moved so that if the window is again moved up we |
| 19 // attempt to restore the old height. |
| 20 class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { |
| 21 public: |
| 22 WorkspaceWindowResizer(aura::Window* window, |
| 23 const gfx::Point& location, |
| 24 int window_component, |
| 25 int grid_size); |
| 26 virtual ~WorkspaceWindowResizer(); |
| 27 |
| 28 protected: |
| 29 // WindowResizer overrides: |
| 30 virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE; |
| 31 virtual gfx::Rect GetFinalBounds() OVERRIDE; |
| 32 |
| 33 private: |
| 34 // Used to maintain the height of the window before we started collapsing it. |
| 35 static void SetHeightBeforeObscured(aura::Window* window, int height); |
| 36 static void ClearHeightBeforeObscured(aura::Window* window); |
| 37 static int GetHeightBeforeObscured(aura::Window* window); |
| 38 |
| 39 // Adjusts the bounds to enforce that windows are vertically contained in the |
| 40 // work area. |
| 41 void AdjustBounds(gfx::Rect* bounds) const; |
| 42 |
| 43 // Returns true if the window touches the bottom of the work area. |
| 44 bool WindowTouchesBottomOfScreen() const; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
| 47 }; |
| 48 |
| 49 } // namespace internal |
| 50 } // namespace ash |
| 51 |
| 52 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |