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