Chromium Code Reviews| Index: ui/ozone/platform/wayland/ozone_platform_wayland.cc |
| diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/wayland/ozone_platform_wayland.cc |
| similarity index 53% |
| copy from ui/ozone/platform/caca/ozone_platform_caca.cc |
| copy to ui/ozone/platform/wayland/ozone_platform_wayland.cc |
| index 9f7873e4060ea6e148cf073d8d30c47a3827e09c..5ccd2b8697f6647e7ce8f7b73f6ca5c65d387a00 100644 |
| --- a/ui/ozone/platform/caca/ozone_platform_caca.cc |
| +++ b/ui/ozone/platform/wayland/ozone_platform_wayland.cc |
| @@ -1,17 +1,14 @@ |
| -// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "ui/ozone/platform/caca/ozone_platform_caca.h" |
| +#include "ui/ozone/platform/wayland/ozone_platform_wayland.h" |
| -#include "base/macros.h" |
| -#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| -#include "ui/events/ozone/layout/no/no_keyboard_layout_engine.h" |
| #include "ui/ozone/common/native_display_delegate_ozone.h" |
| #include "ui/ozone/common/stub_overlay_manager.h" |
| -#include "ui/ozone/platform/caca/caca_event_source.h" |
| -#include "ui/ozone/platform/caca/caca_window.h" |
| -#include "ui/ozone/platform/caca/caca_window_manager.h" |
| +#include "ui/ozone/platform/wayland/wayland_display.h" |
| +#include "ui/ozone/platform/wayland/wayland_surface_factory.h" |
| +#include "ui/ozone/platform/wayland/wayland_window.h" |
| #include "ui/ozone/public/cursor_factory_ozone.h" |
| #include "ui/ozone/public/gpu_platform_support.h" |
| #include "ui/ozone/public/gpu_platform_support_host.h" |
| @@ -23,80 +20,93 @@ namespace ui { |
| namespace { |
| -class OzonePlatformCaca : public OzonePlatform { |
| +class OzonePlatformWayland : public OzonePlatform { |
| public: |
| - OzonePlatformCaca() {} |
| - ~OzonePlatformCaca() override {} |
| + OzonePlatformWayland() {} |
| + ~OzonePlatformWayland() override {} |
| - // OzonePlatform: |
| - ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| - return window_manager_.get(); |
| + // OzonePlatform |
| + SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| + return surface_factory_.get(); |
| } |
| + |
| OverlayManagerOzone* GetOverlayManager() override { |
| return overlay_manager_.get(); |
| } |
| + |
| CursorFactoryOzone* GetCursorFactoryOzone() override { |
| - return cursor_factory_ozone_.get(); |
| + return cursor_factory_.get(); |
| } |
| + |
| InputController* GetInputController() override { |
| return input_controller_.get(); |
| } |
| + |
| GpuPlatformSupport* GetGpuPlatformSupport() override { |
| return gpu_platform_support_.get(); |
| } |
| + |
| GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| return gpu_platform_support_host_.get(); |
| } |
| + |
| scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
| - return nullptr; // no input injection support. |
| + return nullptr; |
| } |
| + |
| scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| PlatformWindowDelegate* delegate, |
| const gfx::Rect& bounds) override { |
| - scoped_ptr<CacaWindow> caca_window(new CacaWindow( |
| - delegate, window_manager_.get(), event_source_.get(), bounds)); |
| - if (!caca_window->Initialize()) |
| + display_->StartProcessingEvents(); |
|
Michael Forney
2016/01/21 22:11:48
It looks like base::MessageLoopForUI::current() is
spang
2016/01/22 23:42:32
It's a longstanding issue that InitializeUI() runs
Michael Forney
2016/01/23 01:08:05
Cool, thanks for the suggestion. That does appear
|
| + auto window = |
| + make_scoped_ptr(new WaylandWindow(delegate, display_.get(), bounds)); |
| + if (!window->Initialize()) |
| return nullptr; |
| - return std::move(caca_window); |
| + return std::move(window); |
| } |
| + |
| scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
| - return make_scoped_ptr(new NativeDisplayDelegateOzone()); |
| + return make_scoped_ptr(new NativeDisplayDelegateOzone); |
| } |
| + |
| base::ScopedFD OpenClientNativePixmapDevice() const override { |
| + NOTIMPLEMENTED(); |
| return base::ScopedFD(); |
| } |
| void InitializeUI() override { |
| - window_manager_.reset(new CacaWindowManager); |
| - overlay_manager_.reset(new StubOverlayManager()); |
| - event_source_.reset(new CacaEventSource()); |
| - cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| - gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| + display_.reset(new WaylandDisplay); |
| + if (!display_->Initialize()) |
| + LOG(FATAL) << "Failed to initialize Wayland platform"; |
| + |
| + cursor_factory_.reset(new CursorFactoryOzone); |
| + overlay_manager_.reset(new StubOverlayManager); |
| input_controller_ = CreateStubInputController(); |
| - KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| - make_scoped_ptr(new NoKeyboardLayoutEngine())); |
| + surface_factory_.reset(new WaylandSurfaceFactory(display_.get())); |
| + gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| } |
| void InitializeGPU() override { |
| + surface_factory_.reset(new WaylandSurfaceFactory(nullptr)); |
| gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| } |
| private: |
| - scoped_ptr<CacaWindowManager> window_manager_; |
| - scoped_ptr<CacaEventSource> event_source_; |
| - scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| - scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| - scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| + scoped_ptr<WaylandDisplay> display_; |
| + scoped_ptr<WaylandSurfaceFactory> surface_factory_; |
| + scoped_ptr<CursorFactoryOzone> cursor_factory_; |
| + scoped_ptr<StubOverlayManager> overlay_manager_; |
| scoped_ptr<InputController> input_controller_; |
| - scoped_ptr<OverlayManagerOzone> overlay_manager_; |
| + scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| + scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| - DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
| + DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); |
| }; |
| } // namespace |
| -OzonePlatform* CreateOzonePlatformCaca() { |
| - return new OzonePlatformCaca; |
| +OzonePlatform* CreateOzonePlatformWayland() { |
| + return new OzonePlatformWayland; |
| } |
| } // namespace ui |