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

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

Issue 2737213002: Update window_parenting_utils to use aura::window (Closed)
Patch Set: fix nits Created 3 years, 9 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 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/common/wm/dock/docked_window_resizer.h" 5 #include "ash/common/wm/dock/docked_window_resizer.h"
6 6
7 #include "ash/common/wm/dock/docked_window_layout_manager.h" 7 #include "ash/common/wm/dock/docked_window_layout_manager.h"
8 #include "ash/common/wm/window_parenting_utils.h" 8 #include "ash/common/wm/window_parenting_utils.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/common/wm/wm_event.h" 10 #include "ash/common/wm/wm_event.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Other windows for which the DockedWindowResizer is instantiated include 181 // Other windows for which the DockedWindowResizer is instantiated include
182 // panels and windows that are already docked. Those do not need reparenting. 182 // panels and windows that are already docked. Those do not need reparenting.
183 if (GetTarget()->GetType() != ui::wm::WINDOW_TYPE_PANEL && 183 if (GetTarget()->GetType() != ui::wm::WINDOW_TYPE_PANEL &&
184 GetTarget()->GetParent()->GetShellWindowId() == 184 GetTarget()->GetParent()->GetShellWindowId() ==
185 kShellWindowId_DefaultContainer) { 185 kShellWindowId_DefaultContainer) {
186 // Reparent the window into the docked windows container in order to get it 186 // Reparent the window into the docked windows container in order to get it
187 // on top of other docked windows. 187 // on top of other docked windows.
188 WmWindow* docked_container = 188 WmWindow* docked_container =
189 GetTarget()->GetRootWindow()->GetChildByShellWindowId( 189 GetTarget()->GetRootWindow()->GetChildByShellWindowId(
190 kShellWindowId_DockedContainer); 190 kShellWindowId_DockedContainer);
191 wm::ReparentChildWithTransientChildren( 191 wm::ReparentChildWithTransientChildren(GetTarget()->aura_window(),
192 GetTarget(), GetTarget()->GetParent(), docked_container); 192 GetTarget()->aura_window()->parent(),
193 docked_container->aura_window());
193 if (!resizer) 194 if (!resizer)
194 return; 195 return;
195 } 196 }
196 if (is_docked_) 197 if (is_docked_)
197 dock_layout_->DockDraggedWindow(GetTarget()); 198 dock_layout_->DockDraggedWindow(GetTarget());
198 } 199 }
199 200
200 void DockedWindowResizer::FinishedDragging( 201 void DockedWindowResizer::FinishedDragging(
201 aura::client::WindowMoveResult move_result) { 202 aura::client::WindowMoveResult move_result) {
202 if (!did_move_or_resize_) 203 if (!did_move_or_resize_)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 bool is_attached_panel) { 260 bool is_attached_panel) {
260 WmWindow* window = GetTarget(); 261 WmWindow* window = GetTarget();
261 262
262 // Check if the window needs to be docked or returned to workspace. 263 // Check if the window needs to be docked or returned to workspace.
263 DockedAction action = DOCKED_ACTION_NONE; 264 DockedAction action = DOCKED_ACTION_NONE;
264 WmWindow* dock_container = window->GetRootWindow()->GetChildByShellWindowId( 265 WmWindow* dock_container = window->GetRootWindow()->GetChildByShellWindowId(
265 kShellWindowId_DockedContainer); 266 kShellWindowId_DockedContainer);
266 if ((is_resized || !is_attached_panel) && 267 if ((is_resized || !is_attached_panel) &&
267 is_docked_ != (window->GetParent() == dock_container)) { 268 is_docked_ != (window->GetParent() == dock_container)) {
268 if (is_docked_) { 269 if (is_docked_) {
269 wm::ReparentChildWithTransientChildren(window, window->GetParent(), 270 wm::ReparentChildWithTransientChildren(window->aura_window(),
270 dock_container); 271 window->aura_window()->parent(),
272 dock_container->aura_window());
271 action = DOCKED_ACTION_DOCK; 273 action = DOCKED_ACTION_DOCK;
272 } else if (window->GetParent()->GetShellWindowId() == 274 } else if (window->GetParent()->GetShellWindowId() ==
273 kShellWindowId_DockedContainer) { 275 kShellWindowId_DockedContainer) {
274 // Reparent the window back to workspace. 276 // Reparent the window back to workspace.
275 // We need to be careful to give ParentWindowWithContext a location in 277 // We need to be careful to give ParentWindowWithContext a location in
276 // the right root window (matching the logic in DragWindowResizer) based 278 // the right root window (matching the logic in DragWindowResizer) based
277 // on which root window a mouse pointer is in. We want to undock into the 279 // on which root window a mouse pointer is in. We want to undock into the
278 // right screen near the edge of a multiscreen setup (based on where the 280 // right screen near the edge of a multiscreen setup (based on where the
279 // mouse is). 281 // mouse is).
280 gfx::Rect near_last_location(last_location_, gfx::Size()); 282 gfx::Rect near_last_location(last_location_, gfx::Size());
281 // Reparenting will cause Relayout and possible dock shrinking. 283 // Reparenting will cause Relayout and possible dock shrinking.
282 WmWindow* previous_parent = window->GetParent(); 284 aura::Window* previous_parent = window->aura_window()->parent();
283 window->SetParentUsingContext(window, near_last_location); 285 window->SetParentUsingContext(window, near_last_location);
284 if (window->GetParent() != previous_parent) { 286 if (window->aura_window()->parent() != previous_parent) {
285 wm::ReparentTransientChildrenOfChild(window, previous_parent, 287 wm::ReparentTransientChildrenOfChild(window->aura_window(),
286 window->GetParent()); 288 previous_parent,
289 window->aura_window()->parent());
287 } 290 }
288 action = was_docked_ ? DOCKED_ACTION_UNDOCK : DOCKED_ACTION_NONE; 291 action = was_docked_ ? DOCKED_ACTION_UNDOCK : DOCKED_ACTION_NONE;
289 } 292 }
290 } else { 293 } else {
291 // |action| is recorded in UMA and used to maintain |window_state_|. 294 // |action| is recorded in UMA and used to maintain |window_state_|.
292 if (is_resized && is_docked_ && was_docked_) 295 if (is_resized && is_docked_ && was_docked_)
293 action = DOCKED_ACTION_RESIZE; 296 action = DOCKED_ACTION_RESIZE;
294 else if (is_docked_ && was_docked_) 297 else if (is_docked_ && was_docked_)
295 action = DOCKED_ACTION_REORDER; 298 action = DOCKED_ACTION_REORDER;
296 else if (is_docked_ && !was_docked_) 299 else if (is_docked_ && !was_docked_)
(...skipping 18 matching lines...) Expand all
315 } else if (window->GetWindowState()->IsDocked() && 318 } else if (window->GetWindowState()->IsDocked() &&
316 action == DOCKED_ACTION_UNDOCK) { 319 action == DOCKED_ACTION_UNDOCK) {
317 const wm::WMEvent event(wm::WM_EVENT_NORMAL); 320 const wm::WMEvent event(wm::WM_EVENT_NORMAL);
318 window_state_->OnWMEvent(&event); 321 window_state_->OnWMEvent(&event);
319 } 322 }
320 323
321 return action; 324 return action;
322 } 325 }
323 326
324 } // namespace ash 327 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/dock/docked_window_layout_manager.cc ('k') | ash/common/wm/panels/panel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698