OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/wayland/ozone_platform_wayland.h" | 5 #include "ui/ozone/platform/wayland/ozone_platform_wayland.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ui/ozone/common/native_display_delegate_ozone.h" | 8 #include "ui/ozone/common/native_display_delegate_ozone.h" |
9 #include "ui/ozone/common/stub_overlay_manager.h" | 9 #include "ui/ozone/common/stub_overlay_manager.h" |
10 #include "ui/ozone/platform/wayland/wayland_display.h" | 10 #include "ui/ozone/platform/wayland/wayland_connection.h" |
11 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" | 11 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" |
12 #include "ui/ozone/platform/wayland/wayland_window.h" | 12 #include "ui/ozone/platform/wayland/wayland_window.h" |
13 #include "ui/ozone/public/cursor_factory_ozone.h" | 13 #include "ui/ozone/public/cursor_factory_ozone.h" |
14 #include "ui/ozone/public/gpu_platform_support.h" | 14 #include "ui/ozone/public/gpu_platform_support.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_platform.h" | 17 #include "ui/ozone/public/ozone_platform.h" |
18 #include "ui/ozone/public/system_input_injector.h" | 18 #include "ui/ozone/public/system_input_injector.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
(...skipping 30 matching lines...) Expand all Loading... |
51 return gpu_platform_support_host_.get(); | 51 return gpu_platform_support_host_.get(); |
52 } | 52 } |
53 | 53 |
54 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 54 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
55 return nullptr; | 55 return nullptr; |
56 } | 56 } |
57 | 57 |
58 std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 58 std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
59 PlatformWindowDelegate* delegate, | 59 PlatformWindowDelegate* delegate, |
60 const gfx::Rect& bounds) override { | 60 const gfx::Rect& bounds) override { |
61 auto window = | 61 auto window = base::WrapUnique( |
62 base::WrapUnique(new WaylandWindow(delegate, display_.get(), bounds)); | 62 new WaylandWindow(delegate, connection_.get(), bounds)); |
63 if (!window->Initialize()) | 63 if (!window->Initialize()) |
64 return nullptr; | 64 return nullptr; |
65 return std::move(window); | 65 return std::move(window); |
66 } | 66 } |
67 | 67 |
68 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 68 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
69 override { | 69 override { |
70 return base::WrapUnique(new NativeDisplayDelegateOzone); | 70 return base::WrapUnique(new NativeDisplayDelegateOzone); |
71 } | 71 } |
72 | 72 |
73 void InitializeUI() override { | 73 void InitializeUI() override { |
74 display_.reset(new WaylandDisplay); | 74 connection_.reset(new WaylandConnection); |
75 if (!display_->Initialize()) | 75 if (!connection_->Initialize()) |
76 LOG(FATAL) << "Failed to initialize Wayland platform"; | 76 LOG(FATAL) << "Failed to initialize Wayland platform"; |
77 | 77 |
78 cursor_factory_.reset(new CursorFactoryOzone); | 78 cursor_factory_.reset(new CursorFactoryOzone); |
79 overlay_manager_.reset(new StubOverlayManager); | 79 overlay_manager_.reset(new StubOverlayManager); |
80 input_controller_ = CreateStubInputController(); | 80 input_controller_ = CreateStubInputController(); |
81 surface_factory_.reset(new WaylandSurfaceFactory(display_.get())); | 81 surface_factory_.reset(new WaylandSurfaceFactory(connection_.get())); |
82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
83 } | 83 } |
84 | 84 |
85 void InitializeGPU() override { | 85 void InitializeGPU() override { |
86 // Don't reinitialize the surface factory in case InitializeUI was called | 86 // Don't reinitialize the surface factory in case InitializeUI was called |
87 // previously in the same process. | 87 // previously in the same process. |
88 if (!surface_factory_) | 88 if (!surface_factory_) |
89 surface_factory_.reset(new WaylandSurfaceFactory(nullptr)); | 89 surface_factory_.reset(new WaylandSurfaceFactory(nullptr)); |
90 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 90 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 std::unique_ptr<WaylandDisplay> display_; | 94 std::unique_ptr<WaylandConnection> connection_; |
95 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; | 95 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; |
96 std::unique_ptr<CursorFactoryOzone> cursor_factory_; | 96 std::unique_ptr<CursorFactoryOzone> cursor_factory_; |
97 std::unique_ptr<StubOverlayManager> overlay_manager_; | 97 std::unique_ptr<StubOverlayManager> overlay_manager_; |
98 std::unique_ptr<InputController> input_controller_; | 98 std::unique_ptr<InputController> input_controller_; |
99 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 99 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
100 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; | 100 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); | 102 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 | 106 |
107 OzonePlatform* CreateOzonePlatformWayland() { | 107 OzonePlatform* CreateOzonePlatformWayland() { |
108 return new OzonePlatformWayland; | 108 return new OzonePlatformWayland; |
109 } | 109 } |
110 | 110 |
111 } // namespace ui | 111 } // namespace ui |
OLD | NEW |