Chromium Code Reviews| 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_DOCK_DOCK_WINDOW_RESIZER_H_ | |
| 6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ | |
| 7 | |
| 8 #include "ash/wm/window_resizer.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 class Rect; | |
| 13 class Point; | |
| 14 } | |
| 15 | |
| 16 namespace aura { | |
| 17 class RootWindow; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 | |
| 22 namespace internal { | |
| 23 class DockLayoutManager; | |
| 24 } | |
| 25 | |
| 26 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging, | |
| 27 // moving or resizing of a window while in a dock. | |
|
sky
2013/06/11 00:03:13
Again, in 'dock' is confusing here.
varkha
2013/06/11 02:34:24
Done.
| |
| 28 class ASH_EXPORT DockWindowResizer : public WindowResizer { | |
| 29 public: | |
| 30 virtual ~DockWindowResizer(); | |
| 31 | |
| 32 // Creates a new DockWindowResizer. The caller takes ownership of the | |
| 33 // returned object. The ownership of |next_window_resizer| is taken by the | |
| 34 // returned object. Returns NULL if not resizable. | |
| 35 static DockWindowResizer* Create(WindowResizer* next_window_resizer, | |
| 36 aura::Window* window, | |
| 37 const gfx::Point& location, | |
| 38 int window_component); | |
| 39 | |
| 40 // WindowResizer: | |
| 41 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; | |
| 42 virtual void CompleteDrag(int event_flags) OVERRIDE; | |
| 43 virtual void RevertDrag() OVERRIDE; | |
| 44 virtual aura::Window* GetTarget() OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 // Creates DockWindowResizer that adds the ability to attach / detach | |
| 48 // windows to / from the dock. This object takes ownership of | |
| 49 // |next_window_resizer|. | |
| 50 DockWindowResizer(WindowResizer* next_window_resizer, | |
| 51 const Details& details); | |
| 52 | |
| 53 // Tracks the window's initial position and attachment at the start of a drag | |
| 54 // and informs the DockLayoutManager that a drag has started if necessary. | |
| 55 void StartedDragging(); | |
| 56 | |
| 57 // Informs the DockLayoutManager that the drag is complete if it was informed | |
| 58 // of the drag start. | |
| 59 void FinishDragging(); | |
| 60 | |
| 61 const Details details_; | |
| 62 | |
| 63 gfx::Point last_mouse_location_; | |
| 64 | |
| 65 // Wraps a window resizer and adds detaching / reattaching during drags. | |
| 66 scoped_ptr<WindowResizer> next_window_resizer_; | |
| 67 | |
| 68 // Dock container window. | |
| 69 internal::DockLayoutManager* dock_layout_; | |
| 70 | |
| 71 // Was the window docked before the drag started | |
| 72 bool was_docked_; | |
| 73 | |
| 74 // Cached root window when drag started | |
| 75 aura::RootWindow* root_window_; | |
| 76 | |
| 77 // Set to true once Drag() is invoked and the bounds of the window change. | |
| 78 bool did_move_or_resize_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(DockWindowResizer); | |
| 81 }; | |
| 82 | |
| 83 } // namespace ash | |
| 84 | |
| 85 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ | |
| OLD | NEW |