| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const gfx::Rect& bounds) override { | 78 const gfx::Rect& bounds) override { |
| 79 return base::WrapUnique<PlatformWindow>( | 79 return base::WrapUnique<PlatformWindow>( |
| 80 new PlatformWindowCast(delegate, bounds)); | 80 new PlatformWindowCast(delegate, bounds)); |
| 81 } | 81 } |
| 82 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() | 82 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 83 override { | 83 override { |
| 84 NOTREACHED(); | 84 NOTREACHED(); |
| 85 return nullptr; | 85 return nullptr; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void InitializeUI() override { | 88 void InitializeUI(const InitParams& params) override { |
| 89 device_manager_ = CreateDeviceManager(); | 89 device_manager_ = CreateDeviceManager(); |
| 90 overlay_manager_.reset(new OverlayManagerCast()); | 90 overlay_manager_.reset(new OverlayManagerCast()); |
| 91 cursor_factory_.reset(new CursorFactoryOzone()); | 91 cursor_factory_.reset(new CursorFactoryOzone()); |
| 92 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 92 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 93 | 93 |
| 94 // Enable dummy software rendering support if GPU process disabled | 94 // Enable dummy software rendering support if GPU process disabled |
| 95 // or if we're an audio-only build. | 95 // or if we're an audio-only build. |
| 96 // Note: switch is kDisableGpu from content/public/common/content_switches.h | 96 // Note: switch is kDisableGpu from content/public/common/content_switches.h |
| 97 bool enable_dummy_software_rendering = true; | 97 bool enable_dummy_software_rendering = true; |
| 98 #if !BUILDFLAG(IS_CAST_AUDIO_ONLY) | 98 #if !BUILDFLAG(IS_CAST_AUDIO_ONLY) |
| 99 enable_dummy_software_rendering = | 99 enable_dummy_software_rendering = |
| 100 base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu"); | 100 base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu"); |
| 101 #endif // BUILDFLAG(IS_CAST_AUDIO_ONLY) | 101 #endif // BUILDFLAG(IS_CAST_AUDIO_ONLY) |
| 102 | 102 |
| 103 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 103 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 104 base::MakeUnique<StubKeyboardLayoutEngine>()); | 104 base::MakeUnique<StubKeyboardLayoutEngine>()); |
| 105 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() | 105 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() |
| 106 ->SetCurrentLayoutByName("us"); | 106 ->SetCurrentLayoutByName("us"); |
| 107 event_factory_ozone_.reset(new EventFactoryEvdev( | 107 event_factory_ozone_.reset(new EventFactoryEvdev( |
| 108 nullptr, device_manager_.get(), | 108 nullptr, device_manager_.get(), |
| 109 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 109 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
| 110 | 110 |
| 111 if (enable_dummy_software_rendering) | 111 if (enable_dummy_software_rendering) |
| 112 surface_factory_.reset(new SurfaceFactoryCast()); | 112 surface_factory_.reset(new SurfaceFactoryCast()); |
| 113 } | 113 } |
| 114 void InitializeGPU() override { | 114 void InitializeGPU(const InitParams& params) override { |
| 115 surface_factory_.reset(new SurfaceFactoryCast(std::move(egl_platform_))); | 115 surface_factory_.reset(new SurfaceFactoryCast(std::move(egl_platform_))); |
| 116 } | 116 } |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 std::unique_ptr<DeviceManager> device_manager_; | 119 std::unique_ptr<DeviceManager> device_manager_; |
| 120 std::unique_ptr<CastEglPlatform> egl_platform_; | 120 std::unique_ptr<CastEglPlatform> egl_platform_; |
| 121 std::unique_ptr<SurfaceFactoryCast> surface_factory_; | 121 std::unique_ptr<SurfaceFactoryCast> surface_factory_; |
| 122 std::unique_ptr<CursorFactoryOzone> cursor_factory_; | 122 std::unique_ptr<CursorFactoryOzone> cursor_factory_; |
| 123 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 123 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 124 std::unique_ptr<OverlayManagerOzone> overlay_manager_; | 124 std::unique_ptr<OverlayManagerOzone> overlay_manager_; |
| 125 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; | 125 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); | 127 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCast); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| 131 | 131 |
| 132 OzonePlatform* CreateOzonePlatformCast() { | 132 OzonePlatform* CreateOzonePlatformCast() { |
| 133 const std::vector<std::string>& argv = | 133 const std::vector<std::string>& argv = |
| 134 base::CommandLine::ForCurrentProcess()->argv(); | 134 base::CommandLine::ForCurrentProcess()->argv(); |
| 135 std::unique_ptr<chromecast::CastEglPlatform> platform( | 135 std::unique_ptr<chromecast::CastEglPlatform> platform( |
| 136 chromecast::CastEglPlatformShlib::Create(argv)); | 136 chromecast::CastEglPlatformShlib::Create(argv)); |
| 137 return new OzonePlatformCast(std::move(platform)); | 137 return new OzonePlatformCast(std::move(platform)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace ui | 140 } // namespace ui |
| OLD | NEW |