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_display.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 #include "ui/views/widget/desktop_aura/desktop_factory_wayland.h" | |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 class OzonePlatformWayland : public OzonePlatform { | 25 class OzonePlatformWayland : public OzonePlatform { |
25 public: | 26 public: |
26 OzonePlatformWayland() {} | 27 OzonePlatformWayland() {} |
27 ~OzonePlatformWayland() override {} | 28 ~OzonePlatformWayland() override {} |
28 | 29 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 void InitializeUI() override { | 74 void InitializeUI() override { |
74 display_.reset(new WaylandDisplay); | 75 display_.reset(new WaylandDisplay); |
75 if (!display_->Initialize()) | 76 if (!display_->Initialize()) |
76 LOG(FATAL) << "Failed to initialize Wayland platform"; | 77 LOG(FATAL) << "Failed to initialize Wayland platform"; |
77 | 78 |
78 cursor_factory_.reset(new CursorFactoryOzone); | 79 cursor_factory_.reset(new CursorFactoryOzone); |
79 overlay_manager_.reset(new StubOverlayManager); | 80 overlay_manager_.reset(new StubOverlayManager); |
80 input_controller_ = CreateStubInputController(); | 81 input_controller_ = CreateStubInputController(); |
81 surface_factory_.reset(new WaylandSurfaceFactory(display_.get())); | 82 surface_factory_.reset(new WaylandSurfaceFactory(display_.get())); |
82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 83 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
84 desktop_factory_.reset(new views::DesktopFactoryOzoneWayland()); | |
tonikitoo
2016/06/06 15:29:59
I joone. For the record, this is the biggest goal
| |
85 views::DesktopFactoryOzone::SetInstance(desktop_factory_.get()); | |
tonikitoo
2016/06/06 15:29:59
Also, https://codereview.chromium.org/2024953007/
joone
2016/06/06 18:22:22
Great.
| |
83 } | 86 } |
84 | 87 |
85 void InitializeGPU() override { | 88 void InitializeGPU() override { |
86 // Don't reinitialize the surface factory in case InitializeUI was called | 89 // Don't reinitialize the surface factory in case InitializeUI was called |
87 // previously in the same process. | 90 // previously in the same process. |
88 if (!surface_factory_) | 91 if (!surface_factory_) |
89 surface_factory_.reset(new WaylandSurfaceFactory(nullptr)); | 92 surface_factory_.reset(new WaylandSurfaceFactory(nullptr)); |
90 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 93 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
91 } | 94 } |
92 | 95 |
93 private: | 96 private: |
94 std::unique_ptr<WaylandDisplay> display_; | 97 std::unique_ptr<WaylandDisplay> display_; |
95 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; | 98 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; |
99 std::unique_ptr<views::DesktopFactoryOzone> desktop_factory_; | |
tonikitoo
2016/06/06 15:29:59
Ideally ozone/platform should not depend on ui/vie
joone
2016/06/06 18:22:21
Yes, I like your approach.
| |
96 std::unique_ptr<CursorFactoryOzone> cursor_factory_; | 100 std::unique_ptr<CursorFactoryOzone> cursor_factory_; |
97 std::unique_ptr<StubOverlayManager> overlay_manager_; | 101 std::unique_ptr<StubOverlayManager> overlay_manager_; |
98 std::unique_ptr<InputController> input_controller_; | 102 std::unique_ptr<InputController> input_controller_; |
99 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 103 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
100 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; | 104 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_; |
101 | 105 |
102 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); | 106 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); |
103 }; | 107 }; |
104 | 108 |
105 } // namespace | 109 } // namespace |
106 | 110 |
107 OzonePlatform* CreateOzonePlatformWayland() { | 111 OzonePlatform* CreateOzonePlatformWayland() { |
108 return new OzonePlatformWayland; | 112 return new OzonePlatformWayland; |
109 } | 113 } |
110 | 114 |
111 } // namespace ui | 115 } // namespace ui |
OLD | NEW |