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/x11/ozone_platform_x11.h" | 5 #include "ui/ozone/platform/x11/ozone_platform_x11.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 10 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 11 #include "ui/events/platform/x11/x11_event_source_libevent.h" |
11 #include "ui/ozone/common/native_display_delegate_ozone.h" | 12 #include "ui/ozone/common/native_display_delegate_ozone.h" |
12 #include "ui/ozone/common/stub_overlay_manager.h" | 13 #include "ui/ozone/common/stub_overlay_manager.h" |
13 #include "ui/ozone/platform/x11/x11_surface_factory.h" | 14 #include "ui/ozone/platform/x11/x11_surface_factory.h" |
14 #include "ui/ozone/public/gpu_platform_support.h" | 15 #include "ui/ozone/public/gpu_platform_support.h" |
15 #include "ui/ozone/public/gpu_platform_support_host.h" | 16 #include "ui/ozone/public/gpu_platform_support_host.h" |
16 #include "ui/ozone/public/input_controller.h" | 17 #include "ui/ozone/public/input_controller.h" |
17 #include "ui/ozone/public/ozone_platform.h" // nogncheck | 18 #include "ui/ozone/public/ozone_platform.h" // nogncheck |
18 #include "ui/ozone/public/system_input_injector.h" | 19 #include "ui/ozone/public/system_input_injector.h" |
19 #include "ui/platform_window/platform_window.h" | 20 #include "ui/platform_window/platform_window.h" |
| 21 #include "ui/platform_window/x11/x11_window_ozone.h" |
20 | 22 |
21 namespace ui { | 23 namespace ui { |
22 | 24 |
23 namespace { | 25 namespace { |
24 | 26 |
25 // Singleton OzonePlatform implementation for Linux X11 platform. | 27 // Singleton OzonePlatform implementation for Linux X11 platform. |
26 class OzonePlatformX11 : public OzonePlatform { | 28 class OzonePlatformX11 : public OzonePlatform { |
27 public: | 29 public: |
28 OzonePlatformX11() {} | 30 OzonePlatformX11() {} |
29 ~OzonePlatformX11() override {} | 31 ~OzonePlatformX11() override {} |
(...skipping 23 matching lines...) Expand all Loading... |
53 return gpu_platform_support_.get(); | 55 return gpu_platform_support_.get(); |
54 } | 56 } |
55 | 57 |
56 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 58 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
57 return gpu_platform_support_host_.get(); | 59 return gpu_platform_support_host_.get(); |
58 } | 60 } |
59 | 61 |
60 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 62 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
61 PlatformWindowDelegate* delegate, | 63 PlatformWindowDelegate* delegate, |
62 const gfx::Rect& bounds) override { | 64 const gfx::Rect& bounds) override { |
63 // TODO(kylechar): Add PlatformWindow creation here. | 65 scoped_ptr<X11WindowOzone> window = |
64 NOTREACHED(); | 66 make_scoped_ptr(new X11WindowOzone(event_source_.get(), delegate)); |
65 return nullptr; | 67 window->SetBounds(bounds); |
| 68 window->Create(); |
| 69 return std::move(window); |
66 } | 70 } |
67 | 71 |
68 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 72 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
69 return make_scoped_ptr(new NativeDisplayDelegateOzone()); | 73 return make_scoped_ptr(new NativeDisplayDelegateOzone()); |
70 } | 74 } |
71 | 75 |
72 base::ScopedFD OpenClientNativePixmapDevice() const override { | 76 base::ScopedFD OpenClientNativePixmapDevice() const override { |
73 return base::ScopedFD(); | 77 return base::ScopedFD(); |
74 } | 78 } |
75 | 79 |
76 void InitializeUI() override { | 80 void InitializeUI() override { |
77 // TODO(kylechar): Add PlatformEventSource creation here. | 81 event_source_.reset(new X11EventSourceLibevent(gfx::GetXDisplay())); |
78 surface_factory_ozone_.reset(new X11SurfaceFactory()); | 82 surface_factory_ozone_.reset(new X11SurfaceFactory()); |
79 overlay_manager_.reset(new StubOverlayManager()); | 83 overlay_manager_.reset(new StubOverlayManager()); |
80 input_controller_ = CreateStubInputController(); | 84 input_controller_ = CreateStubInputController(); |
81 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 85 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 86 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
83 } | 87 } |
84 | 88 |
85 void InitializeGPU() override { | 89 void InitializeGPU() override { |
86 surface_factory_ozone_.reset(new X11SurfaceFactory()); | 90 surface_factory_ozone_.reset(new X11SurfaceFactory()); |
87 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 91 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
88 } | 92 } |
89 | 93 |
90 private: | 94 private: |
91 // Objects in the Browser process. | 95 // Objects in the Browser process. |
| 96 scoped_ptr<X11EventSourceLibevent> event_source_; |
92 scoped_ptr<OverlayManagerOzone> overlay_manager_; | 97 scoped_ptr<OverlayManagerOzone> overlay_manager_; |
93 scoped_ptr<InputController> input_controller_; | 98 scoped_ptr<InputController> input_controller_; |
94 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 99 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
95 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 100 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
96 | 101 |
97 // Objects in the GPU process. | 102 // Objects in the GPU process. |
98 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 103 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
99 | 104 |
100 // Objects in both Browser and GPU process. | 105 // Objects in both Browser and GPU process. |
101 scoped_ptr<X11SurfaceFactory> surface_factory_ozone_; | 106 scoped_ptr<X11SurfaceFactory> surface_factory_ozone_; |
102 | 107 |
103 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); | 108 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); |
104 }; | 109 }; |
105 | 110 |
106 } // namespace | 111 } // namespace |
107 | 112 |
108 OzonePlatform* CreateOzonePlatformX11() { | 113 OzonePlatform* CreateOzonePlatformX11() { |
109 return new OzonePlatformX11; | 114 return new OzonePlatformX11; |
110 } | 115 } |
111 | 116 |
112 } // namespace ui | 117 } // namespace ui |
OLD | NEW |