OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/ws/window_server_test_impl.h" | 5 #include "services/ui/ws/window_server_test_impl.h" |
6 | 6 |
7 #include "services/ui/public/interfaces/window_tree.mojom.h" | 7 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 8 #include "services/ui/ws/display.h" |
| 9 #include "services/ui/ws/display_manager.h" |
8 #include "services/ui/ws/server_window.h" | 10 #include "services/ui/ws/server_window.h" |
9 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" | 11 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
10 #include "services/ui/ws/window_server.h" | 12 #include "services/ui/ws/window_server.h" |
11 #include "services/ui/ws/window_tree.h" | 13 #include "services/ui/ws/window_tree.h" |
12 | 14 |
13 namespace ui { | 15 namespace ui { |
14 namespace ws { | 16 namespace ws { |
15 | 17 |
16 WindowServerTestImpl::WindowServerTestImpl(WindowServer* window_server) | 18 WindowServerTestImpl::WindowServerTestImpl(WindowServer* window_server) |
17 : window_server_(window_server) {} | 19 : window_server_(window_server) {} |
(...skipping 24 matching lines...) Expand all Loading... |
42 return; | 44 return; |
43 } | 45 } |
44 } | 46 } |
45 } | 47 } |
46 | 48 |
47 window_server_->SetPaintCallback( | 49 window_server_->SetPaintCallback( |
48 base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this), | 50 base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this), |
49 client_name, std::move(callback))); | 51 client_name, std::move(callback))); |
50 } | 52 } |
51 | 53 |
| 54 void WindowServerTestImpl::DispatchEvent(int64_t display_id, |
| 55 std::unique_ptr<ui::Event> event, |
| 56 const DispatchEventCallback& cb) { |
| 57 DisplayManager* manager = window_server_->display_manager(); |
| 58 if (!manager) { |
| 59 DVLOG(1) << "No display manager in DispatchEvent."; |
| 60 cb.Run(false); |
| 61 return; |
| 62 } |
| 63 |
| 64 Display* display = manager->GetDisplayById(display_id); |
| 65 if (!display) { |
| 66 DVLOG(1) << "Invalid display_id in DispatchEvent."; |
| 67 cb.Run(false); |
| 68 return; |
| 69 } |
| 70 |
| 71 static_cast<PlatformDisplayDelegate*>(display)->OnEvent(*event.get()); |
| 72 cb.Run(true); |
| 73 } |
| 74 |
52 } // namespace ws | 75 } // namespace ws |
53 } // namespace ui | 76 } // namespace ui |
OLD | NEW |