| 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 "components/mus/ws/window_tree_impl.h" | 5 #include "components/mus/ws/window_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (window && transient_window && !transient_window->Contains(window) && | 221 if (window && transient_window && !transient_window->Contains(window) && |
| 222 access_policy_->CanAddTransientWindow(window, transient_window)) { | 222 access_policy_->CanAddTransientWindow(window, transient_window)) { |
| 223 Operation op(this, connection_manager_, | 223 Operation op(this, connection_manager_, |
| 224 OperationType::ADD_TRANSIENT_WINDOW); | 224 OperationType::ADD_TRANSIENT_WINDOW); |
| 225 window->AddTransientWindow(transient_window); | 225 window->AddTransientWindow(transient_window); |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 return false; | 228 return false; |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool WindowTreeImpl::SetAsModal(const ClientWindowId& window_id) { |
| 232 ServerWindow* window = GetWindowByClientId(window_id); |
| 233 if (window && access_policy_->CanSetAsModal(window)) { |
| 234 window->SetAsModal(); |
| 235 return true; |
| 236 } |
| 237 return false; |
| 238 } |
| 239 |
| 231 std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree( | 240 std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree( |
| 232 const ClientWindowId& window_id) const { | 241 const ClientWindowId& window_id) const { |
| 233 const ServerWindow* window = GetWindowByClientId(window_id); | 242 const ServerWindow* window = GetWindowByClientId(window_id); |
| 234 std::vector<const ServerWindow*> windows; | 243 std::vector<const ServerWindow*> windows; |
| 235 if (window) | 244 if (window) |
| 236 GetWindowTreeImpl(window, &windows); | 245 GetWindowTreeImpl(window, &windows); |
| 237 return windows; | 246 return windows; |
| 238 } | 247 } |
| 239 | 248 |
| 240 bool WindowTreeImpl::SetWindowVisibility(const ClientWindowId& window_id, | 249 bool WindowTreeImpl::SetWindowVisibility(const ClientWindowId& window_id, |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 access_policy_->CanRemoveTransientWindowFromParent(transient_window)) { | 982 access_policy_->CanRemoveTransientWindowFromParent(transient_window)) { |
| 974 success = true; | 983 success = true; |
| 975 Operation op(this, connection_manager_, | 984 Operation op(this, connection_manager_, |
| 976 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); | 985 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); |
| 977 transient_window->transient_parent()->RemoveTransientWindow( | 986 transient_window->transient_parent()->RemoveTransientWindow( |
| 978 transient_window); | 987 transient_window); |
| 979 } | 988 } |
| 980 client_->OnChangeCompleted(change_id, success); | 989 client_->OnChangeCompleted(change_id, success); |
| 981 } | 990 } |
| 982 | 991 |
| 992 void WindowTreeImpl::SetAsModal(uint32_t change_id, Id window_id) { |
| 993 client_->OnChangeCompleted(change_id, SetAsModal(ClientWindowId(window_id))); |
| 994 } |
| 995 |
| 983 void WindowTreeImpl::ReorderWindow(uint32_t change_id, | 996 void WindowTreeImpl::ReorderWindow(uint32_t change_id, |
| 984 Id window_id, | 997 Id window_id, |
| 985 Id relative_window_id, | 998 Id relative_window_id, |
| 986 mojom::OrderDirection direction) { | 999 mojom::OrderDirection direction) { |
| 987 bool success = false; | 1000 bool success = false; |
| 988 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1001 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
| 989 ServerWindow* relative_window = | 1002 ServerWindow* relative_window = |
| 990 GetWindowByClientId(ClientWindowId(relative_window_id)); | 1003 GetWindowByClientId(ClientWindowId(relative_window_id)); |
| 991 if (CanReorderWindow(window, relative_window, direction)) { | 1004 if (CanReorderWindow(window, relative_window, direction)) { |
| 992 success = true; | 1005 success = true; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1378 |
| 1366 for (const auto* root : roots_) { | 1379 for (const auto* root : roots_) { |
| 1367 if (root->Contains(window)) | 1380 if (root->Contains(window)) |
| 1368 return true; | 1381 return true; |
| 1369 } | 1382 } |
| 1370 return false; | 1383 return false; |
| 1371 } | 1384 } |
| 1372 | 1385 |
| 1373 } // namespace ws | 1386 } // namespace ws |
| 1374 } // namespace mus | 1387 } // namespace mus |
| OLD | NEW |