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

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

Issue 750593003: Ozone X11 platform Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup leftover stuff Created 6 years 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
« no previous file with comments | « ui/ozone/platform/x11/ozone_platform_x11.h ('k') | ui/ozone/platform/x11/x11_input_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/x11/ozone_platform_x11.cc
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc
new file mode 100644
index 0000000000000000000000000000000000000000..028f23575cf09beb8c68e456a867f8ba4f20be55
--- /dev/null
+++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -0,0 +1,103 @@
+// Copyright 2014 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/x11/ozone_platform_x11.h"
+
+#include "base/at_exit.h"
+#include "base/bind.h"
+#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
+#include "ui/ozone/common/native_display_delegate_ozone.h"
+#include "ui/ozone/platform/x11/x11_input_controller.h"
+#include "ui/ozone/platform/x11/x11_surface_factory.h"
+#include "ui/ozone/public/gpu_platform_support.h"
+#include "ui/ozone/public/gpu_platform_support_host.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/ozone/public/system_input_injector.h"
+#include "ui/ozone/public/ui_thread_gpu.h"
+#include "ui/platform_window/x11/x11_window.h"
+
+namespace ui {
+namespace {
+
+// OzonePlatform for Linux X11
+class OzonePlatformX11 : public OzonePlatform {
+ public:
+ OzonePlatformX11() {
+ base::AtExitManager::RegisterTask(
+ base::Bind(&base::DeletePointer<OzonePlatformX11>, this));
+ }
+ virtual ~OzonePlatformX11() {}
+
+ // OzonePlatform:
+ ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
+ return surface_factory_ozone_.get();
+ }
+ CursorFactoryOzone* GetCursorFactoryOzone() override {
+ return cursor_factory_ozone_.get();
+ }
+ GpuPlatformSupport* GetGpuPlatformSupport() override {
+ return gpu_platform_support_.get();
+ }
+ GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
+ return gpu_platform_support_host_.get();
+ }
+ scoped_ptr<PlatformWindow> CreatePlatformWindow(
+ PlatformWindowDelegate* delegate,
+ const gfx::Rect& bounds) override {
+ scoped_ptr<X11Window> window =
+ window_manager_->CreatePlatformWindow(delegate).Pass();
+ window->SetBounds(bounds);
+ window->Create();
+ return window.Pass();
+ }
+ scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
+ return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone());
+ }
+ scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override {
+ NOTREACHED();
+ return scoped_ptr<SystemInputInjector>();
+ }
+ InputController* GetInputController() override {
+ return input_controller_.get();
+ }
+ void InitializeUI() override {
+ if (!input_controller_)
+ input_controller_.reset(new X11InputController());
+ if (!window_manager_)
+ window_manager_ = new X11WindowManager();
+ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
+ cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
+ surface_factory_ozone_.reset(new X11SurfaceFactory(window_manager_));
+ }
+
+ void InitializeGPU() override {
+ if (!input_controller_)
+ input_controller_.reset(new X11InputController());
+ if (!window_manager_)
+ window_manager_ = new X11WindowManager();
+ if (!surface_factory_ozone_)
+ surface_factory_ozone_.reset(new X11SurfaceFactory(window_manager_));
+ gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
+ }
+
+ private:
+ scoped_ptr<X11InputController> input_controller_;
+ scoped_ptr<X11SurfaceFactory> surface_factory_ozone_;
+ scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
+
+ scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
+ scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+
+ scoped_refptr<X11WindowManager> window_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11);
+};
+
+} // namespace
+
+OzonePlatform* CreateOzonePlatformX11() {
+ return new OzonePlatformX11;
+}
+
+} // namespace ui
« no previous file with comments | « ui/ozone/platform/x11/ozone_platform_x11.h ('k') | ui/ozone/platform/x11/x11_input_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698