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

Side by Side Diff: ash/wm/workspace/workspace_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 (nits) 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) 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_WORKSPACE_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/wm/window_resizer.h" 10 #include "ash/wm/window_resizer.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // this close to an edge of the screen it snaps to the edge. 48 // this close to an edge of the screen it snaps to the edge.
49 static const int kScreenEdgeInset; 49 static const int kScreenEdgeInset;
50 50
51 // Distance in pixels that the cursor must move past an edge for a window 51 // Distance in pixels that the cursor must move past an edge for a window
52 // to move or resize beyond that edge. 52 // to move or resize beyond that edge.
53 static const int kStickyDistancePixels; 53 static const int kStickyDistancePixels;
54 54
55 virtual ~WorkspaceWindowResizer(); 55 virtual ~WorkspaceWindowResizer();
56 56
57 static WorkspaceWindowResizer* Create( 57 static WorkspaceWindowResizer* Create(
58 aura::Window* window, 58 wm::WindowState* window_state,
59 const gfx::Point& location_in_parent,
60 int window_component,
61 aura::client::WindowMoveSource source,
62 const std::vector<aura::Window*>& attached_windows); 59 const std::vector<aura::Window*>& attached_windows);
63 60
64 // WindowResizer: 61 // WindowResizer:
65 virtual void Drag(const gfx::Point& location_in_parent, 62 virtual void Drag(const gfx::Point& location_in_parent,
66 int event_flags) OVERRIDE; 63 int event_flags) OVERRIDE;
67 virtual void CompleteDrag() OVERRIDE; 64 virtual void CompleteDrag() OVERRIDE;
68 virtual void RevertDrag() OVERRIDE; 65 virtual void RevertDrag() OVERRIDE;
69 virtual aura::Window* GetTarget() OVERRIDE;
70 virtual const gfx::Point& GetInitialLocation() const OVERRIDE;
71 66
72 private: 67 private:
73 WorkspaceWindowResizer(const Details& details, 68 WorkspaceWindowResizer(wm::WindowState* window_state,
74 const std::vector<aura::Window*>& attached_windows); 69 const std::vector<aura::Window*>& attached_windows);
75 70
76 private: 71 private:
77 friend class WorkspaceWindowResizerTest; 72 friend class WorkspaceWindowResizerTest;
78 73
79 // Returns the final bounds to place the window at. This differs from 74 // Returns the final bounds to place the window at. This differs from
80 // the current when snapping. 75 // the current when snapping.
81 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const; 76 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const;
82 77
83 // Lays out the attached windows. |bounds| is the bounds of the main window. 78 // Lays out the attached windows. |bounds| is the bounds of the main window.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void RestackWindows(); 151 void RestackWindows();
157 152
158 // Returns the SnapType for the specified point. SNAP_NONE is used if no 153 // Returns the SnapType for the specified point. SNAP_NONE is used if no
159 // snapping should be used. 154 // snapping should be used.
160 SnapType GetSnapType(const gfx::Point& location) const; 155 SnapType GetSnapType(const gfx::Point& location) const;
161 156
162 // Docks the dragged window if |should_dock| and the window can be docked. 157 // Docks the dragged window if |should_dock| and the window can be docked.
163 // Undocks the window if |should_dock| is false. 158 // Undocks the window if |should_dock| is false.
164 void SetDraggedWindowDocked(bool should_dock); 159 void SetDraggedWindowDocked(bool should_dock);
165 160
166 aura::Window* window() const { return details_.window; } 161 wm::WindowState* window_state() { return window_state_; }
167
168 wm::WindowState* window_state() { return details_.window_state; }
169
170 const Details details_;
171 162
172 const std::vector<aura::Window*> attached_windows_; 163 const std::vector<aura::Window*> attached_windows_;
173 164
174 bool did_lock_cursor_; 165 bool did_lock_cursor_;
175 166
176 // Set to true once Drag() is invoked and the bounds of the window change. 167 // Set to true once Drag() is invoked and the bounds of the window change.
177 bool did_move_or_resize_; 168 bool did_move_or_resize_;
178 169
179 // True if the window initially had |bounds_changed_by_user_| set in state. 170 // True if the window initially had |bounds_changed_by_user_| set in state.
180 bool initial_bounds_changed_by_user_; 171 bool initial_bounds_changed_by_user_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Current instance for use by the WorkspaceWindowResizerTest. 218 // Current instance for use by the WorkspaceWindowResizerTest.
228 static WorkspaceWindowResizer* instance_; 219 static WorkspaceWindowResizer* instance_;
229 220
230 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 221 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
231 }; 222 };
232 223
233 } // namespace internal 224 } // namespace internal
234 } // namespace ash 225 } // namespace ash
235 226
236 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 227 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW
« no previous file with comments | « ash/wm/workspace/multi_window_resize_controller.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698