| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return nullptr; // no input injection support | 68 return nullptr; // no input injection support |
| 69 } | 69 } |
| 70 std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 70 std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
| 71 PlatformWindowDelegate* delegate, | 71 PlatformWindowDelegate* delegate, |
| 72 const gfx::Rect& bounds) override { | 72 const gfx::Rect& bounds) override { |
| 73 return base::WrapUnique<PlatformWindow>( | 73 return base::WrapUnique<PlatformWindow>( |
| 74 new PlatformWindowCast(delegate, bounds)); | 74 new PlatformWindowCast(delegate, bounds)); |
| 75 } | 75 } |
| 76 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 76 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 77 override { | 77 override { |
| 78 return base::WrapUnique(new NativeDisplayDelegateOzone()); | 78 return base::MakeUnique<NativeDisplayDelegateOzone>(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void InitializeUI() override { | 81 void InitializeUI() override { |
| 82 overlay_manager_.reset(new OverlayManagerCast()); | 82 overlay_manager_.reset(new OverlayManagerCast()); |
| 83 cursor_factory_.reset(new CursorFactoryOzone()); | 83 cursor_factory_.reset(new CursorFactoryOzone()); |
| 84 input_controller_ = CreateStubInputController(); | 84 input_controller_ = CreateStubInputController(); |
| 85 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 85 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 86 | 86 |
| 87 // Enable dummy software rendering support if GPU process disabled | 87 // Enable dummy software rendering support if GPU process disabled |
| 88 // or if we're an audio-only build. | 88 // or if we're an audio-only build. |
| 89 // Note: switch is kDisableGpu from content/public/common/content_switches.h | 89 // Note: switch is kDisableGpu from content/public/common/content_switches.h |
| 90 bool enable_dummy_software_rendering = true; | 90 bool enable_dummy_software_rendering = true; |
| 91 #if !BUILDFLAG(DISABLE_DISPLAY) | 91 #if !BUILDFLAG(DISABLE_DISPLAY) |
| 92 enable_dummy_software_rendering = | 92 enable_dummy_software_rendering = |
| 93 base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu"); | 93 base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu"); |
| 94 #endif // BUILDFLAG(DISABLE_DISPLAY) | 94 #endif // BUILDFLAG(DISABLE_DISPLAY) |
| 95 | 95 |
| 96 if (enable_dummy_software_rendering) | 96 if (enable_dummy_software_rendering) |
| 97 surface_factory_.reset(new SurfaceFactoryCast()); | 97 surface_factory_.reset(new SurfaceFactoryCast()); |
| 98 } | 98 } |
| 99 void InitializeGPU() override { | 99 void InitializeGPU() override { |
| 100 surface_factory_.reset(new SurfaceFactoryCast(std::move(egl_platform_))); | 100 surface_factory_.reset(new SurfaceFactoryCast(std::move(egl_platform_))); |
| 101 g_gpu_platform_support.Get() = | 101 g_gpu_platform_support.Get() = |
| 102 base::WrapUnique(new GpuPlatformSupportCast(surface_factory_.get())); | 102 base::MakeUnique<GpuPlatformSupportCast>(surface_factory_.get()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 std::unique_ptr<CastEglPlatform> egl_platform_; | 106 std::unique_ptr<CastEglPlatform> egl_platform_; |
| 107 std::unique_ptr<SurfaceFactoryCast> surface_factory_; | 107 std::unique_ptr<SurfaceFactoryCast> surface_factory_; |
| 108 std::unique_ptr<CursorFactoryOzone> cursor_factory_; | 108 std::unique_ptr<CursorFactoryOzone> cursor_factory_; |
| 109 std::unique_ptr<InputController> input_controller_; | 109 std::unique_ptr<InputController> input_controller_; |
| 110 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 110 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 111 std::unique_ptr<OverlayManagerOzone> overlay_manager_; | 111 std::unique_ptr<OverlayManagerOzone> overlay_manager_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); | 113 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace | 116 } // namespace |
| 117 | 117 |
| 118 OzonePlatform* CreateOzonePlatformCast() { | 118 OzonePlatform* CreateOzonePlatformCast() { |
| 119 const std::vector<std::string>& argv = | 119 const std::vector<std::string>& argv = |
| 120 base::CommandLine::ForCurrentProcess()->argv(); | 120 base::CommandLine::ForCurrentProcess()->argv(); |
| 121 std::unique_ptr<chromecast::CastEglPlatform> platform( | 121 std::unique_ptr<chromecast::CastEglPlatform> platform( |
| 122 chromecast::CastEglPlatformShlib::Create(argv)); | 122 chromecast::CastEglPlatformShlib::Create(argv)); |
| 123 return new OzonePlatformCast(std::move(platform)); | 123 return new OzonePlatformCast(std::move(platform)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace ui | 126 } // namespace ui |
| OLD | NEW |