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

Side by Side Diff: ash/wm/window_util.cc

Issue 2625843002: Folds WmRootWindowController into RootWindowController (Closed)
Patch Set: definition in wm_root_window_controller.cc 2 Created 3 years, 11 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 (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/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm/wm_event.h" 12 #include "ash/common/wm/wm_event.h"
13 #include "ash/common/wm/wm_screen_util.h" 13 #include "ash/common/wm/wm_screen_util.h"
14 #include "ash/common/wm_root_window_controller.h" 14 #include "ash/root_window_controller.h"
15 #include "ash/common/wm_window.h"
16 #include "ash/shell.h" 15 #include "ash/shell.h"
17 #include "ash/wm/window_properties.h" 16 #include "ash/wm/window_properties.h"
18 #include "ash/wm/window_state_aura.h" 17 #include "ash/wm/window_state_aura.h"
19 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
21 #include "ui/aura/window_delegate.h" 20 #include "ui/aura/window_delegate.h"
22 #include "ui/aura/window_event_dispatcher.h" 21 #include "ui/aura/window_event_dispatcher.h"
23 #include "ui/compositor/dip_util.h" 22 #include "ui/compositor/dip_util.h"
24 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
25 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 66 }
68 67
69 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { 68 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
70 views::View* target = static_cast<views::View*>(event.target()); 69 views::View* target = static_cast<views::View*>(event.target());
71 if (!target) 70 if (!target)
72 return false; 71 return false;
73 aura::Window* target_root = 72 aura::Window* target_root =
74 target->GetWidget()->GetNativeView()->GetRootWindow(); 73 target->GetWidget()->GetNativeView()->GetRootWindow();
75 if (!target_root || target_root == window->GetRootWindow()) 74 if (!target_root || target_root == window->GetRootWindow())
76 return false; 75 return false;
77 WmWindow* window_container = WmWindowAura::Get(target_root) 76 aura::Window* window_container = RootWindowController::ForWindow(target_root)
78 ->GetRootWindowController() 77 ->GetContainer(window->parent()->id());
79 ->GetContainer(window->parent()->id());
80 // Move the window to the target launcher. 78 // Move the window to the target launcher.
81 window_container->AddChild(WmWindowAura::Get(window)); 79 window_container->AddChild(window);
82 return true; 80 return true;
83 } 81 }
84 82
85 void SnapWindowToPixelBoundary(aura::Window* window) { 83 void SnapWindowToPixelBoundary(aura::Window* window) {
86 aura::Window* snapped_ancestor = window->parent(); 84 aura::Window* snapped_ancestor = window->parent();
87 while (snapped_ancestor) { 85 while (snapped_ancestor) {
88 if (snapped_ancestor->GetProperty(kSnapChildrenToPixelBoundary)) { 86 if (snapped_ancestor->GetProperty(kSnapChildrenToPixelBoundary)) {
89 ui::SnapLayerToPhysicalPixelBoundary(snapped_ancestor->layer(), 87 ui::SnapLayerToPhysicalPixelBoundary(snapped_ancestor->layer(),
90 window->layer()); 88 window->layer());
91 return; 89 return;
92 } 90 }
93 snapped_ancestor = snapped_ancestor->parent(); 91 snapped_ancestor = snapped_ancestor->parent();
94 } 92 }
95 } 93 }
96 94
97 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { 95 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) {
98 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) 96 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary))
99 << container->GetName(); 97 << container->GetName();
100 container->SetProperty(kSnapChildrenToPixelBoundary, true); 98 container->SetProperty(kSnapChildrenToPixelBoundary, true);
101 } 99 }
102 100
103 } // namespace wm 101 } // namespace wm
104 } // namespace ash 102 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698