OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/cast/ozone_platform_cast.h" | 5 #include "ui/ozone/platform/cast/ozone_platform_cast.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chromecast/public/cast_egl_platform.h" | 8 #include "chromecast/public/cast_egl_platform.h" |
9 #include "chromecast/public/cast_egl_platform_shlib.h" | 9 #include "chromecast/public/cast_egl_platform_shlib.h" |
10 #include "ui/ozone/common/native_display_delegate_ozone.h" | 10 #include "ui/ozone/common/native_display_delegate_ozone.h" |
11 #include "ui/ozone/platform/cast/gpu_platform_support_cast.h" | 11 #include "ui/ozone/platform/cast/gpu_platform_support_cast.h" |
12 #include "ui/ozone/platform/cast/platform_window_cast.h" | 12 #include "ui/ozone/platform/cast/platform_window_cast.h" |
13 #include "ui/ozone/platform/cast/surface_factory_cast.h" | 13 #include "ui/ozone/platform/cast/surface_factory_cast.h" |
14 #include "ui/ozone/public/cursor_factory_ozone.h" | 14 #include "ui/ozone/public/cursor_factory_ozone.h" |
15 #include "ui/ozone/public/gpu_platform_support_host.h" | 15 #include "ui/ozone/public/gpu_platform_support_host.h" |
16 #include "ui/ozone/public/input_controller.h" | 16 #include "ui/ozone/public/input_controller.h" |
| 17 #include "ui/ozone/public/ozone_client.h" |
17 #include "ui/ozone/public/ozone_platform.h" | 18 #include "ui/ozone/public/ozone_platform.h" |
| 19 #include "ui/ozone/public/surface_client_factory_ozone.h" |
18 #include "ui/ozone/public/system_input_injector.h" | 20 #include "ui/ozone/public/system_input_injector.h" |
19 | 21 |
20 using chromecast::CastEglPlatform; | 22 using chromecast::CastEglPlatform; |
21 | 23 |
22 namespace ui { | 24 namespace ui { |
23 namespace { | 25 namespace { |
24 | 26 |
25 // Ozone platform implementation for Cast. Implements functionality | 27 // Ozone platform implementation for Cast. Implements functionality |
26 // common to all Cast implementations: | 28 // common to all Cast implementations: |
27 // - Always one window with window size equal to display size | 29 // - Always one window with window size equal to display size |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 scoped_ptr<CastEglPlatform> egl_platform_; | 86 scoped_ptr<CastEglPlatform> egl_platform_; |
85 scoped_ptr<SurfaceFactoryCast> surface_factory_; | 87 scoped_ptr<SurfaceFactoryCast> surface_factory_; |
86 scoped_ptr<CursorFactoryOzone> cursor_factory_; | 88 scoped_ptr<CursorFactoryOzone> cursor_factory_; |
87 scoped_ptr<InputController> input_controller_; | 89 scoped_ptr<InputController> input_controller_; |
88 scoped_ptr<GpuPlatformSupportCast> gpu_platform_support_; | 90 scoped_ptr<GpuPlatformSupportCast> gpu_platform_support_; |
89 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 91 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); | 93 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); |
92 }; | 94 }; |
93 | 95 |
| 96 class OzoneClientCast : public OzoneClient { |
| 97 public: |
| 98 OzoneClientCast() {} |
| 99 ~OzoneClientCast() override {} |
| 100 |
| 101 // OzoneClient: |
| 102 SurfaceClientFactoryOzone* GetSurfaceClientFactoryOzone() override { |
| 103 return surface_client_.get(); |
| 104 } |
| 105 |
| 106 void InitializeUI() override { |
| 107 if (!surface_client_) |
| 108 surface_client_.reset(new SurfaceClientFactoryOzone); |
| 109 } |
| 110 |
| 111 void InitializeRenderer() override { |
| 112 if (!surface_client_) |
| 113 surface_client_.reset(new SurfaceClientFactoryOzone); |
| 114 } |
| 115 |
| 116 private: |
| 117 scoped_ptr<SurfaceClientFactoryOzone> surface_client_; |
| 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(OzoneClientCast); |
| 120 }; |
| 121 |
94 } // namespace | 122 } // namespace |
95 | 123 |
96 OzonePlatform* CreateOzonePlatformCast() { | 124 OzonePlatform* CreateOzonePlatformCast() { |
97 const std::vector<std::string>& argv = | 125 const std::vector<std::string>& argv = |
98 base::CommandLine::ForCurrentProcess()->argv(); | 126 base::CommandLine::ForCurrentProcess()->argv(); |
99 scoped_ptr<chromecast::CastEglPlatform> platform( | 127 scoped_ptr<chromecast::CastEglPlatform> platform( |
100 chromecast::CastEglPlatformShlib::Create(argv)); | 128 chromecast::CastEglPlatformShlib::Create(argv)); |
101 return new OzonePlatformCast(platform.Pass()); | 129 return new OzonePlatformCast(platform.Pass()); |
102 } | 130 } |
103 | 131 |
| 132 OzoneClient* CreateOzoneClientCast() { |
| 133 return new OzoneClientCast; |
| 134 } |
| 135 |
104 } // namespace ui | 136 } // namespace ui |
OLD | NEW |