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 widget_(window_manager->NextAcceleratedWidget()) { | 40 widget_(window_manager->NextAcceleratedWidget()) { |
41 window_manager_->AddWindow(widget_, this); | 41 window_manager_->AddWindow(widget_, this); |
42 } | 42 } |
43 | 43 |
44 DrmWindowHost::~DrmWindowHost() { | 44 DrmWindowHost::~DrmWindowHost() { |
45 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 45 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
46 window_manager_->RemoveWindow(widget_); | 46 window_manager_->RemoveWindow(widget_); |
47 cursor_->OnWindowRemoved(widget_); | 47 cursor_->OnWindowRemoved(widget_); |
48 | 48 |
49 sender_->RemoveChannelObserver(this); | 49 sender_->RemoveChannelObserver(this); |
50 sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); | 50 sender_->Send(new OzoneGpuMsg_DestroyWindow(widget_)); |
51 } | 51 } |
52 | 52 |
53 void DrmWindowHost::Initialize() { | 53 void DrmWindowHost::Initialize() { |
54 sender_->AddChannelObserver(this); | 54 sender_->AddChannelObserver(this); |
55 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 55 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
56 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); | 56 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); |
57 delegate_->OnAcceleratedWidgetAvailable(widget_); | 57 delegate_->OnAcceleratedWidgetAvailable(widget_); |
58 } | 58 } |
59 | 59 |
60 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { | 60 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 located_event->set_location(location); | 174 located_event->set_location(location); |
175 located_event->set_root_location(location); | 175 located_event->set_root_location(location); |
176 } | 176 } |
177 DispatchEventFromNativeUiEvent( | 177 DispatchEventFromNativeUiEvent( |
178 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, | 178 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, |
179 base::Unretained(delegate_))); | 179 base::Unretained(delegate_))); |
180 return POST_DISPATCH_STOP_PROPAGATION; | 180 return POST_DISPATCH_STOP_PROPAGATION; |
181 } | 181 } |
182 | 182 |
183 void DrmWindowHost::OnChannelEstablished() { | 183 void DrmWindowHost::OnChannelEstablished() { |
184 sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); | 184 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); |
185 SendBoundsChange(); | 185 SendBoundsChange(); |
186 } | 186 } |
187 | 187 |
188 void DrmWindowHost::OnChannelDestroyed() { | 188 void DrmWindowHost::OnChannelDestroyed() { |
189 } | 189 } |
190 | 190 |
191 void DrmWindowHost::SendBoundsChange() { | 191 void DrmWindowHost::SendBoundsChange() { |
192 // Update the cursor before the window so that the cursor stays within the | 192 // Update the cursor before the window so that the cursor stays within the |
193 // window bounds when the window size shrinks. | 193 // window bounds when the window size shrinks. |
194 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); | 194 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); |
195 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); | 195 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); |
196 } | 196 } |
197 | 197 |
198 } // namespace ui | 198 } // namespace ui |
OLD | NEW |