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

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

Issue 115153002: wm: public window_types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ozone deps Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "ash/wm/dock/docked_window_resizer.h" 5 #include "ash/wm/dock/docked_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" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 window_state->set_bounds_changed_by_user(true); 203 window_state->set_bounds_changed_by_user(true);
204 } 204 }
205 205
206 // Tell the dock layout manager that we are dragging this window. 206 // Tell the dock layout manager that we are dragging this window.
207 // At this point we are not yet animating the window as it may not be 207 // At this point we are not yet animating the window as it may not be
208 // inside the docked area. 208 // inside the docked area.
209 dock_layout_->StartDragging(GetTarget()); 209 dock_layout_->StartDragging(GetTarget());
210 // Reparent workspace windows during the drag to elevate them above workspace. 210 // Reparent workspace windows during the drag to elevate them above workspace.
211 // Other windows for which the DockedWindowResizer is instantiated include 211 // Other windows for which the DockedWindowResizer is instantiated include
212 // panels and windows that are already docked. Those do not need reparenting. 212 // panels and windows that are already docked. Those do not need reparenting.
213 if (GetTarget()->type() != aura::client::WINDOW_TYPE_PANEL && 213 if (GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL &&
214 GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) { 214 GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) {
215 // The window is going to be reparented - avoid completing the drag. 215 // The window is going to be reparented - avoid completing the drag.
216 window_state->set_continue_drag_after_reparent(true); 216 window_state->set_continue_drag_after_reparent(true);
217 217
218 // Reparent the window into the docked windows container in order to get it 218 // Reparent the window into the docked windows container in order to get it
219 // on top of other docked windows. 219 // on top of other docked windows.
220 aura::Window* docked_container = Shell::GetContainer( 220 aura::Window* docked_container = Shell::GetContainer(
221 GetTarget()->GetRootWindow(), 221 GetTarget()->GetRootWindow(),
222 kShellWindowId_DockedContainer); 222 kShellWindowId_DockedContainer);
223 wm::ReparentChildWithTransientChildren(GetTarget(), 223 wm::ReparentChildWithTransientChildren(GetTarget(),
224 GetTarget()->parent(), 224 GetTarget()->parent(),
225 docked_container); 225 docked_container);
226 } 226 }
227 if (is_docked_) 227 if (is_docked_)
228 dock_layout_->DockDraggedWindow(GetTarget()); 228 dock_layout_->DockDraggedWindow(GetTarget());
229 } 229 }
230 230
231 void DockedWindowResizer::FinishedDragging() { 231 void DockedWindowResizer::FinishedDragging() {
232 if (!did_move_or_resize_) 232 if (!did_move_or_resize_)
233 return; 233 return;
234 did_move_or_resize_ = false; 234 did_move_or_resize_ = false;
235 aura::Window* window = GetTarget(); 235 aura::Window* window = GetTarget();
236 wm::WindowState* window_state = wm::GetWindowState(window); 236 wm::WindowState* window_state = wm::GetWindowState(window);
237 const bool is_attached_panel = 237 const bool is_attached_panel = window->type() == ui::wm::WINDOW_TYPE_PANEL &&
238 window->type() == aura::client::WINDOW_TYPE_PANEL && 238 window_state->panel_attached();
239 window_state->panel_attached();
240 const bool is_resized = 239 const bool is_resized =
241 (details_.bounds_change & WindowResizer::kBoundsChange_Resizes) != 0; 240 (details_.bounds_change & WindowResizer::kBoundsChange_Resizes) != 0;
242 241
243 // When drag is completed the dragged docked window is resized to the bounds 242 // When drag is completed the dragged docked window is resized to the bounds
244 // calculated by the layout manager that conform to other docked windows. 243 // calculated by the layout manager that conform to other docked windows.
245 if (!is_attached_panel && is_docked_ && !is_resized) { 244 if (!is_attached_panel && is_docked_ && !is_resized) {
246 gfx::Rect bounds = ScreenAsh::ConvertRectFromScreen( 245 gfx::Rect bounds = ScreenAsh::ConvertRectFromScreen(
247 window->parent(), dock_layout_->dragged_bounds()); 246 window->parent(), dock_layout_->dragged_bounds());
248 if (!bounds.IsEmpty() && bounds.width() != window->bounds().width()) { 247 if (!bounds.IsEmpty() && bounds.width() != window->bounds().width()) {
249 window->SetBounds(bounds); 248 window->SetBounds(bounds);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // before. 327 // before.
329 if (is_docked_) { 328 if (is_docked_) {
330 wm::GetWindowState(window)->set_bounds_changed_by_user( 329 wm::GetWindowState(window)->set_bounds_changed_by_user(
331 was_docked_ && (is_resized || was_bounds_changed_by_user_)); 330 was_docked_ && (is_resized || was_bounds_changed_by_user_));
332 } 331 }
333 return action; 332 return action;
334 } 333 }
335 334
336 } // namespace internal 335 } // namespace internal
337 } // namespace ash 336 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698