| 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/base/ui_features.h" | 8 #include "ui/base/ui_features.h" |
| 9 #include "ui/display/fake_display_delegate.h" | 9 #include "ui/display/fake_display_delegate.h" |
| 10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (!window->Initialize()) | 67 if (!window->Initialize()) |
| 68 return nullptr; | 68 return nullptr; |
| 69 return std::move(window); | 69 return std::move(window); |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() | 72 std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 73 override { | 73 override { |
| 74 return base::MakeUnique<display::FakeDisplayDelegate>(); | 74 return base::MakeUnique<display::FakeDisplayDelegate>(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void InitializeUI() override { | |
| 78 InitParams default_params; | |
| 79 InitializeUI(default_params); | |
| 80 } | |
| 81 | |
| 82 void InitializeUI(const InitParams& args) override { | 77 void InitializeUI(const InitParams& args) override { |
| 83 connection_.reset(new WaylandConnection); | 78 connection_.reset(new WaylandConnection); |
| 84 if (!connection_->Initialize()) | 79 if (!connection_->Initialize()) |
| 85 LOG(FATAL) << "Failed to initialize Wayland platform"; | 80 LOG(FATAL) << "Failed to initialize Wayland platform"; |
| 86 | 81 |
| 87 #if BUILDFLAG(USE_XKBCOMMON) | 82 #if BUILDFLAG(USE_XKBCOMMON) |
| 88 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 83 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 89 base::MakeUnique<WaylandXkbKeyboardLayoutEngine>( | 84 base::MakeUnique<WaylandXkbKeyboardLayoutEngine>( |
| 90 xkb_evdev_code_converter_)); | 85 xkb_evdev_code_converter_)); |
| 91 #else | 86 #else |
| 92 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 87 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 93 base::MakeUnique<StubKeyboardLayoutEngine>()); | 88 base::MakeUnique<StubKeyboardLayoutEngine>()); |
| 94 #endif | 89 #endif |
| 95 | 90 |
| 96 cursor_factory_.reset(new CursorFactoryOzone); | 91 cursor_factory_.reset(new CursorFactoryOzone); |
| 97 overlay_manager_.reset(new StubOverlayManager); | 92 overlay_manager_.reset(new StubOverlayManager); |
| 98 input_controller_ = CreateStubInputController(); | 93 input_controller_ = CreateStubInputController(); |
| 99 surface_factory_.reset(new WaylandSurfaceFactory(connection_.get())); | 94 surface_factory_.reset(new WaylandSurfaceFactory(connection_.get())); |
| 100 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 95 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 101 } | 96 } |
| 102 | 97 |
| 103 void InitializeGPU() override { | |
| 104 InitParams default_params; | |
| 105 InitializeGPU(default_params); | |
| 106 } | |
| 107 | |
| 108 void InitializeGPU(const InitParams& args) override { | 98 void InitializeGPU(const InitParams& args) override { |
| 109 // TODO(fwang): args.single_process parameter should be checked here; make | 99 // TODO(fwang): args.single_process parameter should be checked here; make |
| 110 // sure callers pass in the proper value. Once it happens, the check whether | 100 // sure callers pass in the proper value. Once it happens, the check whether |
| 111 // surface factory was set in the same process by a previous InitializeUI | 101 // surface factory was set in the same process by a previous InitializeUI |
| 112 // call becomes unneeded. | 102 // call becomes unneeded. |
| 113 if (!surface_factory_) { | 103 if (!surface_factory_) { |
| 114 // TODO(fwang): Separate processes can not share a Wayland connection | 104 // TODO(fwang): Separate processes can not share a Wayland connection |
| 115 // and so the current implementations of GLOzoneEGLWayland and | 105 // and so the current implementations of GLOzoneEGLWayland and |
| 116 // WaylandCanvasSurface may only work when UI and GPU live in the same | 106 // WaylandCanvasSurface may only work when UI and GPU live in the same |
| 117 // process. GetSurfaceFactoryOzone() must be non-null so a dummy instance | 107 // process. GetSurfaceFactoryOzone() must be non-null so a dummy instance |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); | 126 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); |
| 137 }; | 127 }; |
| 138 | 128 |
| 139 } // namespace | 129 } // namespace |
| 140 | 130 |
| 141 OzonePlatform* CreateOzonePlatformWayland() { | 131 OzonePlatform* CreateOzonePlatformWayland() { |
| 142 return new OzonePlatformWayland; | 132 return new OzonePlatformWayland; |
| 143 } | 133 } |
| 144 | 134 |
| 145 } // namespace ui | 135 } // namespace ui |
| OLD | NEW |