| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/ws/window_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return false; | 150 return false; |
| 151 if (id) | 151 if (id) |
| 152 *id = iter->second; | 152 *id = iter->second; |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool WindowTree::HasRoot(const ServerWindow* window) const { | 156 bool WindowTree::HasRoot(const ServerWindow* window) const { |
| 157 return roots_.count(window) > 0; | 157 return roots_.count(window) > 0; |
| 158 } | 158 } |
| 159 | 159 |
| 160 const ServerWindow* WindowTree::FindRootFor(const ServerWindow* window) const { |
| 161 for (const ServerWindow* parent = window; parent; parent = parent->parent()) { |
| 162 if (roots_.count(parent)) |
| 163 return parent; |
| 164 } |
| 165 return nullptr; |
| 166 } |
| 167 |
| 160 const ServerWindow* WindowTree::GetWindowByClientId( | 168 const ServerWindow* WindowTree::GetWindowByClientId( |
| 161 const ClientWindowId& id) const { | 169 const ClientWindowId& id) const { |
| 162 auto iter = client_id_to_window_id_map_.find(id); | 170 auto iter = client_id_to_window_id_map_.find(id); |
| 163 return iter == client_id_to_window_id_map_.end() ? nullptr | 171 return iter == client_id_to_window_id_map_.end() ? nullptr |
| 164 : GetWindow(iter->second); | 172 : GetWindow(iter->second); |
| 165 } | 173 } |
| 166 | 174 |
| 167 const Display* WindowTree::GetDisplay(const ServerWindow* window) const { | 175 const Display* WindowTree::GetDisplay(const ServerWindow* window) const { |
| 168 return window ? display_manager()->GetDisplayContaining(window) : nullptr; | 176 return window ? display_manager()->GetDisplayContaining(window) : nullptr; |
| 169 } | 177 } |
| (...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2187 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2180 effect_bitmask, callback); | 2188 effect_bitmask, callback); |
| 2181 } | 2189 } |
| 2182 | 2190 |
| 2183 void WindowTree::PerformOnDragDropDone() { | 2191 void WindowTree::PerformOnDragDropDone() { |
| 2184 client()->OnDragDropDone(); | 2192 client()->OnDragDropDone(); |
| 2185 } | 2193 } |
| 2186 | 2194 |
| 2187 } // namespace ws | 2195 } // namespace ws |
| 2188 } // namespace ui | 2196 } // namespace ui |
| OLD | NEW |