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
3 // found in the LICENSE file.
5 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h"
7 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
8 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h"
12 DriWindowDelegateProxy::DriWindowDelegateProxy(
13 gfx::AcceleratedWidget widget,
14 GpuPlatformSupportHostGbm* sender)
15 : widget_(widget), sender_(sender) {
18 DriWindowDelegateProxy::~DriWindowDelegateProxy() {
21 void DriWindowDelegateProxy::Initialize() {
22 TRACE_EVENT1("dri", "DriWindowDelegateProxy::Initialize", "widget", widget_);
23 sender_->AddChannelObserver(this);
26 void DriWindowDelegateProxy::Shutdown() {
27 TRACE_EVENT1("dri", "DriWindowDelegateProxy::Shutdown", "widget", widget_);
28 sender_->RemoveChannelObserver(this);
29 if (!sender_->IsConnected())
32 bool status = sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_));
36 gfx::AcceleratedWidget DriWindowDelegateProxy::GetAcceleratedWidget() {
40 HardwareDisplayController* DriWindowDelegateProxy::GetController() {
45 void DriWindowDelegateProxy::OnBoundsChanged(const gfx::Rect& bounds) {
47 "DriWindowDelegateProxy::OnBoundsChanged",
53 if (!sender_->IsConnected())
57 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds));
61 void DriWindowDelegateProxy::OnChannelEstablished() {
63 "dri", "DriWindowDelegateProxy::OnChannelEstablished", "widget", widget_);
64 bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_));
66 OnBoundsChanged(bounds_);
69 void DriWindowDelegateProxy::OnChannelDestroyed() {
71 "dri", "DriWindowDelegateProxy::OnChannelDestroyed", "widget", widget_);