Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Unified Diff: ui/ozone/platform/x11/ozone_platform_x11.cc

Issue 1602173005: Add PlatformWindow/Event related code for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/x11/ozone_platform_x11.cc
diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc
similarity index 52%
copy from ui/ozone/platform/caca/ozone_platform_caca.cc
copy to ui/ozone/platform/x11/ozone_platform_x11.cc
index fa2d21422251ffc79bf1bd061329f36e6867ca81..bd135d226b751a8e74dbea319a29daf5dfeea114 100644
--- a/ui/ozone/platform/caca/ozone_platform_caca.cc
+++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -1,102 +1,123 @@
-// 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/x11/ozone_platform_x11.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 <utility>
+
+#include "base/at_exit.h"
+#include "base/bind.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.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/public/cursor_factory_ozone.h"
+#include "ui/ozone/platform/x11/x11_event_factory.h"
+#include "ui/ozone/platform/x11/x11_surface_factory.h"
+#include "ui/ozone/platform/x11/x11_window_host.h"
+#include "ui/ozone/platform/x11/x11_window_host_manager.h"
#include "ui/ozone/public/gpu_platform_support.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/input_controller.h"
-#include "ui/ozone/public/ozone_platform.h" // nogncheck
+#include "ui/ozone/public/ozone_platform.h"
spang 2016/01/20 19:53:31 Keep the "// nogncheck" or "gn check" will complai
kylechar 2016/01/20 21:46:16 Done.
#include "ui/ozone/public/system_input_injector.h"
namespace ui {
namespace {
-class OzonePlatformCaca : public OzonePlatform {
+// Singleton OzonePlatform implementation for Linux X11 platform.
+class OzonePlatformX11 : public OzonePlatform {
public:
- OzonePlatformCaca() {}
- ~OzonePlatformCaca() override {}
+ OzonePlatformX11() {}
+ ~OzonePlatformX11() override {}
// OzonePlatform:
ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
- return window_manager_.get();
+ return surface_factory_ozone_.get();
}
- OverlayManagerOzone* GetOverlayManager() override {
+
+ ui::OverlayManagerOzone* GetOverlayManager() override {
return overlay_manager_.get();
}
+
CursorFactoryOzone* GetCursorFactoryOzone() override {
return cursor_factory_ozone_.get();
}
+
+ scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override {
+ NOTREACHED();
+ return nullptr;
+ }
+
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.
- }
+
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())
- return nullptr;
- return caca_window;
+ scoped_ptr<X11WindowHost> window =
+ window_manager_->CreatePlatformWindow(delegate);
+ window->SetBounds(bounds);
+ window->Create();
+ return std::move(window);
spang 2016/01/20 19:53:30 Return statements should ever have a std::move() b
kylechar 2016/01/20 21:46:16 scoped_ptr<X11WindowHost> isn't converted to scope
spang 2016/01/20 22:32:53 Ah I missed the type change. It's correct as-is th
}
+
scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
return make_scoped_ptr(new NativeDisplayDelegateOzone());
}
+
base::ScopedFD OpenClientNativePixmapDevice() const override {
return base::ScopedFD();
}
void InitializeUI() override {
- window_manager_.reset(new CacaWindowManager);
+ window_manager_ = new X11WindowHostManager();
+ surface_factory_ozone_.reset(new X11SurfaceFactory(window_manager_));
overlay_manager_.reset(new StubOverlayManager());
- event_source_.reset(new CacaEventSource());
- cursor_factory_ozone_.reset(new CursorFactoryOzone());
- gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
input_controller_ = CreateStubInputController();
- KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
- make_scoped_ptr(new NoKeyboardLayoutEngine()));
+ cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
+ event_factory_ozone_.reset(
+ new X11EventFactory(gfx::GetXDisplay(), window_manager_));
+ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
}
void InitializeGPU() override {
+ surface_factory_ozone_.reset(new X11SurfaceFactory(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<InputController> input_controller_;
+ // Objects in the Browser process.
+ scoped_refptr<X11WindowHostManager> window_manager_;
scoped_ptr<OverlayManagerOzone> overlay_manager_;
+ scoped_ptr<InputController> input_controller_;
+ scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
+ scoped_ptr<X11EventFactory> event_factory_ozone_;
+ scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+
+ // Objects in the GPU process.
+ scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
+
+ // Objects in both Browser and GPU process.
+ scoped_ptr<X11SurfaceFactory> surface_factory_ozone_;
- DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca);
+ DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11);
};
} // namespace
-OzonePlatform* CreateOzonePlatformCaca() {
- return new OzonePlatformCaca;
+OzonePlatform* CreateOzonePlatformX11() {
+ return new OzonePlatformX11;
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698