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 "ui/ozone/platform/drm/host/drm_window_host.h" | 5 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/events/devices/device_data_manager.h" | 8 #include "ui/events/devices/device_data_manager.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 10 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
11 #include "ui/events/ozone/events_ozone.h" | 11 #include "ui/events/ozone/events_ozone.h" |
12 #include "ui/events/platform/platform_event_source.h" | 12 #include "ui/events/platform/platform_event_source.h" |
13 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
14 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 14 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
15 #include "ui/ozone/platform/drm/host/drm_cursor.h" | 15 #include "ui/ozone/platform/drm/host/drm_cursor.h" |
16 #include "ui/ozone/platform/drm/host/drm_display_host.h" | 16 #include "ui/ozone/platform/drm/host/drm_display_host.h" |
17 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" | 17 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
18 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" | 18 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" |
19 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h" | 19 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" |
20 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" | 20 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" |
21 #include "ui/platform_window/platform_window_delegate.h" | 21 #include "ui/platform_window/platform_window_delegate.h" |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 | 24 |
25 DrmWindowHost::DrmWindowHost(PlatformWindowDelegate* delegate, | 25 DrmWindowHost::DrmWindowHost(PlatformWindowDelegate* delegate, |
26 const gfx::Rect& bounds, | 26 const gfx::Rect& bounds, |
27 DrmGpuPlatformSupportHost* sender, | 27 DrmGpuPlatformSupportHost* sender, |
28 EventFactoryEvdev* event_factory, | 28 EventFactoryEvdev* event_factory, |
29 DrmCursor* cursor, | 29 DrmCursor* cursor, |
30 DrmWindowHostManager* window_manager, | 30 DrmWindowHostManager* window_manager, |
31 DrmDisplayHostManager* display_manager) | 31 DrmDisplayHostManager* display_manager, |
| 32 DrmOverlayManager* overlay_manager) |
32 : delegate_(delegate), | 33 : delegate_(delegate), |
33 sender_(sender), | 34 sender_(sender), |
34 event_factory_(event_factory), | 35 event_factory_(event_factory), |
35 cursor_(cursor), | 36 cursor_(cursor), |
36 window_manager_(window_manager), | 37 window_manager_(window_manager), |
37 display_manager_(display_manager), | 38 display_manager_(display_manager), |
38 overlay_candidates_host_(nullptr), | 39 overlay_manager_(overlay_manager), |
39 bounds_(bounds), | 40 bounds_(bounds), |
40 widget_(window_manager->NextAcceleratedWidget()) { | 41 widget_(window_manager->NextAcceleratedWidget()) { |
41 window_manager_->AddWindow(widget_, this); | 42 window_manager_->AddWindow(widget_, this); |
42 } | 43 } |
43 | 44 |
44 DrmWindowHost::~DrmWindowHost() { | 45 DrmWindowHost::~DrmWindowHost() { |
45 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 46 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
46 window_manager_->RemoveWindow(widget_); | 47 window_manager_->RemoveWindow(widget_); |
47 cursor_->OnWindowRemoved(widget_); | 48 cursor_->OnWindowRemoved(widget_); |
48 | 49 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 189 } |
189 | 190 |
190 void DrmWindowHost::OnChannelEstablished() { | 191 void DrmWindowHost::OnChannelEstablished() { |
191 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); | 192 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); |
192 SendBoundsChange(); | 193 SendBoundsChange(); |
193 } | 194 } |
194 | 195 |
195 void DrmWindowHost::OnChannelDestroyed() { | 196 void DrmWindowHost::OnChannelDestroyed() { |
196 } | 197 } |
197 | 198 |
198 void DrmWindowHost::SetOverlayCandidatesHost( | |
199 DrmOverlayCandidatesHostCore* host) { | |
200 overlay_candidates_host_ = host; | |
201 } | |
202 | |
203 void DrmWindowHost::SendBoundsChange() { | 199 void DrmWindowHost::SendBoundsChange() { |
204 // Update the cursor before the window so that the cursor stays within the | 200 // Update the cursor before the window so that the cursor stays within the |
205 // window bounds when the window size shrinks. | 201 // window bounds when the window size shrinks. |
206 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); | 202 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); |
207 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); | 203 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); |
208 | 204 |
209 if (overlay_candidates_host_) | 205 overlay_manager_->ResetCache(); |
210 overlay_candidates_host_->ResetCache(); | |
211 } | 206 } |
212 | 207 |
213 } // namespace ui | 208 } // namespace ui |
OLD | NEW |