OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #include "base/logging.h" |
| 6 #include "base/process/process.h" |
| 7 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 8 #include "mojo/converters/ozone_drm_gpu/ozone_drm_gpu_type_converters.h" |
| 9 #include "services/native_viewport/ozone/ozone_drm_host_impl.h" |
| 10 #include "ui/ozone/public/ozone_platform.h" |
| 11 |
| 12 namespace native_viewport { |
| 13 |
| 14 OzoneDrmHostImpl::OzoneDrmHostImpl( |
| 15 mojo::InterfaceRequest<mojo::OzoneDrmHost> request, |
| 16 const mojo::OzoneDrmGpuPtr& ozone_drm_gpu) |
| 17 : binding_(this, request.Pass()), |
| 18 ozone_drm_gpu_(ozone_drm_gpu), |
| 19 platform_support_(static_cast<ui::DrmGpuPlatformSupportHost*>( |
| 20 ui::OzonePlatform::GetInstance() |
| 21 ->GetGpuPlatformSupportHost())) { |
| 22 platform_support_->SetDelegate(this); |
| 23 platform_support_->OnChannelEstablished(base::Process::Current().Pid()); |
| 24 } |
| 25 |
| 26 OzoneDrmHostImpl::~OzoneDrmHostImpl() {} |
| 27 |
| 28 void OzoneDrmHostImpl::UpdateNativeDisplays( |
| 29 mojo::Array<mojo::DisplaySnapshotPtr> displays) { |
| 30 platform_support_->get_display_manager()->OnUpdateNativeDisplays( |
| 31 displays.To<std::vector<ui::DisplaySnapshot_Params>>()); |
| 32 } |
| 33 |
| 34 void OzoneDrmHostImpl::DisplayConfigured(int64_t id, bool result) { |
| 35 platform_support_->get_display_manager()->OnDisplayConfigured(id, result); |
| 36 } |
| 37 |
| 38 void OzoneDrmHostImpl::CreateWindow(const gfx::AcceleratedWidget& widget) { |
| 39 ozone_drm_gpu_->CreateWindow(widget); |
| 40 } |
| 41 |
| 42 void OzoneDrmHostImpl::WindowBoundsChanged(const gfx::AcceleratedWidget& widget, |
| 43 const gfx::Rect& bounds) { |
| 44 ozone_drm_gpu_->WindowBoundsChanged(widget, mojo::Rect::From(bounds)); |
| 45 } |
| 46 |
| 47 void OzoneDrmHostImpl::AddGraphicsDevice(const base::FilePath& path, |
| 48 const base::FileDescriptor& fd) { |
| 49 ozone_drm_gpu_->AddGraphicsDevice(path.value(), fd.fd); |
| 50 } |
| 51 |
| 52 bool OzoneDrmHostImpl::RefreshNativeDisplays() { |
| 53 ozone_drm_gpu_->RefreshNativeDisplays(); |
| 54 return true; |
| 55 } |
| 56 |
| 57 bool OzoneDrmHostImpl::ConfigureNativeDisplay( |
| 58 int64_t id, |
| 59 const ui::DisplayMode_Params& mode, |
| 60 const gfx::Point& originhost) { |
| 61 ozone_drm_gpu_->ConfigureNativeDisplay( |
| 62 id, mojo::DisplayMode::From<ui::DisplayMode_Params>(mode), |
| 63 mojo::Point::From(originhost)); |
| 64 return true; |
| 65 } |
| 66 |
| 67 } // namespace |
OLD | NEW |