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

Side by Side Diff: ash/display/screen_position_controller.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/display/screen_ash.cc ('k') | ash/display/screen_position_controller_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/display/screen_position_controller.h" 5 #include "ash/display/screen_position_controller.h"
6 6
7 #include "ash/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/display/window_tree_host_manager.h" 9 #include "ash/display/window_tree_host_manager.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 22 matching lines...) Expand all
33 ShouldStayInSameRootWindow(window->parent())); 33 ShouldStayInSameRootWindow(window->parent()));
34 } 34 }
35 35
36 // Move all transient children to |dst_root|, including the ones in 36 // Move all transient children to |dst_root|, including the ones in
37 // the child windows and transient children of the transient children. 37 // the child windows and transient children of the transient children.
38 void MoveAllTransientChildrenToNewRoot(const display::Display& display, 38 void MoveAllTransientChildrenToNewRoot(const display::Display& display,
39 aura::Window* window) { 39 aura::Window* window) {
40 aura::Window* dst_root = Shell::GetInstance() 40 aura::Window* dst_root = Shell::GetInstance()
41 ->window_tree_host_manager() 41 ->window_tree_host_manager()
42 ->GetRootWindowForDisplayId(display.id()); 42 ->GetRootWindowForDisplayId(display.id());
43 aura::Window::Windows transient_children = 43 aura::Window::Windows transient_children = ::wm::GetTransientChildren(window);
44 ::wm::GetTransientChildren(window);
45 for (aura::Window::Windows::iterator iter = transient_children.begin(); 44 for (aura::Window::Windows::iterator iter = transient_children.begin();
46 iter != transient_children.end(); ++iter) { 45 iter != transient_children.end(); ++iter) {
47 aura::Window* transient_child = *iter; 46 aura::Window* transient_child = *iter;
48 int container_id = transient_child->parent()->id(); 47 int container_id = transient_child->parent()->id();
49 DCHECK_GE(container_id, 0); 48 DCHECK_GE(container_id, 0);
50 aura::Window* container = Shell::GetContainer(dst_root, container_id); 49 aura::Window* container = Shell::GetContainer(dst_root, container_id);
51 gfx::Rect parent_bounds_in_screen = transient_child->GetBoundsInScreen(); 50 gfx::Rect parent_bounds_in_screen = transient_child->GetBoundsInScreen();
52 container->AddChild(transient_child); 51 container->AddChild(transient_child);
53 transient_child->SetBoundsInScreen(parent_bounds_in_screen, display); 52 transient_child->SetBoundsInScreen(parent_bounds_in_screen, display);
54 53
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 host->ConvertPointFromNativeScreen(point); 109 host->ConvertPointFromNativeScreen(point);
111 return; 110 return;
112 } 111 }
113 } 112 }
114 } 113 }
115 #endif 114 #endif
116 *target_root = root_window; 115 *target_root = root_window;
117 *point = point_in_root; 116 *point = point_in_root;
118 } 117 }
119 118
120 void ScreenPositionController::ConvertPointToScreen( 119 void ScreenPositionController::ConvertPointToScreen(const aura::Window* window,
121 const aura::Window* window, 120 gfx::Point* point) {
122 gfx::Point* point) {
123 const aura::Window* root = window->GetRootWindow(); 121 const aura::Window* root = window->GetRootWindow();
124 aura::Window::ConvertPointToTarget(window, root, point); 122 aura::Window::ConvertPointToTarget(window, root, point);
125 const gfx::Point display_origin = 123 const gfx::Point display_origin =
126 display::Screen::GetScreen() 124 display::Screen::GetScreen()
127 ->GetDisplayNearestWindow(const_cast<aura::Window*>(root)) 125 ->GetDisplayNearestWindow(const_cast<aura::Window*>(root))
128 .bounds() 126 .bounds()
129 .origin(); 127 .origin();
130 point->Offset(display_origin.x(), display_origin.y()); 128 point->Offset(display_origin.x(), display_origin.y());
131 } 129 }
132 130
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (dst_root != window->GetRootWindow()) { 176 if (dst_root != window->GetRootWindow()) {
179 int container_id = window->parent()->id(); 177 int container_id = window->parent()->id();
180 // All containers that uses screen coordinates must have valid window ids. 178 // All containers that uses screen coordinates must have valid window ids.
181 DCHECK_GE(container_id, 0); 179 DCHECK_GE(container_id, 0);
182 // Don't move modal background. 180 // Don't move modal background.
183 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) 181 if (!SystemModalContainerLayoutManager::IsModalBackground(window))
184 dst_container = Shell::GetContainer(dst_root, container_id); 182 dst_container = Shell::GetContainer(dst_root, container_id);
185 } 183 }
186 184
187 if (dst_container && window->parent() != dst_container) { 185 if (dst_container && window->parent() != dst_container) {
188 aura::Window* focused = aura::client::GetFocusClient(window)-> 186 aura::Window* focused =
189 GetFocusedWindow(); 187 aura::client::GetFocusClient(window)->GetFocusedWindow();
190 aura::client::ActivationClient* activation_client = 188 aura::client::ActivationClient* activation_client =
191 aura::client::GetActivationClient(window->GetRootWindow()); 189 aura::client::GetActivationClient(window->GetRootWindow());
192 aura::Window* active = activation_client->GetActiveWindow(); 190 aura::Window* active = activation_client->GetActiveWindow();
193 191
194 aura::WindowTracker tracker; 192 aura::WindowTracker tracker;
195 if (focused) 193 if (focused)
196 tracker.Add(focused); 194 tracker.Add(focused);
197 if (active && focused != active) 195 if (active && focused != active)
198 tracker.Add(active); 196 tracker.Add(active);
199 197
(...skipping 29 matching lines...) Expand all
229 gfx::Point origin(bounds.origin()); 227 gfx::Point origin(bounds.origin());
230 const gfx::Point display_origin = display::Screen::GetScreen() 228 const gfx::Point display_origin = display::Screen::GetScreen()
231 ->GetDisplayNearestWindow(window) 229 ->GetDisplayNearestWindow(window)
232 .bounds() 230 .bounds()
233 .origin(); 231 .origin();
234 origin.Offset(-display_origin.x(), -display_origin.y()); 232 origin.Offset(-display_origin.x(), -display_origin.y());
235 window->SetBounds(gfx::Rect(origin, bounds.size())); 233 window->SetBounds(gfx::Rect(origin, bounds.size()));
236 } 234 }
237 235
238 } // namespace ash 236 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_ash.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698