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

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

Issue 2613863005: Removes/promotes functions from WmWindowMus to WmWindowAura (Closed)
Patch Set: window_ part2 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
« no previous file with comments | « ash/mus/bridge/wm_window_mus.cc ('k') | no next file » | 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/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/common/wm_window.h" 15 #include "ash/common/wm_window.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
17 #include "ash/wm/window_state_aura.h" 18 #include "ash/wm/window_state_aura.h"
18 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
19 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
20 #include "ui/aura/window_delegate.h" 21 #include "ui/aura/window_delegate.h"
21 #include "ui/aura/window_event_dispatcher.h" 22 #include "ui/aura/window_event_dispatcher.h"
22 #include "ui/compositor/dip_util.h" 23 #include "ui/compositor/dip_util.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 67 }
67 68
68 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { 69 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
69 views::View* target = static_cast<views::View*>(event.target()); 70 views::View* target = static_cast<views::View*>(event.target());
70 if (!target) 71 if (!target)
71 return false; 72 return false;
72 aura::Window* target_root = 73 aura::Window* target_root =
73 target->GetWidget()->GetNativeView()->GetRootWindow(); 74 target->GetWidget()->GetNativeView()->GetRootWindow();
74 if (!target_root || target_root == window->GetRootWindow()) 75 if (!target_root || target_root == window->GetRootWindow())
75 return false; 76 return false;
76 aura::Window* window_container = 77 WmWindow* window_container = WmWindowAura::Get(target_root)
77 ash::Shell::GetContainer(target_root, window->parent()->id()); 78 ->GetRootWindowController()
79 ->GetContainer(window->parent()->id());
78 // Move the window to the target launcher. 80 // Move the window to the target launcher.
79 window_container->AddChild(window); 81 window_container->AddChild(WmWindowAura::Get(window));
80 return true; 82 return true;
81 } 83 }
82 84
83 void SnapWindowToPixelBoundary(aura::Window* window) { 85 void SnapWindowToPixelBoundary(aura::Window* window) {
84 aura::Window* snapped_ancestor = window->parent(); 86 aura::Window* snapped_ancestor = window->parent();
85 while (snapped_ancestor) { 87 while (snapped_ancestor) {
86 if (snapped_ancestor->GetProperty(kSnapChildrenToPixelBoundary)) { 88 if (snapped_ancestor->GetProperty(kSnapChildrenToPixelBoundary)) {
87 ui::SnapLayerToPhysicalPixelBoundary(snapped_ancestor->layer(), 89 ui::SnapLayerToPhysicalPixelBoundary(snapped_ancestor->layer(),
88 window->layer()); 90 window->layer());
89 return; 91 return;
90 } 92 }
91 snapped_ancestor = snapped_ancestor->parent(); 93 snapped_ancestor = snapped_ancestor->parent();
92 } 94 }
93 } 95 }
94 96
95 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { 97 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) {
96 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) 98 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary))
97 << container->GetName(); 99 << container->GetName();
98 container->SetProperty(kSnapChildrenToPixelBoundary, true); 100 container->SetProperty(kSnapChildrenToPixelBoundary, true);
99 } 101 }
100 102
101 } // namespace wm 103 } // namespace wm
102 } // namespace ash 104 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_window_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698