Chromium Code Reviews| 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.h" | 5 #include "components/mus/ws/window_tree.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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "components/mus/ws/default_access_policy.h" | 13 #include "components/mus/ws/default_access_policy.h" |
| 14 #include "components/mus/ws/display.h" | 14 #include "components/mus/ws/display.h" |
| 15 #include "components/mus/ws/display_manager.h" | 15 #include "components/mus/ws/display_manager.h" |
| 16 #include "components/mus/ws/focus_controller.h" | 16 #include "components/mus/ws/focus_controller.h" |
| 17 #include "components/mus/ws/operation.h" | 17 #include "components/mus/ws/operation.h" |
| 18 #include "components/mus/ws/platform_display.h" | 18 #include "components/mus/ws/platform_display.h" |
| 19 #include "components/mus/ws/server_window.h" | 19 #include "components/mus/ws/server_window.h" |
| 20 #include "components/mus/ws/server_window_observer.h" | 20 #include "components/mus/ws/server_window_observer.h" |
| 21 #include "components/mus/ws/user_display_manager.h" | |
| 21 #include "components/mus/ws/window_manager_state.h" | 22 #include "components/mus/ws/window_manager_state.h" |
| 22 #include "components/mus/ws/window_server.h" | 23 #include "components/mus/ws/window_server.h" |
| 23 #include "components/mus/ws/window_tree_binding.h" | 24 #include "components/mus/ws/window_tree_binding.h" |
| 24 #include "mojo/converters/geometry/geometry_type_converters.h" | 25 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 25 #include "mojo/converters/ime/ime_type_converters.h" | 26 #include "mojo/converters/ime/ime_type_converters.h" |
| 26 #include "mojo/converters/input_events/input_events_type_converters.h" | 27 #include "mojo/converters/input_events/input_events_type_converters.h" |
| 27 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 28 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 28 #include "ui/platform_window/text_input_state.h" | 29 #include "ui/platform_window/text_input_state.h" |
| 29 | 30 |
| 30 using mojo::Array; | 31 using mojo::Array; |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 DCHECK(window_manager_internal_); | 663 DCHECK(window_manager_internal_); |
| 663 | 664 |
| 664 WindowManagerState* wms = display_manager() | 665 WindowManagerState* wms = display_manager() |
| 665 ->GetWindowManagerAndDisplay(*roots_.begin()) | 666 ->GetWindowManagerAndDisplay(*roots_.begin()) |
| 666 .window_manager_state; | 667 .window_manager_state; |
| 667 CHECK(wms); | 668 CHECK(wms); |
| 668 DCHECK_EQ(this, wms->tree()); | 669 DCHECK_EQ(this, wms->tree()); |
| 669 return wms; | 670 return wms; |
| 670 } | 671 } |
| 671 | 672 |
| 673 void WindowTree::GetCursorScreenPoint( | |
| 674 const GetCursorScreenPointCallback& callback) { | |
| 675 if (roots_.empty()) { | |
|
Elliot Glaysher
2016/04/18 20:21:37
Is this empty roots thing a case we reasonably hav
sky
2016/04/18 20:53:05
Yes. It should be possible to query for the cursor
| |
| 676 mojo::PointPtr p = mojo::Point::New(); | |
| 677 p->x = 0; | |
| 678 p->y = 0; | |
| 679 callback.Run(std::move(p)); | |
| 680 } else { | |
| 681 callback.Run(mojo::Point::From( | |
| 682 GetWindowManagerState(*roots_.begin())->GetCursorLocation())); | |
| 683 } | |
| 684 } | |
| 685 | |
| 672 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { | 686 bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { |
| 673 // If the client created this window, then do not route it through the WM. | 687 // If the client created this window, then do not route it through the WM. |
| 674 if (window->id().connection_id == id_) | 688 if (window->id().connection_id == id_) |
| 675 return false; | 689 return false; |
| 676 | 690 |
| 677 // If the client did not create the window, then it must be the root of the | 691 // If the client did not create the window, then it must be the root of the |
| 678 // client. If not, that means the client should not know about this window, | 692 // client. If not, that means the client should not know about this window, |
| 679 // and so do not route the request to the WM. | 693 // and so do not route the request to the WM. |
| 680 if (roots_.count(window) == 0) | 694 if (roots_.count(window) == 0) |
| 681 return false; | 695 return false; |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 } | 1423 } |
| 1410 | 1424 |
| 1411 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1425 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1412 const ServerWindow* window) const { | 1426 const ServerWindow* window) const { |
| 1413 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1427 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1414 return tree && tree != this; | 1428 return tree && tree != this; |
| 1415 } | 1429 } |
| 1416 | 1430 |
| 1417 } // namespace ws | 1431 } // namespace ws |
| 1418 } // namespace mus | 1432 } // namespace mus |
| OLD | NEW |