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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 bounds_(bounds), | 40 bounds_(bounds), |
41 widget_(window_manager->NextAcceleratedWidget()) { | 41 widget_(window_manager->NextAcceleratedWidget()) { |
42 window_manager_->AddWindow(widget_, this); | 42 window_manager_->AddWindow(widget_, this); |
43 } | 43 } |
44 | 44 |
45 DrmWindowHost::~DrmWindowHost() { | 45 DrmWindowHost::~DrmWindowHost() { |
46 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 46 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
47 window_manager_->RemoveWindow(widget_); | 47 window_manager_->RemoveWindow(widget_); |
48 cursor_->OnWindowRemoved(widget_); | 48 cursor_->OnWindowRemoved(widget_); |
49 | 49 |
50 sender_->RemoveChannelObserver(this); | 50 sender_->RemoveGpuThreadObserver(this); |
51 sender_->Send(new OzoneGpuMsg_DestroyWindow(widget_)); | 51 sender_->Send(new OzoneGpuMsg_DestroyWindow(widget_)); |
52 } | 52 } |
53 | 53 |
54 void DrmWindowHost::Initialize() { | 54 void DrmWindowHost::Initialize() { |
55 sender_->AddChannelObserver(this); | 55 sender_->AddGpuThreadObserver(this); |
56 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 56 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
57 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); | 57 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); |
58 delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); | 58 delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); |
59 } | 59 } |
60 | 60 |
61 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { | 61 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { |
62 return widget_; | 62 return widget_; |
63 } | 63 } |
64 | 64 |
65 gfx::Rect DrmWindowHost::GetCursorConfinedBounds() const { | 65 gfx::Rect DrmWindowHost::GetCursorConfinedBounds() const { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 location -= gfx::Vector2dF(bounds_.OffsetFromOrigin()); | 181 location -= gfx::Vector2dF(bounds_.OffsetFromOrigin()); |
182 located_event->set_location_f(location); | 182 located_event->set_location_f(location); |
183 located_event->set_root_location_f(location); | 183 located_event->set_root_location_f(location); |
184 } | 184 } |
185 DispatchEventFromNativeUiEvent( | 185 DispatchEventFromNativeUiEvent( |
186 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, | 186 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, |
187 base::Unretained(delegate_))); | 187 base::Unretained(delegate_))); |
188 return POST_DISPATCH_STOP_PROPAGATION; | 188 return POST_DISPATCH_STOP_PROPAGATION; |
189 } | 189 } |
190 | 190 |
191 void DrmWindowHost::OnChannelEstablished() { | 191 void DrmWindowHost::OnGpuThreadReady() { |
192 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); | 192 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); |
193 SendBoundsChange(); | 193 SendBoundsChange(); |
194 } | 194 } |
195 | 195 |
196 void DrmWindowHost::OnChannelDestroyed() { | 196 void DrmWindowHost::OnGpuThreadRetired() {} |
197 } | |
198 | 197 |
199 void DrmWindowHost::SendBoundsChange() { | 198 void DrmWindowHost::SendBoundsChange() { |
200 // Update the cursor before the window so that the cursor stays within the | 199 // Update the cursor before the window so that the cursor stays within the |
201 // window bounds when the window size shrinks. | 200 // window bounds when the window size shrinks. |
202 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); | 201 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); |
203 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); | 202 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); |
204 | 203 |
205 overlay_manager_->ResetCache(); | 204 overlay_manager_->ResetCache(); |
206 } | 205 } |
207 | 206 |
208 } // namespace ui | 207 } // namespace ui |
OLD | NEW |