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