Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_gbm.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gbm.h> | 8 #include <gbm.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 15 #include "ui/events/ozone/device/device_manager.h" | 15 #include "ui/events/ozone/device/device_manager.h" |
| 16 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 16 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| 18 #if defined(USE_XKBCOMMON) | |
|
spang
2014/12/15 19:53:44
move downwards
kpschoedel
2014/12/15 20:10:22
Done.
| |
| 19 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" | |
| 20 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | |
| 21 #else | |
| 18 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 22 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
| 23 #endif | |
| 19 #include "ui/ozone/platform/dri/display_manager.h" | 24 #include "ui/ozone/platform/dri/display_manager.h" |
| 20 #include "ui/ozone/platform/dri/dri_cursor.h" | 25 #include "ui/ozone/platform/dri/dri_cursor.h" |
| 21 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 26 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
| 22 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 27 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
| 23 #include "ui/ozone/platform/dri/dri_window.h" | 28 #include "ui/ozone/platform/dri/dri_window.h" |
| 24 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 29 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
| 25 #include "ui/ozone/platform/dri/dri_window_manager.h" | 30 #include "ui/ozone/platform/dri/dri_window_manager.h" |
| 26 #include "ui/ozone/platform/dri/dri_wrapper.h" | 31 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 27 #include "ui/ozone/platform/dri/gbm_buffer.h" | 32 #include "ui/ozone/platform/dri/gbm_buffer.h" |
| 28 #include "ui/ozone/platform/dri/gbm_surface.h" | 33 #include "ui/ozone/platform/dri/gbm_surface.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 void InitializeUI() override { | 126 void InitializeUI() override { |
| 122 display_manager_.reset(new DisplayManager()); | 127 display_manager_.reset(new DisplayManager()); |
| 123 // Needed since the browser process creates the accelerated widgets and that | 128 // Needed since the browser process creates the accelerated widgets and that |
| 124 // happens through SFO. | 129 // happens through SFO. |
| 125 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 130 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 126 device_manager_ = CreateDeviceManager(); | 131 device_manager_ = CreateDeviceManager(); |
| 127 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 132 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
| 128 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 133 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
| 129 window_manager_.reset( | 134 window_manager_.reset( |
| 130 new DriWindowManager(gpu_platform_support_host_.get())); | 135 new DriWindowManager(gpu_platform_support_host_.get())); |
| 136 #if defined(USE_XKBCOMMON) | |
| 137 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( | |
| 138 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); | |
| 139 #else | |
| 131 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 140 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 132 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 141 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
| 142 #endif | |
| 133 event_factory_ozone_.reset(new EventFactoryEvdev( | 143 event_factory_ozone_.reset(new EventFactoryEvdev( |
| 134 window_manager_->cursor(), device_manager_.get(), | 144 window_manager_->cursor(), device_manager_.get(), |
| 135 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 145 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
| 136 } | 146 } |
| 137 | 147 |
| 138 void InitializeGPU() override { | 148 void InitializeGPU() override { |
| 139 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 149 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
| 140 dri_->Initialize(); | 150 dri_->Initialize(); |
| 141 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 151 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
| 142 screen_manager_.reset( | 152 screen_manager_.reset( |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 168 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 178 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 169 | 179 |
| 170 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 180 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
| 171 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 181 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
| 172 | 182 |
| 173 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; | 183 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; |
| 174 // Browser side object only. | 184 // Browser side object only. |
| 175 scoped_ptr<DriWindowManager> window_manager_; | 185 scoped_ptr<DriWindowManager> window_manager_; |
| 176 scoped_ptr<DisplayManager> display_manager_; | 186 scoped_ptr<DisplayManager> display_manager_; |
| 177 | 187 |
| 188 #if defined(USE_XKBCOMMON) | |
| 189 XkbEvdevCodes xkb_evdev_code_converter_; | |
| 190 #endif | |
| 191 | |
| 178 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 192 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
| 179 }; | 193 }; |
| 180 | 194 |
| 181 } // namespace | 195 } // namespace |
| 182 | 196 |
| 183 OzonePlatform* CreateOzonePlatformGbm() { | 197 OzonePlatform* CreateOzonePlatformGbm() { |
| 184 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 198 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 185 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 199 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 186 } | 200 } |
| 187 | 201 |
| 188 } // namespace ui | 202 } // namespace ui |
| OLD | NEW |