Chromium Code Reviews| Index: components/mus/ws/window_tree.cc |
| diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc |
| index 863a3a13e61a2095581b0f08fac3b089e39daa76..b275040ca32a030b0f3c6e5fde2e88bca6b21293 100644 |
| --- a/components/mus/ws/window_tree.cc |
| +++ b/components/mus/ws/window_tree.cc |
| @@ -669,6 +669,17 @@ WindowManagerState* WindowTree::GetWindowManagerStateForWindowManager() { |
| return wms; |
| } |
| +WindowManagerState* WindowTree::GetWindowManagerStateForUser() { |
| + // TODO(sky): need a way for client to provide context to figure out display. |
|
sky
2016/04/20 23:46:36
This TODO isn't applicable here.
|
| + Display* display = display_manager()->displays().empty() |
| + ? nullptr |
| + : *(display_manager()->displays().begin()); |
| + // TODO(sky): move checks to accesspolicy. |
|
sky
2016/04/20 23:46:36
This TODO should be in NewTopLevelWindow, not here
|
| + return display && user_id_ != InvalidUserId() |
| + ? display->GetWindowManagerStateForUser(user_id_) |
| + : nullptr; |
| +} |
| + |
| bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { |
| // If the client created this window, then do not route it through the WM. |
| if (window->id().connection_id == id_) |
| @@ -975,15 +986,7 @@ void WindowTree::NewTopLevelWindow( |
| mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { |
| DCHECK(!waiting_for_top_level_window_info_); |
| const ClientWindowId client_window_id(transport_window_id); |
| - // TODO(sky): need a way for client to provide context to figure out display. |
| - Display* display = display_manager()->displays().empty() |
| - ? nullptr |
| - : *(display_manager()->displays().begin()); |
| - // TODO(sky): move checks to accesspolicy. |
| - WindowManagerState* wms = |
| - display && user_id_ != InvalidUserId() |
| - ? display->GetWindowManagerStateForUser(user_id_) |
| - : nullptr; |
| + WindowManagerState* wms = GetWindowManagerStateForUser(); |
| if (!wms || wms->tree() == this || !IsValidIdForNewWindow(client_window_id)) { |
| client()->OnChangeCompleted(change_id, false); |
| return; |
| @@ -1309,6 +1312,12 @@ void WindowTree::GetWindowManagerClient( |
| this, std::move(internal))); |
| } |
| +void WindowTree::GetCursorLocationMemory( |
| + const GetCursorLocationMemoryCallback& callback) { |
| + WindowManagerState* wms = GetWindowManagerStateForUser(); |
| + callback.Run(wms->GetCursorLocationMemory()); |
| +} |
| + |
| void WindowTree::AddAccelerator(uint32_t id, |
| mojom::EventMatcherPtr event_matcher, |
| const AddAcceleratorCallback& callback) { |