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); | |
sky
2016/03/02 18:28:33
Add to the access policy where this operation is a
mohsen
2016/03/03 22:54:59
Added to the access policy. However, do we also ne
sky
2016/03/03 23:50:39
Seems like we want clients making any random windo
mohsen
2016/03/04 16:24:17
I see. I plan to implement modal systems in a foll
| |
233 if (window) { | |
234 Operation op(this, connection_manager_, OperationType::SET_AS_MODAL); | |
sky
2016/03/02 18:28:33
As you don't send any sort of notification out you
mohsen
2016/03/03 22:54:59
Right. Removed.
| |
235 window->SetAsModal(); | |
236 return true; | |
237 } | |
238 return false; | |
239 } | |
240 | |
231 std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree( | 241 std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree( |
232 const ClientWindowId& window_id) const { | 242 const ClientWindowId& window_id) const { |
233 const ServerWindow* window = GetWindowByClientId(window_id); | 243 const ServerWindow* window = GetWindowByClientId(window_id); |
234 std::vector<const ServerWindow*> windows; | 244 std::vector<const ServerWindow*> windows; |
235 if (window) | 245 if (window) |
236 GetWindowTreeImpl(window, &windows); | 246 GetWindowTreeImpl(window, &windows); |
237 return windows; | 247 return windows; |
238 } | 248 } |
239 | 249 |
240 bool WindowTreeImpl::SetWindowVisibility(const ClientWindowId& window_id, | 250 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)) { | 983 access_policy_->CanRemoveTransientWindowFromParent(transient_window)) { |
974 success = true; | 984 success = true; |
975 Operation op(this, connection_manager_, | 985 Operation op(this, connection_manager_, |
976 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); | 986 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); |
977 transient_window->transient_parent()->RemoveTransientWindow( | 987 transient_window->transient_parent()->RemoveTransientWindow( |
978 transient_window); | 988 transient_window); |
979 } | 989 } |
980 client_->OnChangeCompleted(change_id, success); | 990 client_->OnChangeCompleted(change_id, success); |
981 } | 991 } |
982 | 992 |
993 void WindowTreeImpl::SetAsModal(uint32_t change_id, Id window_id) { | |
994 client_->OnChangeCompleted(change_id, SetAsModal(ClientWindowId(window_id))); | |
995 } | |
996 | |
983 void WindowTreeImpl::ReorderWindow(uint32_t change_id, | 997 void WindowTreeImpl::ReorderWindow(uint32_t change_id, |
984 Id window_id, | 998 Id window_id, |
985 Id relative_window_id, | 999 Id relative_window_id, |
986 mojom::OrderDirection direction) { | 1000 mojom::OrderDirection direction) { |
987 bool success = false; | 1001 bool success = false; |
988 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1002 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
989 ServerWindow* relative_window = | 1003 ServerWindow* relative_window = |
990 GetWindowByClientId(ClientWindowId(relative_window_id)); | 1004 GetWindowByClientId(ClientWindowId(relative_window_id)); |
991 if (CanReorderWindow(window, relative_window, direction)) { | 1005 if (CanReorderWindow(window, relative_window, direction)) { |
992 success = true; | 1006 success = true; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1365 | 1379 |
1366 for (const auto* root : roots_) { | 1380 for (const auto* root : roots_) { |
1367 if (root->Contains(window)) | 1381 if (root->Contains(window)) |
1368 return true; | 1382 return true; |
1369 } | 1383 } |
1370 return false; | 1384 return false; |
1371 } | 1385 } |
1372 | 1386 |
1373 } // namespace ws | 1387 } // namespace ws |
1374 } // namespace mus | 1388 } // namespace mus |
OLD | NEW |