OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dri/ozone_platform_dri.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_dri.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
9 #include "ui/events/ozone/device/device_manager.h" | 9 #include "ui/events/ozone/device/device_manager.h" |
10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
11 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 11 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
12 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 12 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
13 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | |
14 #include "ui/ozone/platform/dri/display_manager.h" | 13 #include "ui/ozone/platform/dri/display_manager.h" |
15 #include "ui/ozone/platform/dri/dri_buffer.h" | 14 #include "ui/ozone/platform/dri/dri_buffer.h" |
16 #include "ui/ozone/platform/dri/dri_cursor.h" | 15 #include "ui/ozone/platform/dri/dri_cursor.h" |
17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 16 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 17 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
19 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 18 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
20 #include "ui/ozone/platform/dri/dri_window.h" | 19 #include "ui/ozone/platform/dri/dri_window.h" |
21 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" | 20 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" |
22 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 21 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
23 #include "ui/ozone/platform/dri/dri_window_manager.h" | 22 #include "ui/ozone/platform/dri/dri_window_manager.h" |
24 #include "ui/ozone/platform/dri/dri_wrapper.h" | 23 #include "ui/ozone/platform/dri/dri_wrapper.h" |
25 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" | 24 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" |
26 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" | 25 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" |
27 #include "ui/ozone/platform/dri/screen_manager.h" | 26 #include "ui/ozone/platform/dri/screen_manager.h" |
28 #include "ui/ozone/public/ozone_platform.h" | 27 #include "ui/ozone/public/ozone_platform.h" |
29 #include "ui/ozone/public/ui_thread_gpu.h" | 28 #include "ui/ozone/public/ui_thread_gpu.h" |
30 | 29 |
| 30 #if defined(USE_XKBCOMMON) |
| 31 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" |
| 32 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
| 33 #else |
| 34 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
| 35 #endif |
| 36 |
31 namespace ui { | 37 namespace ui { |
32 | 38 |
33 namespace { | 39 namespace { |
34 | 40 |
35 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; | 41 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; |
36 | 42 |
37 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 43 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
38 // | 44 // |
39 // This platform is Linux without any display server (no X, wayland, or | 45 // This platform is Linux without any display server (no X, wayland, or |
40 // anything). This means chrome alone owns the display and input devices. | 46 // anything). This means chrome alone owns the display and input devices. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 scoped_ptr<NativeDisplayDelegateDri> ndd( | 98 scoped_ptr<NativeDisplayDelegateDri> ndd( |
93 new NativeDisplayDelegateDri(dri_.get(), screen_manager_.get())); | 99 new NativeDisplayDelegateDri(dri_.get(), screen_manager_.get())); |
94 ndd->Initialize(); | 100 ndd->Initialize(); |
95 gpu_platform_support_.reset( | 101 gpu_platform_support_.reset( |
96 new DriGpuPlatformSupport(dri_.get(), &window_delegate_manager_, | 102 new DriGpuPlatformSupport(dri_.get(), &window_delegate_manager_, |
97 screen_manager_.get(), ndd.Pass())); | 103 screen_manager_.get(), ndd.Pass())); |
98 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 104 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
99 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 105 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
100 window_manager_.reset( | 106 window_manager_.reset( |
101 new DriWindowManager(gpu_platform_support_host_.get())); | 107 new DriWindowManager(gpu_platform_support_host_.get())); |
| 108 #if defined(USE_XKBCOMMON) |
| 109 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( |
| 110 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); |
| 111 #else |
102 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 112 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
103 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 113 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
| 114 #endif |
104 event_factory_ozone_.reset(new EventFactoryEvdev( | 115 event_factory_ozone_.reset(new EventFactoryEvdev( |
105 window_manager_->cursor(), device_manager_.get(), | 116 window_manager_->cursor(), device_manager_.get(), |
106 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 117 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
107 | 118 |
108 if (!ui_thread_gpu_.Initialize()) | 119 if (!ui_thread_gpu_.Initialize()) |
109 LOG(FATAL) << "Failed to initialize dummy channel."; | 120 LOG(FATAL) << "Failed to initialize dummy channel."; |
110 } | 121 } |
111 | 122 |
112 void InitializeGPU() override {} | 123 void InitializeGPU() override {} |
113 | 124 |
(...skipping 10 matching lines...) Expand all Loading... |
124 scoped_ptr<DriWindowManager> window_manager_; | 135 scoped_ptr<DriWindowManager> window_manager_; |
125 scoped_ptr<DisplayManager> display_manager_; | 136 scoped_ptr<DisplayManager> display_manager_; |
126 | 137 |
127 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 138 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
128 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 139 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
129 | 140 |
130 DriWindowDelegateManager window_delegate_manager_; | 141 DriWindowDelegateManager window_delegate_manager_; |
131 | 142 |
132 UiThreadGpu ui_thread_gpu_; | 143 UiThreadGpu ui_thread_gpu_; |
133 | 144 |
| 145 #if defined(USE_XKBCOMMON) |
| 146 XkbEvdevCodes xkb_evdev_code_converter_; |
| 147 #endif |
| 148 |
134 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 149 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
135 }; | 150 }; |
136 | 151 |
137 } // namespace | 152 } // namespace |
138 | 153 |
139 OzonePlatform* CreateOzonePlatformDri() { | 154 OzonePlatform* CreateOzonePlatformDri() { |
140 return new OzonePlatformDri; | 155 return new OzonePlatformDri; |
141 } | 156 } |
142 | 157 |
143 } // namespace ui | 158 } // namespace ui |
OLD | NEW |