Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ash/wm/dock/docked_window_resizer.h

Issue 121153003: Prevents panels attached to shelf from docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevents panels attached to shelf from docking (comments) Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_DOCK_DOCK_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ 6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
7 7
8 #include "ash/wm/dock/dock_types.h" 8 #include "ash/wm/dock/dock_types.h"
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 17 matching lines...) Expand all
28 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging, 28 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
29 // moving or resizing of a window while it is docked to the side of a screen. 29 // moving or resizing of a window while it is docked to the side of a screen.
30 class ASH_EXPORT DockedWindowResizer : public WindowResizer { 30 class ASH_EXPORT DockedWindowResizer : public WindowResizer {
31 public: 31 public:
32 virtual ~DockedWindowResizer(); 32 virtual ~DockedWindowResizer();
33 33
34 // Creates a new DockWindowResizer. The caller takes ownership of the 34 // Creates a new DockWindowResizer. The caller takes ownership of the
35 // returned object. The ownership of |next_window_resizer| is taken by the 35 // returned object. The ownership of |next_window_resizer| is taken by the
36 // returned object. Returns NULL if not resizable. 36 // returned object. Returns NULL if not resizable.
37 static DockedWindowResizer* Create(WindowResizer* next_window_resizer, 37 static DockedWindowResizer* Create(WindowResizer* next_window_resizer,
38 aura::Window* window, 38 wm::WindowState* window_state);
39 const gfx::Point& location,
40 int window_component,
41 aura::client::WindowMoveSource source);
42 39
43 // WindowResizer: 40 // WindowResizer:
44 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; 41 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE;
45 virtual void CompleteDrag() OVERRIDE; 42 virtual void CompleteDrag() OVERRIDE;
46 virtual void RevertDrag() OVERRIDE; 43 virtual void RevertDrag() OVERRIDE;
47 virtual aura::Window* GetTarget() OVERRIDE;
48 virtual const gfx::Point& GetInitialLocation() const OVERRIDE;
49 44
50 private: 45 private:
51 // Creates DockWindowResizer that adds the ability to attach / detach 46 // Creates DockWindowResizer that adds the ability to attach / detach
52 // windows to / from the dock. This object takes ownership of 47 // windows to / from the dock. This object takes ownership of
53 // |next_window_resizer|. 48 // |next_window_resizer|.
54 DockedWindowResizer(WindowResizer* next_window_resizer, 49 DockedWindowResizer(WindowResizer* next_window_resizer,
55 const Details& details); 50 wm::WindowState* window_state);
56 51
57 // If the provided window bounds should snap to the side of a screen, 52 // If the provided window bounds should snap to the side of a screen,
58 // returns the offset that gives the necessary adjustment to snap. 53 // returns the offset that gives the necessary adjustment to snap.
59 void MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset); 54 void MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset);
60 55
61 // Tracks the window's initial position and attachment at the start of a drag 56 // Tracks the window's initial position and attachment at the start of a drag
62 // and informs the DockLayoutManager that a drag has started if necessary. 57 // and informs the DockLayoutManager that a drag has started if necessary.
63 void StartedDragging(); 58 void StartedDragging();
64 59
65 // Informs the DockLayoutManager that the drag is complete if it was informed 60 // Informs the DockLayoutManager that the drag is complete if it was informed
66 // of the drag start. 61 // of the drag start.
67 void FinishedDragging(); 62 void FinishedDragging();
68 63
69 // Reparents dragged window as necessary to the docked container or back to 64 // Reparents dragged window as necessary to the docked container or back to
70 // workspace at the end of the drag. Calculates and returns action taken that 65 // workspace at the end of the drag. Calculates and returns action taken that
71 // can be reported in UMA stats. |is_resized| reports if the window is merely 66 // can be reported in UMA stats. |is_resized| reports if the window is merely
72 // being resized rather than repositioned. |attached_panel| is necessary to 67 // being resized rather than repositioned. |attached_panel| is necessary to
73 // avoid docking panels that have been attached to the launcher shelf at the 68 // avoid docking panels that have been attached to the launcher shelf at the
74 // end of the drag. 69 // end of the drag.
75 DockedAction MaybeReparentWindowOnDragCompletion(bool is_resized, 70 DockedAction MaybeReparentWindowOnDragCompletion(bool is_resized,
76 bool is_attached_panel); 71 bool is_attached_panel);
77 72
78 const Details details_;
79
80 gfx::Point last_location_; 73 gfx::Point last_location_;
81 74
82 // Wraps a window resizer and adds detaching / reattaching during drags. 75 // Wraps a window resizer and adds detaching / reattaching during drags.
83 scoped_ptr<WindowResizer> next_window_resizer_; 76 scoped_ptr<WindowResizer> next_window_resizer_;
84 77
85 // Dock container window. 78 // Dock container window.
86 internal::DockedWindowLayoutManager* dock_layout_; 79 internal::DockedWindowLayoutManager* dock_layout_;
87 internal::DockedWindowLayoutManager* initial_dock_layout_; 80 internal::DockedWindowLayoutManager* initial_dock_layout_;
88 81
89 // Set to true once Drag() is invoked and the bounds of the window change. 82 // Set to true once Drag() is invoked and the bounds of the window change.
(...skipping 11 matching lines...) Expand all
101 94
102 base::WeakPtrFactory<DockedWindowResizer> weak_ptr_factory_; 95 base::WeakPtrFactory<DockedWindowResizer> weak_ptr_factory_;
103 96
104 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer); 97 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
105 }; 98 };
106 99
107 } // namespace internal 100 } // namespace internal
108 } // namespace ash 101 } // namespace ash
109 102
110 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ 103 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698