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" | 10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 void WindowTreeHostImpl::SetSize(mojo::SizePtr size) { | 229 void WindowTreeHostImpl::SetSize(mojo::SizePtr size) { |
230 display_manager_->SetViewportSize(size.To<gfx::Size>()); | 230 display_manager_->SetViewportSize(size.To<gfx::Size>()); |
231 } | 231 } |
232 | 232 |
233 void WindowTreeHostImpl::SetTitle(const mojo::String& title) { | 233 void WindowTreeHostImpl::SetTitle(const mojo::String& title) { |
234 display_manager_->SetTitle(title.To<base::string16>()); | 234 display_manager_->SetTitle(title.To<base::string16>()); |
235 } | 235 } |
236 | 236 |
237 void WindowTreeHostImpl::AddAccelerator( | |
238 uint32_t id, | |
239 mojom::EventMatcherPtr event_matcher, | |
240 const AddAcceleratorCallback& callback) { | |
241 bool success = event_dispatcher_.AddAccelerator(id, std::move(event_matcher)); | |
242 callback.Run(success); | |
243 } | |
244 | |
245 void WindowTreeHostImpl::RemoveAccelerator(uint32_t id) { | |
246 event_dispatcher_.RemoveAccelerator(id); | |
247 } | |
248 | |
249 void WindowTreeHostImpl::AddActivationParent(Id transport_window_id) { | 237 void WindowTreeHostImpl::AddActivationParent(Id transport_window_id) { |
250 ServerWindow* window = GetWindowFromWindowTreeHost(transport_window_id); | 238 ServerWindow* window = GetWindowFromWindowTreeHost(transport_window_id); |
251 if (window) | 239 if (window) |
252 activation_parents_.insert(window->id()); | 240 activation_parents_.insert(window->id()); |
253 } | 241 } |
254 | 242 |
255 void WindowTreeHostImpl::RemoveActivationParent(Id transport_window_id) { | 243 void WindowTreeHostImpl::RemoveActivationParent(Id transport_window_id) { |
256 ServerWindow* window = GetWindowFromWindowTreeHost(transport_window_id); | 244 ServerWindow* window = GetWindowFromWindowTreeHost(transport_window_id); |
257 if (window) | 245 if (window) |
258 activation_parents_.erase(window->id()); | 246 activation_parents_.erase(window->id()); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 root_tree != embedded_connection_new) { | 499 root_tree != embedded_connection_new) { |
512 root_tree->ProcessFocusChanged(old_focused_window, new_focused_window); | 500 root_tree->ProcessFocusChanged(old_focused_window, new_focused_window); |
513 } | 501 } |
514 | 502 |
515 UpdateTextInputState(new_focused_window, | 503 UpdateTextInputState(new_focused_window, |
516 new_focused_window->text_input_state()); | 504 new_focused_window->text_input_state()); |
517 } | 505 } |
518 | 506 |
519 void WindowTreeHostImpl::OnAccelerator(uint32_t accelerator_id, | 507 void WindowTreeHostImpl::OnAccelerator(uint32_t accelerator_id, |
520 mojom::EventPtr event) { | 508 mojom::EventPtr event) { |
521 client()->OnAccelerator(accelerator_id, std::move(event)); | 509 GetWindowTree()->OnAccelerator(accelerator_id, std::move(event)); |
522 } | 510 } |
523 | 511 |
524 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( | 512 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( |
525 ServerWindow* new_focused_window) { | 513 ServerWindow* new_focused_window) { |
526 SetFocusedWindow(new_focused_window); | 514 SetFocusedWindow(new_focused_window); |
527 } | 515 } |
528 | 516 |
529 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { | 517 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
530 return GetFocusedWindow(); | 518 return GetFocusedWindow(); |
531 } | 519 } |
(...skipping 11 matching lines...) Expand all Loading... |
543 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); | 531 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); |
544 } | 532 } |
545 | 533 |
546 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 534 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
547 windows_needing_frame_destruction_.erase(window); | 535 windows_needing_frame_destruction_.erase(window); |
548 window->RemoveObserver(this); | 536 window->RemoveObserver(this); |
549 } | 537 } |
550 | 538 |
551 } // namespace ws | 539 } // namespace ws |
552 } // namespace mus | 540 } // namespace mus |
OLD | NEW |