summaryrefslogtreecommitdiffstats
path: root/src/core/ozone
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2017-09-22 17:23:49 +0200
committerMichal Klocek <michal.klocek@qt.io>2018-03-23 08:21:06 +0000
commit5dcdd7c62ffc7fe398ac9d71d2f782df3ebd2e9b (patch)
tree5f8b5023da98f890814b59a8f7f0cccdfbd15abb /src/core/ozone
parent58658bc5e55155cf0087f58e6d4d35d9af50303c (diff)
Move ozone to new subdirectory
Move ozone related files to core/ozone. Split classes so they can be reused for new ozone platform backends. Change-Id: I98a2aac6807ef2b3eee92eea9ecfd8fce6dd9d16 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/ozone')
-rw-r--r--src/core/ozone/gl_ozone_qt.cpp118
-rw-r--r--src/core/ozone/gl_ozone_qt.h73
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp159
-rw-r--r--src/core/ozone/ozone_platform_qt.h55
-rw-r--r--src/core/ozone/platform_window_qt.cpp95
-rw-r--r--src/core/ozone/platform_window_qt.h91
-rw-r--r--src/core/ozone/surface_factory_qt.cpp61
-rw-r--r--src/core/ozone/surface_factory_qt.h60
8 files changed, 712 insertions, 0 deletions
diff --git a/src/core/ozone/gl_ozone_qt.cpp b/src/core/ozone/gl_ozone_qt.cpp
new file mode 100644
index 000000000..81d5ccfa9
--- /dev/null
+++ b/src/core/ozone/gl_ozone_qt.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if defined(USE_OZONE)
+
+#include "base/files/file_path.h"
+#include "base/native_library.h"
+#include "gl_context_qt.h"
+#include "ozone/gl_ozone_qt.h"
+#include "ui/gl/gl_context_egl.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface.h"
+#include "ui/gl/init/gl_factory.h"
+#include "ui/gl/init/gl_initializer.h"
+
+
+#include <EGL/egl.h>
+#include <dlfcn.h>
+
+#ifndef QT_NO_OPENGL
+#include <QOpenGLContext>
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+#endif
+
+namespace QtWebEngineCore {
+
+base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
+ base::NativeLibraryLoadError error;
+ base::NativeLibrary library = base::LoadNativeLibrary(filename, &error);
+ if (!library) {
+ LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " << error.ToString();
+ return NULL;
+ }
+ return library;
+}
+
+bool GLOzoneQt::LoadGLES2Bindings(gl::GLImplementation /*implementation*/)
+{
+ base::NativeLibrary eglgles2Library = dlopen(NULL, RTLD_LAZY);
+ if (!eglgles2Library) {
+ LOG(ERROR) << "Failed to open EGL/GLES2 context " << dlerror();
+ return false;
+ }
+
+ gl::GLGetProcAddressProc get_proc_address =
+ reinterpret_cast<gl::GLGetProcAddressProc>(
+ base::GetFunctionPointerFromNativeLibrary(eglgles2Library,
+ "eglGetProcAddress"));
+#ifndef QT_NO_OPENGL
+ if (!get_proc_address) {
+ // QTBUG-63341 most likely libgles2 not linked with libegl -> fallback to qpa
+ if (QOpenGLContext *context = qt_gl_global_share_context()) {
+ get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(
+ context->getProcAddress("eglGetProcAddress"));
+ }
+ }
+#endif
+
+ if (!get_proc_address) {
+ LOG(ERROR) << "eglGetProcAddress not found.";
+ base::UnloadNativeLibrary(eglgles2Library);
+ return false;
+ }
+
+ gl::SetGLGetProcAddressProc(get_proc_address);
+ gl::AddGLNativeLibrary(eglgles2Library);
+ return true;
+}
+
+intptr_t GLOzoneQt::GetNativeDisplay()
+{
+ static void *display = GLContextHelper::getNativeDisplay();
+
+ if (display)
+ return reinterpret_cast<intptr_t>(display);
+
+ return reinterpret_cast<intptr_t>(EGL_DEFAULT_DISPLAY);
+}
+
+} // namespace QtWebEngineCore
+
+#endif // defined(USE_OZONE)
diff --git a/src/core/ozone/gl_ozone_qt.h b/src/core/ozone/gl_ozone_qt.h
new file mode 100644
index 000000000..8af879748
--- /dev/null
+++ b/src/core/ozone/gl_ozone_qt.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GL_OZONE_QT
+#define GL_OZONE_QT
+
+#if defined(USE_OZONE)
+
+#include "ui/ozone/common/gl_ozone_egl.h"
+
+namespace QtWebEngineCore {
+
+class GLOzoneQt : public ui::GLOzoneEGL {
+public:
+ scoped_refptr<gl::GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget /*window*/) override
+ {
+ return nullptr;
+ }
+ scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(const gfx::Size& /*size*/) override
+ {
+ return nullptr;
+ }
+
+protected:
+ // Returns native platform display handle. This is used to obtain the EGL
+ // display connection for the native display.
+ intptr_t GetNativeDisplay() override;
+
+ // Sets up GL bindings for the native surface.
+ bool LoadGLES2Bindings(gl::GLImplementation implementation) override;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // defined(USE_OZONE)
+
+#endif // GL_OZONE_QT
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
new file mode 100644
index 000000000..8bb5007ef
--- /dev/null
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "ozone/ozone_platform_qt.h"
+
+#if defined(USE_OZONE)
+#include "ozone/surface_factory_qt.h"
+#include "ozone/platform_window_qt.h"
+#include "ui/display/types/native_display_delegate.h"
+#include "ui/ozone/common/stub_client_native_pixmap_factory.h"
+#include "ui/ozone/common/stub_overlay_manager.h"
+#include "ui/ozone/public/cursor_factory_ozone.h"
+#include "ui/ozone/public/gpu_platform_support_host.h"
+#include "ui/ozone/public/input_controller.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/platform_window/platform_window_delegate.h"
+#include "ui/platform_window/platform_window.h"
+
+namespace ui {
+
+namespace {
+
+class OzonePlatformQt : public OzonePlatform {
+public:
+ OzonePlatformQt();
+ ~OzonePlatformQt() override;
+
+ ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override;
+ ui::CursorFactoryOzone* GetCursorFactoryOzone() override;
+ GpuPlatformSupportHost* GetGpuPlatformSupportHost() override;
+ std::unique_ptr<PlatformWindow> CreatePlatformWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) override;
+ std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() override;
+ ui::InputController* GetInputController() override;
+ std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override;
+ ui::OverlayManagerOzone* GetOverlayManager() override;
+
+private:
+ void InitializeUI(const ui::OzonePlatform::InitParams &) override;
+ void InitializeGPU(const ui::OzonePlatform::InitParams &) override;
+
+ std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_;
+ std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
+
+ std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+ std::unique_ptr<InputController> input_controller_;
+ std::unique_ptr<OverlayManagerOzone> overlay_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(OzonePlatformQt);
+};
+
+
+OzonePlatformQt::OzonePlatformQt() {}
+
+OzonePlatformQt::~OzonePlatformQt() {}
+
+ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone()
+{
+ return surface_factory_ozone_.get();
+}
+
+ui::CursorFactoryOzone* OzonePlatformQt::GetCursorFactoryOzone()
+{
+ return cursor_factory_ozone_.get();
+}
+
+GpuPlatformSupportHost* OzonePlatformQt::GetGpuPlatformSupportHost()
+{
+ return gpu_platform_support_host_.get();
+}
+
+std::unique_ptr<PlatformWindow> OzonePlatformQt::CreatePlatformWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds)
+{
+ return base::WrapUnique(new PlatformWindowQt(delegate, bounds));
+}
+
+ui::InputController* OzonePlatformQt::GetInputController()
+{
+ return input_controller_.get();
+}
+
+std::unique_ptr<ui::SystemInputInjector> OzonePlatformQt::CreateSystemInputInjector()
+{
+ return nullptr; // no input injection support.
+}
+
+ui::OverlayManagerOzone* OzonePlatformQt::GetOverlayManager()
+{
+ return overlay_manager_.get();
+}
+
+std::unique_ptr<display::NativeDisplayDelegate> OzonePlatformQt::CreateNativeDisplayDelegate()
+{
+ NOTREACHED();
+ return nullptr;
+}
+
+void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
+{
+ overlay_manager_.reset(new StubOverlayManager());
+ cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost());
+ input_controller_ = CreateStubInputController();
+}
+
+void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &)
+{
+ surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt());
+}
+
+} // namespace
+
+
+OzonePlatform* CreateOzonePlatformQt() { return new OzonePlatformQt; }
+
+gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryQt()
+{
+ return CreateStubClientNativePixmapFactory();
+}
+
+} // namespace ui
+
+#endif
+
diff --git a/src/core/ozone/ozone_platform_qt.h b/src/core/ozone/ozone_platform_qt.h
new file mode 100644
index 000000000..dee66beb3
--- /dev/null
+++ b/src/core/ozone/ozone_platform_qt.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OZONE_PLATFORM_QT_H
+#define OZONE_PLATFORM_QT_H
+
+#if defined(USE_OZONE)
+
+#include "ui/ozone/public/ozone_platform.h"
+
+namespace ui {
+
+// Constructor hook for use in ozone_platform_list.cc
+OzonePlatform* CreateOzonePlatformQt();
+
+} // namespace ui
+
+#endif // defined(USE_OZONE)
+#endif // OZONE_PLATFORM_QT_H
diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp
new file mode 100644
index 000000000..757c042f0
--- /dev/null
+++ b/src/core/ozone/platform_window_qt.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if defined(USE_OZONE)
+
+#include "base/bind.h"
+#include "ozone/platform_window_qt.h"
+#include "ui/events/ozone/events_ozone.h"
+#include "ui/events/platform/platform_event_source.h"
+#include "ui/platform_window/platform_window_delegate.h"
+
+namespace ui {
+
+PlatformWindowQt::PlatformWindowQt(PlatformWindowDelegate* delegate, const gfx::Rect& bounds)
+ : delegate_(delegate)
+ , bounds_(bounds)
+{
+ ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
+}
+
+PlatformWindowQt::~PlatformWindowQt()
+{
+ ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
+}
+
+gfx::Rect PlatformWindowQt::GetBounds()
+{
+ return bounds_;
+}
+
+void PlatformWindowQt::SetBounds(const gfx::Rect& bounds)
+{
+ if (bounds == bounds_)
+ return;
+ bounds_ = bounds;
+ delegate_->OnBoundsChanged(bounds);
+}
+
+bool PlatformWindowQt::CanDispatchEvent(const ui::PlatformEvent& /*ne*/)
+{
+ return true;
+}
+
+uint32_t PlatformWindowQt::DispatchEvent(const ui::PlatformEvent& native_event)
+{
+ DispatchEventFromNativeUiEvent(
+ native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent,
+ base::Unretained(delegate_)));
+
+ return ui::POST_DISPATCH_STOP_PROPAGATION;
+}
+
+void PlatformWindowQt::PrepareForShutdown()
+{
+}
+
+} // namespace ui
+
+#endif // defined(USE_OZONE)
diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h
new file mode 100644
index 000000000..d25096432
--- /dev/null
+++ b/src/core/ozone/platform_window_qt.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLATFORM_WINDOW_QT_H
+#define PLATFORM_WINDOW_QT_H
+
+#if defined(USE_OZONE)
+
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/platform_window/platform_window.h"
+
+namespace ui {
+
+class PlatformWindowDelegate;
+
+class PlatformWindowQt : public PlatformWindow, public PlatformEventDispatcher
+{
+public:
+ PlatformWindowQt(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);
+ ~PlatformWindowQt() override;
+ // PlatformWindow:
+ gfx::Rect GetBounds() override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ void Show() override { }
+ void Hide() override { }
+ void Close() override { }
+ void SetTitle(const base::string16&) override { }
+ void SetCapture() override { }
+ void ReleaseCapture() override { }
+ void ToggleFullscreen() override { }
+ void Maximize() override { }
+ void Minimize() override { }
+ void Restore() override { }
+ void SetCursor(PlatformCursor) override { }
+ void MoveCursorTo(const gfx::Point&) override { }
+ void ConfineCursorToBounds(const gfx::Rect&) override { }
+ PlatformImeController* GetPlatformImeController() override { return nullptr; }
+ // PlatformEventDispatcher:
+ bool CanDispatchEvent(const PlatformEvent& event) override;
+ uint32_t DispatchEvent(const PlatformEvent& event) override;
+ void PrepareForShutdown() override;
+
+private:
+ PlatformWindowDelegate* delegate_;
+ gfx::Rect bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformWindowQt);
+};
+
+}
+
+#endif // defined(USE_OZONE)
+#endif //PLATFORM_WINDOW_QT_H
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
new file mode 100644
index 000000000..b1db44f65
--- /dev/null
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if defined(USE_OZONE)
+
+#include "ozone/gl_ozone_qt.h"
+#include "ozone/surface_factory_qt.h"
+#include "ui/gl/gl_surface.h"
+namespace QtWebEngineCore {
+
+std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations()
+{
+ std::vector<gl::GLImplementation> impls;
+ impls.push_back(gl::kGLImplementationEGLGLES2);
+ return impls;
+}
+
+ui::GLOzone* SurfaceFactoryQt::GetGLOzone(gl::GLImplementation implementation)
+{
+ return new GLOzoneQt();
+}
+
+} // namespace QtWebEngineCore
+#endif // defined(USE_OZONE)
+
diff --git a/src/core/ozone/surface_factory_qt.h b/src/core/ozone/surface_factory_qt.h
new file mode 100644
index 000000000..b7991829c
--- /dev/null
+++ b/src/core/ozone/surface_factory_qt.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SURFACE_FACTORY_QT
+#define SURFACE_FACTORY_QT
+
+#if defined(USE_OZONE)
+
+#include "ui/ozone/public/surface_factory_ozone.h"
+
+namespace QtWebEngineCore {
+
+class SurfaceFactoryQt : public ui::SurfaceFactoryOzone
+{
+ std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
+ ui::GLOzone* GetGLOzone(gl::GLImplementation implementation) override;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // defined(USE_OZONE)
+
+#endif // SURFACE_FACTORY_QT
+