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.
5 #include "chromecast/ozone/ozone_platform_cast.h"
7 #include "chromecast/ozone/cast_egl_platform.h"
8 #include "chromecast/ozone/gpu_platform_support_cast.h"
9 #include "chromecast/ozone/platform_window_cast.h"
10 #include "chromecast/ozone/surface_factory_cast.h"
11 #include "ui/ozone/common/native_display_delegate_ozone.h"
12 #include "ui/ozone/public/cursor_factory_ozone.h"
13 #include "ui/ozone/public/gpu_platform_support_host.h"
14 #include "ui/ozone/public/input_controller.h"
15 #include "ui/ozone/public/system_input_injector.h"
17 namespace chromecast
{
20 OzonePlatformCast::OzonePlatformCast(scoped_ptr
<CastEglPlatform
> egl_platform
)
21 : egl_platform_(egl_platform
.Pass()) {
24 OzonePlatformCast::~OzonePlatformCast() {
27 ui::SurfaceFactoryOzone
* OzonePlatformCast::GetSurfaceFactoryOzone() {
28 return surface_factory_ozone_
.get();
31 ui::CursorFactoryOzone
* OzonePlatformCast::GetCursorFactoryOzone() {
32 return cursor_factory_ozone_
.get();
35 ui::InputController
* OzonePlatformCast::GetInputController() {
36 return input_controller_
.get();
39 ui::GpuPlatformSupport
* OzonePlatformCast::GetGpuPlatformSupport() {
40 return gpu_platform_support_
.get();
43 ui::GpuPlatformSupportHost
* OzonePlatformCast::GetGpuPlatformSupportHost() {
44 return gpu_platform_support_host_
.get();
47 scoped_ptr
<ui::SystemInputInjector
>
48 OzonePlatformCast::CreateSystemInputInjector() {
49 return scoped_ptr
<ui::SystemInputInjector
>(); // no input injection support
52 scoped_ptr
<ui::PlatformWindow
> OzonePlatformCast::CreatePlatformWindow(
53 ui::PlatformWindowDelegate
* delegate
,
54 const gfx::Rect
& bounds
) {
55 return make_scoped_ptr
<ui::PlatformWindow
>(
56 new PlatformWindowCast(delegate
, bounds
));
59 scoped_ptr
<ui::NativeDisplayDelegate
>
60 OzonePlatformCast::CreateNativeDisplayDelegate() {
61 return scoped_ptr
<ui::NativeDisplayDelegate
>(
62 new ui::NativeDisplayDelegateOzone());
65 void OzonePlatformCast::InitializeUI() {
66 if (!surface_factory_ozone_
) {
67 surface_factory_ozone_
.reset(new SurfaceFactoryCast(egl_platform_
.Pass()));
69 cursor_factory_ozone_
.reset(new ui::CursorFactoryOzone());
70 input_controller_
= ui::CreateStubInputController();
71 gpu_platform_support_host_
.reset(ui::CreateStubGpuPlatformSupportHost());
74 void OzonePlatformCast::InitializeGPU() {
75 if (!surface_factory_ozone_
) {
76 surface_factory_ozone_
.reset(new SurfaceFactoryCast(egl_platform_
.Pass()));
78 gpu_platform_support_
.reset(
79 new GpuPlatformSupportCast(surface_factory_ozone_
.get()));
83 } // namespace chromecast