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

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

Issue 1901773002: Removes most of aura dependencies from DefaultState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wm_window_positioner
Patch Set: nit and merge Created 4 years, 8 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_layout_manager.cc ('k') | ash/wm/system_gesture_event_filter_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/window_tree_host_manager.h" 7 #include "ash/display/window_tree_host_manager.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/wm/common/window_parenting_utils.h"
14 #include "ash/wm/panels/panel_layout_manager.h" 15 #include "ash/wm/panels/panel_layout_manager.h"
15 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
16 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
19 #include "ui/aura/client/window_tree_client.h" 20 #include "ui/aura/client/window_tree_client.h"
20 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
21 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
22 #include "ui/aura/window_delegate.h" 23 #include "ui/aura/window_delegate.h"
23 #include "ui/aura/window_event_dispatcher.h" 24 #include "ui/aura/window_event_dispatcher.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (!was_attached_) { 175 if (!was_attached_) {
175 // Attach the panel while dragging placing it in front of other panels. 176 // Attach the panel while dragging placing it in front of other panels.
176 window_state_->set_panel_attached(true); 177 window_state_->set_panel_attached(true);
177 // We use root window coordinates to ensure that during the drag the panel 178 // We use root window coordinates to ensure that during the drag the panel
178 // is reparented to a container in the root window that has that window. 179 // is reparented to a container in the root window that has that window.
179 aura::Window* target = GetTarget(); 180 aura::Window* target = GetTarget();
180 aura::Window* target_root = target->GetRootWindow(); 181 aura::Window* target_root = target->GetRootWindow();
181 aura::Window* old_parent = target->parent(); 182 aura::Window* old_parent = target->parent();
182 aura::client::ParentWindowWithContext( 183 aura::client::ParentWindowWithContext(
183 target, target_root, target_root->GetBoundsInScreen()); 184 target, target_root, target_root->GetBoundsInScreen());
184 wm::ReparentTransientChildrenOfChild(target, old_parent, target->parent()); 185 ash::wm::ReparentTransientChildrenOfChild(
186 ash::wm::WmWindowAura::Get(target),
187 ash::wm::WmWindowAura::Get(old_parent),
188 ash::wm::WmWindowAura::Get(target->parent()));
185 } 189 }
186 } 190 }
187 191
188 void PanelWindowResizer::FinishDragging() { 192 void PanelWindowResizer::FinishDragging() {
189 if (!did_move_or_resize_) 193 if (!did_move_or_resize_)
190 return; 194 return;
191 if (window_state_->panel_attached() != details().should_attach_to_shelf) { 195 if (window_state_->panel_attached() != details().should_attach_to_shelf) {
192 window_state_->set_panel_attached(details().should_attach_to_shelf); 196 window_state_->set_panel_attached(details().should_attach_to_shelf);
193 // We use last known location to ensure that after the drag the panel 197 // We use last known location to ensure that after the drag the panel
194 // is reparented to a container in the root window that has that location. 198 // is reparented to a container in the root window that has that location.
195 aura::Window* target = GetTarget(); 199 aura::Window* target = GetTarget();
196 aura::Window* target_root = target->GetRootWindow(); 200 aura::Window* target_root = target->GetRootWindow();
197 aura::Window* old_parent = target->parent(); 201 aura::Window* old_parent = target->parent();
198 aura::client::ParentWindowWithContext( 202 aura::client::ParentWindowWithContext(
199 target, target_root, gfx::Rect(last_location_, gfx::Size())); 203 target, target_root, gfx::Rect(last_location_, gfx::Size()));
200 wm::ReparentTransientChildrenOfChild(target, old_parent, target->parent()); 204 ash::wm::ReparentTransientChildrenOfChild(
205 ash::wm::WmWindowAura::Get(target),
206 ash::wm::WmWindowAura::Get(old_parent),
207 ash::wm::WmWindowAura::Get(target->parent()));
201 } 208 }
202 209
203 // If we started the drag in one root window and moved into another root 210 // If we started the drag in one root window and moved into another root
204 // but then canceled the drag we may need to inform the original layout 211 // but then canceled the drag we may need to inform the original layout
205 // manager that the drag is finished. 212 // manager that the drag is finished.
206 if (initial_panel_container_ != panel_container_) 213 if (initial_panel_container_ != panel_container_)
207 GetPanelLayoutManager(initial_panel_container_)->FinishDragging(); 214 GetPanelLayoutManager(initial_panel_container_)->FinishDragging();
208 if (panel_container_) 215 if (panel_container_)
209 GetPanelLayoutManager(panel_container_)->FinishDragging(); 216 GetPanelLayoutManager(panel_container_)->FinishDragging();
210 } 217 }
211 218
212 void PanelWindowResizer::UpdateLauncherPosition() { 219 void PanelWindowResizer::UpdateLauncherPosition() {
213 if (panel_container_) { 220 if (panel_container_) {
214 GetPanelLayoutManager(panel_container_)->shelf()-> 221 GetPanelLayoutManager(panel_container_)->shelf()->
215 UpdateIconPositionForWindow(GetTarget()); 222 UpdateIconPositionForWindow(GetTarget());
216 } 223 }
217 } 224 }
218 225
219 } // namespace aura 226 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/system_gesture_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698