| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_host_impl.h" | 5 #include "components/mus/ws/window_tree_host_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/mus/common/types.h" | 9 #include "components/mus/common/types.h" |
| 10 // #include "components/mus/public/interfaces/input_event_constants.mojom.h" | |
| 11 #include "components/mus/ws/client_connection.h" | 10 #include "components/mus/ws/client_connection.h" |
| 12 #include "components/mus/ws/connection_manager.h" | 11 #include "components/mus/ws/connection_manager.h" |
| 13 #include "components/mus/ws/connection_manager_delegate.h" | 12 #include "components/mus/ws/connection_manager_delegate.h" |
| 14 #include "components/mus/ws/display_manager.h" | 13 #include "components/mus/ws/display_manager.h" |
| 15 #include "components/mus/ws/focus_controller.h" | 14 #include "components/mus/ws/focus_controller.h" |
| 16 #include "components/mus/ws/window_manager_factory_service.h" | 15 #include "components/mus/ws/window_manager_factory_service.h" |
| 17 #include "components/mus/ws/window_manager_state.h" | 16 #include "components/mus/ws/window_manager_state.h" |
| 18 #include "components/mus/ws/window_tree_host_connection.h" | 17 #include "components/mus/ws/window_tree_host_connection.h" |
| 19 #include "components/mus/ws/window_tree_impl.h" | 18 #include "components/mus/ws/window_tree_impl.h" |
| 20 #include "mojo/common/common_type_converters.h" | 19 #include "mojo/common/common_type_converters.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 event_ack_timer_.Start(FROM_HERE, max_delay, this, | 367 event_ack_timer_.Start(FROM_HERE, max_delay, this, |
| 369 &WindowTreeHostImpl::OnEventAckTimeout); | 368 &WindowTreeHostImpl::OnEventAckTimeout); |
| 370 | 369 |
| 371 tree_awaiting_input_ack_ = connection; | 370 tree_awaiting_input_ack_ = connection; |
| 372 connection->DispatchInputEvent(target, mojom::Event::From(event)); | 371 connection->DispatchInputEvent(target, mojom::Event::From(event)); |
| 373 } | 372 } |
| 374 | 373 |
| 375 void WindowTreeHostImpl::CreateWindowManagerStatesFromRegistry() { | 374 void WindowTreeHostImpl::CreateWindowManagerStatesFromRegistry() { |
| 376 std::vector<WindowManagerFactoryService*> services = | 375 std::vector<WindowManagerFactoryService*> services = |
| 377 connection_manager_->window_manager_factory_registry()->GetServices(); | 376 connection_manager_->window_manager_factory_registry()->GetServices(); |
| 378 mojom::DisplayPtr display = connection_manager_->DisplayForHost(this); | |
| 379 for (WindowManagerFactoryService* service : services) { | 377 for (WindowManagerFactoryService* service : services) { |
| 380 scoped_ptr<WindowManagerState> wms_ptr( | 378 scoped_ptr<WindowManagerState> wms_ptr( |
| 381 new WindowManagerState(this, service->user_id())); | 379 new WindowManagerState(this, service->user_id())); |
| 382 WindowManagerState* wms = wms_ptr.get(); | 380 WindowManagerState* wms = wms_ptr.get(); |
| 383 window_manager_state_map_[service->user_id()] = std::move(wms_ptr); | 381 window_manager_state_map_[service->user_id()] = std::move(wms_ptr); |
| 384 ClientConnection* client_connection = | 382 wms->tree_ = connection_manager_->CreateTreeForWindowManager( |
| 385 connection_manager_->delegate()->CreateClientConnectionForWindowManager( | 383 this, service->window_manager_factory(), wms->root()); |
| 386 this, wms->root(), *display, service->user_id(), | |
| 387 service->window_manager_factory()); | |
| 388 client_connection->service()->ConfigureWindowManager(); | |
| 389 wms->tree_ = client_connection->service(); | |
| 390 } | 384 } |
| 391 } | 385 } |
| 392 | 386 |
| 393 void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) { | 387 void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) { |
| 394 if (cursor_id != last_cursor_) { | 388 if (cursor_id != last_cursor_) { |
| 395 display_manager_->SetCursorById(cursor_id); | 389 display_manager_->SetCursorById(cursor_id); |
| 396 last_cursor_ = cursor_id; | 390 last_cursor_ = cursor_id; |
| 397 } | 391 } |
| 398 } | 392 } |
| 399 | 393 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); | 600 DispatchInputEventToWindowImpl(target, in_nonclient_area, event); |
| 607 } | 601 } |
| 608 | 602 |
| 609 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 603 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
| 610 windows_needing_frame_destruction_.erase(window); | 604 windows_needing_frame_destruction_.erase(window); |
| 611 window->RemoveObserver(this); | 605 window->RemoveObserver(this); |
| 612 } | 606 } |
| 613 | 607 |
| 614 } // namespace ws | 608 } // namespace ws |
| 615 } // namespace mus | 609 } // namespace mus |
| OLD | NEW |