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

Side by Side Diff: ash/wm/panels/panel_window_resizer.cc

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (rebase) Created 7 years, 6 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
« no previous file with comments | « ash/wm/panels/panel_window_resizer.h ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ash/wm/panels/panel_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
11 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
15 #include "ash/wm/coordinate_conversion.h" 14 #include "ash/wm/coordinate_conversion.h"
16 #include "ash/wm/panels/panel_layout_manager.h" 15 #include "ash/wm/panels/panel_layout_manager.h"
17 #include "ash/wm/property_util.h" 16 #include "ash/wm/property_util.h"
18 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
19 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 aura::Window* window, 50 aura::Window* window,
52 const gfx::Point& location, 51 const gfx::Point& location,
53 int window_component, 52 int window_component,
54 aura::client::WindowMoveSource source) { 53 aura::client::WindowMoveSource source) {
55 Details details(window, location, window_component, source); 54 Details details(window, location, window_component, source);
56 return details.is_resizable ? 55 return details.is_resizable ?
57 new PanelWindowResizer(next_window_resizer, details) : NULL; 56 new PanelWindowResizer(next_window_resizer, details) : NULL;
58 } 57 }
59 58
60 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { 59 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) {
60 last_location_ = location;
61 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_);
61 bool destroyed = false; 62 bool destroyed = false;
62 if (!did_move_or_resize_) { 63 if (!did_move_or_resize_) {
63 did_move_or_resize_ = true; 64 did_move_or_resize_ = true;
64 StartedDragging(); 65 StartedDragging();
65 } 66 }
66 gfx::Point location_in_screen = location; 67 gfx::Point location_in_screen = location;
67 wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); 68 wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen);
68 69
69 // Check if the destination has changed displays. 70 // Check if the destination has changed displays.
70 gfx::Screen* screen = Shell::GetScreen(); 71 gfx::Screen* screen = Shell::GetScreen();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void PanelWindowResizer::RevertDrag() { 119 void PanelWindowResizer::RevertDrag() {
119 next_window_resizer_->RevertDrag(); 120 next_window_resizer_->RevertDrag();
120 should_attach_ = was_attached_; 121 should_attach_ = was_attached_;
121 FinishDragging(); 122 FinishDragging();
122 } 123 }
123 124
124 aura::Window* PanelWindowResizer::GetTarget() { 125 aura::Window* PanelWindowResizer::GetTarget() {
125 return next_window_resizer_->GetTarget(); 126 return next_window_resizer_->GetTarget();
126 } 127 }
127 128
129 const gfx::Point& PanelWindowResizer::GetInitialLocation() const {
130 return details_.initial_location_in_parent;
131 }
132
128 PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer, 133 PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer,
129 const Details& details) 134 const Details& details)
130 : details_(details), 135 : details_(details),
131 next_window_resizer_(next_window_resizer), 136 next_window_resizer_(next_window_resizer),
132 panel_container_(NULL), 137 panel_container_(NULL),
133 did_move_or_resize_(false), 138 did_move_or_resize_(false),
134 was_attached_(GetTarget()->GetProperty(internal::kPanelAttachedKey)), 139 was_attached_(GetTarget()->GetProperty(internal::kPanelAttachedKey)),
135 should_attach_(was_attached_), 140 should_attach_(was_attached_),
136 destroyed_(NULL) { 141 destroyed_(NULL) {
137 DCHECK(details_.is_resizable); 142 DCHECK(details_.is_resizable);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 GetTarget()->GetBoundsInScreen()); 203 GetTarget()->GetBoundsInScreen());
199 } 204 }
200 } 205 }
201 206
202 void PanelWindowResizer::FinishDragging() { 207 void PanelWindowResizer::FinishDragging() {
203 if (!did_move_or_resize_) 208 if (!did_move_or_resize_)
204 return; 209 return;
205 if (GetTarget()->GetProperty(internal::kPanelAttachedKey) != 210 if (GetTarget()->GetProperty(internal::kPanelAttachedKey) !=
206 should_attach_) { 211 should_attach_) {
207 GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_); 212 GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_);
208 GetTarget()->SetDefaultParentByRootWindow( 213 gfx::Rect near_last_location(last_location_, gfx::Size());
209 GetTarget()->GetRootWindow(), 214 GetTarget()->SetDefaultParentByRootWindow(GetTarget()->GetRootWindow(),
210 GetTarget()->GetBoundsInScreen()); 215 near_last_location);
211 } 216 }
212 if (panel_container_) 217 if (panel_container_)
213 GetPanelLayoutManager(panel_container_)->FinishDragging(); 218 GetPanelLayoutManager(panel_container_)->FinishDragging();
214 } 219 }
215 220
216 void PanelWindowResizer::UpdateLauncherPosition() { 221 void PanelWindowResizer::UpdateLauncherPosition() {
217 if (panel_container_) { 222 if (panel_container_) {
218 GetPanelLayoutManager(panel_container_)->launcher()-> 223 GetPanelLayoutManager(panel_container_)->launcher()->
219 UpdateIconPositionForWindow(GetTarget()); 224 UpdateIconPositionForWindow(GetTarget());
220 } 225 }
221 } 226 }
222 227
223 } // namespace aura 228 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_window_resizer.h ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698