Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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_DEFAULT_WINDOW_RESIZER_H_ |
| 6 | #define ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
| 7 | |
| 8 | #include "ash/wm/window_resizer.h" |
| 9 | #include "base/compiler_specific.h" |
| 10 | |
| 11 | namespace ash { |
| 12 | |
| 13 | // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving |
| 14 | // or resizing a window. All coordinates passed to this are in the parent |
| 15 | // windows coordiantes. |
| 16 | class ASH_EXPORT DefaultWindowResizer : public WindowResizer { |
| 17 | public: |
| 18 | virtual ~DefaultWindowResizer(); |
| 19 | |
| 20 | // Creates a new DefaultWindowResizer. The caller takes ownership of the |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 21 | // returned object. |
| 22 | static DefaultWindowResizer* Create(wm::WindowState* window_state); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 23 | |
| 24 | // Returns true if the drag will result in changing the window in anyway. |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 25 | bool is_resizable() const { return details().is_resizable; } |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 26 | |
| 27 | bool changed_size() const { |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 28 | return !(details().bounds_change & kBoundsChange_Repositions); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 29 | } |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 30 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 31 | // WindowResizer: |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 32 | virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 33 | virtual void CompleteDrag() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 34 | virtual void RevertDrag() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 35 | |
| 36 | private: |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 37 | explicit DefaultWindowResizer(wm::WindowState* window_state); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 38 | |
| 39 | // Set to true once Drag() is invoked and the bounds of the window change. |
| 40 | bool did_move_or_resize_; |
| 41 | |
| 42 | DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer); |
| 43 | }; |
| 44 | |
| 45 | } // namespace aura |
| 46 | |
| 47 | #endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |