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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 (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/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 screen->GetDisplayNearestPoint(last_location_); 70 screen->GetDisplayNearestPoint(last_location_);
71 if (dst_display.id() != 71 if (dst_display.id() !=
72 screen->GetDisplayNearestWindow(panel_container_->GetRootWindow()).id()) { 72 screen->GetDisplayNearestWindow(panel_container_->GetRootWindow()).id()) {
73 // The panel is being dragged to a new display. If the previous container is 73 // The panel is being dragged to a new display. If the previous container is
74 // the current parent of the panel it will be informed of the end of drag 74 // the current parent of the panel it will be informed of the end of drag
75 // when the panel is reparented, otherwise let the previous container know 75 // when the panel is reparented, otherwise let the previous container know
76 // the drag is complete. If we told the panel's parent that the drag was 76 // the drag is complete. If we told the panel's parent that the drag was
77 // complete it would begin positioning the panel. 77 // complete it would begin positioning the panel.
78 if (GetTarget()->parent() != panel_container_) 78 if (GetTarget()->parent() != panel_container_)
79 GetPanelLayoutManager(panel_container_)->FinishDragging(); 79 GetPanelLayoutManager(panel_container_)->FinishDragging();
80 aura::RootWindow* dst_root = Shell::GetInstance()->display_controller()-> 80 aura::Window* dst_root = Shell::GetInstance()->display_controller()->
81 GetRootWindowForDisplayId(dst_display.id()); 81 GetRootWindowForDisplayId(dst_display.id());
82 panel_container_ = Shell::GetContainer( 82 panel_container_ = Shell::GetContainer(
83 dst_root, internal::kShellWindowId_PanelContainer); 83 dst_root, internal::kShellWindowId_PanelContainer);
84 84
85 // The panel's parent already knows that the drag is in progress for this 85 // The panel's parent already knows that the drag is in progress for this
86 // panel. 86 // panel.
87 if (panel_container_ && GetTarget()->parent() != panel_container_) 87 if (panel_container_ && GetTarget()->parent() != panel_container_)
88 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget()); 88 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget());
89 } 89 }
90 gfx::Point offset; 90 gfx::Point offset;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // attaching it so that it does not get repositioned. 190 // attaching it so that it does not get repositioned.
191 if (panel_container_) 191 if (panel_container_)
192 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget()); 192 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget());
193 if (!was_attached_) { 193 if (!was_attached_) {
194 // Attach the panel while dragging placing it in front of other panels. 194 // Attach the panel while dragging placing it in front of other panels.
195 wm::GetWindowState(GetTarget())->set_continue_drag_after_reparent(true); 195 wm::GetWindowState(GetTarget())->set_continue_drag_after_reparent(true);
196 wm::GetWindowState(GetTarget())->set_panel_attached(true); 196 wm::GetWindowState(GetTarget())->set_panel_attached(true);
197 // We use root window coordinates to ensure that during the drag the panel 197 // We use root window coordinates to ensure that during the drag the panel
198 // is reparented to a container in the root window that has that window. 198 // is reparented to a container in the root window that has that window.
199 aura::Window* target = GetTarget(); 199 aura::Window* target = GetTarget();
200 aura::RootWindow* target_root = target->GetRootWindow(); 200 aura::Window* target_root = target->GetRootWindow();
201 aura::client::ParentWindowWithContext( 201 aura::client::ParentWindowWithContext(
202 target, target_root, target_root->GetBoundsInScreen()); 202 target, target_root, target_root->GetBoundsInScreen());
203 wm::ReparentTransientChildrenOfChild(target->parent(), target); 203 wm::ReparentTransientChildrenOfChild(target->parent(), target);
204 } 204 }
205 } 205 }
206 206
207 void PanelWindowResizer::FinishDragging() { 207 void PanelWindowResizer::FinishDragging() {
208 if (!did_move_or_resize_) 208 if (!did_move_or_resize_)
209 return; 209 return;
210 if (wm::GetWindowState(GetTarget())->panel_attached() != should_attach_) { 210 if (wm::GetWindowState(GetTarget())->panel_attached() != should_attach_) {
211 wm::GetWindowState(GetTarget())->set_panel_attached(should_attach_); 211 wm::GetWindowState(GetTarget())->set_panel_attached(should_attach_);
212 // We use last known location to ensure that after the drag the panel 212 // We use last known location to ensure that after the drag the panel
213 // is reparented to a container in the root window that has that location. 213 // is reparented to a container in the root window that has that location.
214 aura::Window* target = GetTarget(); 214 aura::Window* target = GetTarget();
215 aura::RootWindow* target_root = target->GetRootWindow(); 215 aura::Window* target_root = target->GetRootWindow();
216 aura::client::ParentWindowWithContext( 216 aura::client::ParentWindowWithContext(
217 target, target_root, gfx::Rect(last_location_, gfx::Size())); 217 target, target_root, gfx::Rect(last_location_, gfx::Size()));
218 wm::ReparentTransientChildrenOfChild(target->parent(), GetTarget()); 218 wm::ReparentTransientChildrenOfChild(target->parent(), GetTarget());
219 } 219 }
220 220
221 // If we started the drag in one root window and moved into another root 221 // If we started the drag in one root window and moved into another root
222 // but then canceled the drag we may need to inform the original layout 222 // but then canceled the drag we may need to inform the original layout
223 // manager that the drag is finished. 223 // manager that the drag is finished.
224 if (initial_panel_container_ != panel_container_) 224 if (initial_panel_container_ != panel_container_)
225 GetPanelLayoutManager(initial_panel_container_)->FinishDragging(); 225 GetPanelLayoutManager(initial_panel_container_)->FinishDragging();
226 if (panel_container_) 226 if (panel_container_)
227 GetPanelLayoutManager(panel_container_)->FinishDragging(); 227 GetPanelLayoutManager(panel_container_)->FinishDragging();
228 } 228 }
229 229
230 void PanelWindowResizer::UpdateLauncherPosition() { 230 void PanelWindowResizer::UpdateLauncherPosition() {
231 if (panel_container_) { 231 if (panel_container_) {
232 GetPanelLayoutManager(panel_container_)->launcher()-> 232 GetPanelLayoutManager(panel_container_)->launcher()->
233 UpdateIconPositionForWindow(GetTarget()); 233 UpdateIconPositionForWindow(GetTarget());
234 } 234 }
235 } 235 }
236 236
237 } // namespace aura 237 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698