OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_DEFAULT_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
6 #define ASH_WM_DEFAULT_WINDOW_RESIZER_H_ | 6 #define ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
7 | 7 |
8 #include "ash/wm/window_resizer.h" | 8 #include "ash/wm/window_resizer.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving | 13 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving |
14 // or resizing a window. All coordinates passed to this are in the parent | 14 // or resizing a window. All coordinates passed to this are in the parent |
15 // windows coordiantes. | 15 // windows coordiantes. |
16 class ASH_EXPORT DefaultWindowResizer : public WindowResizer { | 16 class ASH_EXPORT DefaultWindowResizer : public WindowResizer { |
17 public: | 17 public: |
18 explicit DefaultWindowResizer(const Details& details); | |
sky
2012/12/04 15:58:53
Move constructor in .cc to match position.
mazda
2012/12/04 18:44:41
Done.
| |
18 virtual ~DefaultWindowResizer(); | 19 virtual ~DefaultWindowResizer(); |
19 | 20 |
20 // Creates a new DefaultWindowResizer. The caller takes ownership of the | 21 // Creates a new DefaultWindowResizer. The caller takes ownership of the |
21 // returned object. Returns NULL if not resizable. | 22 // returned object. Returns NULL if not resizable. |
22 static DefaultWindowResizer* Create(aura::Window* window, | 23 static DefaultWindowResizer* Create(aura::Window* window, |
23 const gfx::Point& location, | 24 const gfx::Point& location, |
24 int window_component); | 25 int window_component); |
25 | 26 |
26 // Returns true if the drag will result in changing the window in anyway. | 27 // Returns true if the drag will result in changing the window in anyway. |
27 bool is_resizable() const { return details_.is_resizable; } | 28 bool is_resizable() const { return details_.is_resizable; } |
28 | 29 |
29 bool changed_size() const { | 30 bool changed_size() const { |
30 return !(details_.bounds_change & kBoundsChange_Repositions); | 31 return !(details_.bounds_change & kBoundsChange_Repositions); |
31 } | 32 } |
32 aura::Window* target_window() const { return details_.window; } | 33 aura::Window* target_window() const { return details_.window; } |
33 | 34 |
34 // WindowResizer overides: | 35 // WindowResizer overides: |
35 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; | 36 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
36 virtual void CompleteDrag(int event_flags) OVERRIDE; | 37 virtual void CompleteDrag(int event_flags) OVERRIDE; |
37 virtual void RevertDrag() OVERRIDE; | 38 virtual void RevertDrag() OVERRIDE; |
38 virtual aura::Window* GetTarget() OVERRIDE; | 39 virtual aura::Window* GetTarget() OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 explicit DefaultWindowResizer(const Details& details); | |
42 | |
43 const Details details_; | 42 const Details details_; |
44 | 43 |
45 // Set to true once Drag() is invoked and the bounds of the window change. | 44 // Set to true once Drag() is invoked and the bounds of the window change. |
46 bool did_move_or_resize_; | 45 bool did_move_or_resize_; |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer); | 47 DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer); |
49 }; | 48 }; |
50 | 49 |
51 } // namespace aura | 50 } // namespace aura |
52 | 51 |
53 #endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_ | 52 #endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
OLD | NEW |