diff --git a/.qmake.conf b/.qmake.conf
index 716685d2ad2769eee4df0af499f253ead3318bfb..a094e83ca03e268bffe48713d3776412c6a4da85 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,6 +1,5 @@
-# The qmake generated module files belong into our build/qmake dir
-MODULE_QMAKE_OUTDIR = $$shadowed($$PWD/build/qmake)
-QMAKEPATH += $$PWD/build/qmake $$MODULE_QMAKE_OUTDIR
+QMAKEPATH += $$PWD/build/qmake
 load(qt_build_config)
 
+# All modules share the same version number. We plan on following Qt's releases for now.
 MODULE_VERSION = 5.2.0
diff --git a/build/qmake/mkspecs/features/default_pre.prf b/build/qmake/mkspecs/features/default_pre.prf
index ee1100ddbc6c1972607cb8b40ef1b011e5b9fc28..b3c0495f0904a7dc349f96a16530255dc8b6395d 100644
--- a/build/qmake/mkspecs/features/default_pre.prf
+++ b/build/qmake/mkspecs/features/default_pre.prf
@@ -9,4 +9,13 @@ isEmpty(CHROMIUM_SRC_DIR): CHROMIUM_SRC_DIR=$$QTWEBENGINE_ROOT/chromium
 
 INCLUDEPATH += $$CHROMIUM_SRC_DIR
 
+# Used for our export macros
+!contains(_PRO_FILE_PWD_, $$QTWEBENGINE_ROOT/examples): DEFINES += BUILDING_CHROMIUM
+
+# Location of sync.profile
+MODULE_BASE_DIR = $$QTWEBENGINE_ROOT
+
+# We have to disable RTTI for now since that's how chromium builds on linux
+unix:!macx:QMAKE_CXXFLAGS += -fno-rtti
+
 load(functions)
diff --git a/examples/common.pri b/examples/common.pri
index b5fe6b5a056690c020ad5d5fc72b10abfe9e16cb..dac92e8659f3d76300bae08af2b495e86baa8a42 100644
--- a/examples/common.pri
+++ b/examples/common.pri
@@ -8,7 +8,6 @@ HEADERS += common/util.h
 
 RESOURCES += $$absolute_path(common/common_resources.qrc)
 
-LIBS += -L$$LIBPATH -lQt5WebEngine
 QMAKE_RPATHDIR += $$LIBPATH
 
 # Quick hack for now as we mess with that for the gyp generation step.
diff --git a/examples/examples.pro b/examples/examples.pro
index 4613dc8d85fa45cc1ee4529b93e86ed359350d8e..eb04ac0ec09ead3061176534c0177d2b96474e99 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,4 +1,4 @@
 TEMPLATE=subdirs
 
-SUBDIRS += qtquick \
-           widgets
+SUBDIRS += qtquick
+qtHaveModule(widgets): SUBDIRS += widgets
diff --git a/examples/qtquick/main.cpp b/examples/qtquick/main.cpp
index ca92eb72c423e111ab1372d6c33bdbbfde1e01b3..982c1eb7a481a1fe56285cf91c757577baece167 100644
--- a/examples/qtquick/main.cpp
+++ b/examples/qtquick/main.cpp
@@ -40,14 +40,17 @@
 ****************************************************************************/
 
 #include "quickwindow.h"
-#include "qquickwebcontentsview.h"
-#include <QApplication>
+#ifndef QT_NO_WIDGETS
+#include <QtWidgets/QApplication>
+typedef QApplication Application;
+#else
+#include <QtGui/QGuiApplication>
+typedef QGuiApplication Application;
+#endif
 
 int main(int argc, char **argv)
 {
-    QApplication app(argc, argv);
-
-    QQuickWebContentsView::registerType();
+    Application app(argc, argv);
 
     ApplicationEngine appEngine;
 
diff --git a/examples/qtquick/qtquick.pro b/examples/qtquick/qtquick.pro
index 88412e8bbfc40895a5731133ade8b05214e36a2a..3b3e98cf14be995daccc5c8ec52be363429211b2 100644
--- a/examples/qtquick/qtquick.pro
+++ b/examples/qtquick/qtquick.pro
@@ -9,5 +9,8 @@ SOURCES = quickwindow.cpp main.cpp
 OTHER_FILES += quickwindow.qml
 RESOURCES += resources.qrc
 
-QT += quick \
-      widgets # QApplication is required to get native styling with QtQuickControls
+
+QT += qml quick
+qtHaveModule(widgets) {
+    QT += widgets # QApplication is required to get native styling with QtQuickControls
+}
diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro
index 3d0d17d7f09e7026071b0966e6d0b57440cb4950..cf016402c80fcffcaa08c0b23687d7949a131525 100644
--- a/examples/widgets/widgets.pro
+++ b/examples/widgets/widgets.pro
@@ -6,4 +6,4 @@ include(../common.pri)
 HEADERS = widgetwindow.h
 SOURCES = widgetwindow.cpp main.cpp
 
-QT += widgets
+QT += webenginewidgets
diff --git a/lib/lib.pro b/lib/lib.pro
index 38fac7b02914d351432393e46d3c5bdc7f9b96ac..3627c984fd79f37ce21c58cda1d24a6f4dae521e 100644
--- a/lib/lib.pro
+++ b/lib/lib.pro
@@ -7,7 +7,7 @@ GYPINCLUDES += ../qtwebengine.gypi
 
 TEMPLATE = lib
 
-TARGET = Qt5WebEngine
+TARGET = Qt5WebEngineCore
 
 # Defining keywords such as 'signal' clashes with the chromium code base.
 DEFINES += QT_NO_KEYWORDS
@@ -18,8 +18,6 @@ PER_CONFIG_DEFINES = QTWEBENGINEPROCESS_PATH=\\\"$$getOutDir()/%config/$$QTWEBEN
 # Keep Skia happy
 CONFIG(release, debug|release): DEFINES += NDEBUG
 
-QT += widgets quick
-
 RESOURCES += lib_resources.qrc
 # We need this to find the include files generated for the .pak resource files.
 INCLUDEPATH += $$absolute_path(../resources, $$PWD)
@@ -27,13 +25,11 @@ INCLUDEPATH += $$absolute_path(../resources, $$PWD)
 SOURCES = \
         backing_store_qt.cpp \
         content_browser_client_qt.cpp \
-        qquickwebcontentsview.cpp \
-        qwebcontentsview.cpp \
         render_widget_host_view_qt.cpp \
-        render_widget_host_view_qt_delegate_quick.cpp \
-        render_widget_host_view_qt_delegate_widget.cpp \
+        render_widget_host_view_qt_delegate.cpp \
         resource_context_qt.cpp \
         url_request_context_getter_qt.cpp \
+        web_contents_adapter.cpp \
         web_contents_delegate_qt.cpp \
         web_contents_view_qt.cpp \
         web_engine_context.cpp \
@@ -43,16 +39,12 @@ HEADERS = \
         backing_store_qt.h \
         browser_context_qt.h \
         content_browser_client_qt.h \
-        qquickwebcontentsview.h \
-        qquickwebcontentsview_p.h \
-        qwebcontentsview.h \
-        qwebcontentsview_p.h \
         render_widget_host_view_qt.h \
         render_widget_host_view_qt_delegate.h \
-        render_widget_host_view_qt_delegate_quick.h \
-        render_widget_host_view_qt_delegate_widget.h \
         resource_context_qt.h \
         url_request_context_getter_qt.h \
+        web_contents_adapter.h \
+        web_contents_adapter_client.h \
         web_contents_delegate_qt.h \
         web_contents_view_qt.h \
         web_engine_context.h \
diff --git a/lib/qtwebengineglobal.h b/lib/qtwebengineglobal.h
new file mode 100644
index 0000000000000000000000000000000000000000..373fa2e31681b10a87427fa5b474000825d70964
--- /dev/null
+++ b/lib/qtwebengineglobal.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QTWEBENGINEGLOBAL_H
+#define QTWEBENGINEGLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#ifndef QT_STATIC
+#  if !defined(QT_BUILD_WEBENGINEWIDGETS_LIB) && defined(BUILDING_CHROMIUM)
+#      define QWEBENGINE_EXPORT Q_DECL_EXPORT
+#  else
+#      define QWEBENGINE_EXPORT Q_DECL_IMPORT
+#  endif
+#  if defined(QT_BUILD_WEBENGINEWIDGETS_LIB)
+#      define QWEBENGINEWIDGETS_EXPORT Q_DECL_EXPORT
+#  else
+#      define QWEBENGINEWIDGETS_EXPORT Q_DECL_IMPORT
+#  endif
+#else
+#  define QWEBENGINEWIDGETS_EXPORT
+#  define QWEBENGINE_EXPORT
+#endif
+
+#endif // QTWEBENGINEGLOBAL_H
diff --git a/lib/qquickwebcontentsview_p.h b/lib/quick/plugin.cpp
similarity index 79%
rename from lib/qquickwebcontentsview_p.h
rename to lib/quick/plugin.cpp
index 24580538ec5d5bc6d891ca5e8b94b781de3185a5..b2e332c91dfde750b3b505f3769c002b85c56b75 100644
--- a/lib/qquickwebcontentsview_p.h
+++ b/lib/quick/plugin.cpp
@@ -39,21 +39,26 @@
 **
 ****************************************************************************/
 
-#ifndef QQUICKWEBCONTENTSVIEWPRIVATE_H
-#define QQUICKWEBCONTENTSVIEWPRIVATE_H
+#include <QtQml/qqmlextensionplugin.h>
 
-#include "web_contents_view_qt.h"
+#include "qquickwebcontentsview_p.h"
 
-class QQuickWebContentsView;
+QT_BEGIN_NAMESPACE
 
-class QQuickWebContentsViewPrivate : public WebContentsViewQtClient
+class QtWebEnginePlugin : public QQmlExtensionPlugin
 {
-    QQuickWebContentsView *q_ptr;
-    Q_DECLARE_PUBLIC(QQuickWebContentsView)
+    Q_OBJECT
+    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
 public:
-    QQuickWebContentsViewPrivate();
+    virtual void registerTypes(const char *uri)
+    {
+        Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
+        Q_UNUSED(uri);
 
-    RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *view) Q_DECL_OVERRIDE;
+        qmlRegisterType<QQuickWebContentsView>(uri, 1, 0, "WebContentsView");
+    }
 };
 
-#endif // QQUICKWEBCONTENTSVIEWPRIVATE_H
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/lib/quick/qmldir b/lib/quick/qmldir
new file mode 100644
index 0000000000000000000000000000000000000000..e24f55ed9074595f6a33a92f9299d8555278a194
--- /dev/null
+++ b/lib/quick/qmldir
@@ -0,0 +1,3 @@
+module QtWebEngine
+plugin qtwebengineplugin
+typeinfo plugins.qmltypes
diff --git a/lib/qquickwebcontentsview.cpp b/lib/quick/qquickwebcontentsview.cpp
similarity index 57%
rename from lib/qquickwebcontentsview.cpp
rename to lib/quick/qquickwebcontentsview.cpp
index 5a56ecddab6a1c9f6d4b2c2f69f109c1ccdc8083..34107adc5d8f96f5d5c9e478f187cb27494efebc 100644
--- a/lib/qquickwebcontentsview.cpp
+++ b/lib/quick/qquickwebcontentsview.cpp
@@ -39,34 +39,54 @@
 **
 ****************************************************************************/
 
-#include "qquickwebcontentsview.h"
 #include "qquickwebcontentsview_p.h"
+#include "qquickwebcontentsview_p_p.h"
 
-#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/web_contents.h"
-
-#include "content_browser_client_qt.h"
+#include "web_contents_adapter.h"
 #include "render_widget_host_view_qt_delegate_quick.h"
-#include "web_contents_delegate_qt.h"
 
 #include <QUrl>
 
-void QQuickWebContentsView::registerType()
+
+QQuickWebContentsViewPrivate::QQuickWebContentsViewPrivate()
+    : adapter(new WebContentsAdapter(this))
+{
+}
+
+RenderWidgetHostViewQtDelegate *QQuickWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *rwhv)
+{
+    Q_Q(QQuickWebContentsView);
+    // Parent the RWHVQtDelegate directly, this might have to be changed to handle popups and fullscreen.
+    RenderWidgetHostViewQtDelegateQuick *viewDelegate = new RenderWidgetHostViewQtDelegateQuick(q);
+    viewDelegate->resetView(rwhv);
+    viewDelegate->setSize(QSizeF(q->width(), q->height()));
+    return viewDelegate;
+}
+
+void QQuickWebContentsViewPrivate::titleChanged(const QString &title)
+{
+    Q_Q(QQuickWebContentsView);
+    Q_UNUSED(title);
+    Q_EMIT q->titleChanged();
+}
+
+void QQuickWebContentsViewPrivate::urlChanged(const QUrl &url)
+{
+    Q_Q(QQuickWebContentsView);
+    Q_UNUSED(url);
+    Q_EMIT q->urlChanged();
+}
+
+void QQuickWebContentsViewPrivate::loadingStateChanged()
 {
-    // FIXME: Do a proper plugin.
-    qmlRegisterType<QQuickWebContentsView>("QtWebEngine", 1, 0, "WebContentsView");
+    Q_Q(QQuickWebContentsView);
+    Q_EMIT q->loadingStateChanged();
 }
 
 QQuickWebContentsView::QQuickWebContentsView()
     : d_ptr(new QQuickWebContentsViewPrivate)
 {
     d_ptr->q_ptr = this;
-
-    Q_D(QQuickWebContentsView);
-    WebContentsDelegateQt* delegate = d->webContentsDelegate.get();
-    connect(delegate, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
-    connect(delegate, SIGNAL(urlChanged(QUrl)), this, SIGNAL(urlChanged()));
-    connect(delegate, SIGNAL(loadingStateChanged()), this, SIGNAL(loadingStateChanged()));
 }
 
 QQuickWebContentsView::~QQuickWebContentsView()
@@ -76,79 +96,61 @@ QQuickWebContentsView::~QQuickWebContentsView()
 QUrl QQuickWebContentsView::url() const
 {
     Q_D(const QQuickWebContentsView);
-    GURL gurl = d->webContentsDelegate->web_contents()->GetVisibleURL();
-    return QUrl(QString::fromStdString(gurl.spec()));
+    return d->adapter->activeUrl();
 }
 
 void QQuickWebContentsView::setUrl(const QUrl& url)
 {
     Q_D(QQuickWebContentsView);
-    GURL gurl(url.toString().toStdString());
-
-    content::NavigationController::LoadURLParams params(gurl);
-    params.transition_type = content::PageTransitionFromInt(content::PAGE_TRANSITION_TYPED | content::PAGE_TRANSITION_FROM_ADDRESS_BAR);
-    d->webContentsDelegate->web_contents()->GetController().LoadURLWithParams(params);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->load(url);
 }
 
 void QQuickWebContentsView::goBack()
 {
     Q_D(QQuickWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().GoToOffset(-1);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->navigateHistory(-1);
 }
 
 void QQuickWebContentsView::goForward()
 {
     Q_D(QQuickWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().GoToOffset(1);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->navigateHistory(1);
 }
 
 void QQuickWebContentsView::reload()
 {
     Q_D(QQuickWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().Reload(false);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->reload();
 }
 
 void QQuickWebContentsView::stop()
 {
     Q_D(QQuickWebContentsView);
-    content::NavigationController& controller = d->webContentsDelegate->web_contents()->GetController();
-
-    int index = controller.GetPendingEntryIndex();
-    if (index != -1)
-        controller.RemoveEntryAtIndex(index);
-
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->stop();
 }
 
 bool QQuickWebContentsView::isLoading() const
 {
     Q_D(const QQuickWebContentsView);
-    return d->webContentsDelegate->web_contents()->IsLoading();
+    return d->adapter->isLoading();
 }
 
 QString QQuickWebContentsView::title() const
 {
     Q_D(const QQuickWebContentsView);
-    content::NavigationEntry* entry = d->webContentsDelegate->web_contents()->GetController().GetVisibleEntry();
-    if (!entry)
-        return QString();
-    return QString::fromUtf16(entry->GetTitle().data());
+    return d->adapter->pageTitle();
 }
 
 bool QQuickWebContentsView::canGoBack() const
 {
     Q_D(const QQuickWebContentsView);
-    return d->webContentsDelegate->web_contents()->GetController().CanGoBack();
+    return d->adapter->canGoBack();
 }
 
 bool QQuickWebContentsView::canGoForward() const
 {
     Q_D(const QQuickWebContentsView);
-    return d->webContentsDelegate->web_contents()->GetController().CanGoForward();
+    return d->adapter->canGoForward();
 }
 
 void QQuickWebContentsView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -160,18 +162,3 @@ void QQuickWebContentsView::geometryChanged(const QRectF &newGeometry, const QRe
         child->setSize(newGeometry.size());
     }
 }
-
-QQuickWebContentsViewPrivate::QQuickWebContentsViewPrivate()
-{
-    WebContentsViewQt* contents_view = static_cast<WebContentsViewQt*>(webContentsDelegate->web_contents()->GetView());
-    contents_view->SetClient(this);
-}
-
-RenderWidgetHostViewQtDelegate *QQuickWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *view)
-{
-    Q_Q(QQuickWebContentsView);
-    // Parent the RWHV directly, this might have to be changed to handle popups and fullscreen.
-    RenderWidgetHostViewQtDelegateQuick *viewDelegate = new RenderWidgetHostViewQtDelegateQuick(view, q);
-    viewDelegate->setSize(QSizeF(q->width(), q->height()));
-    return viewDelegate;
-}
diff --git a/lib/qquickwebcontentsview.h b/lib/quick/qquickwebcontentsview_p.h
similarity index 93%
rename from lib/qquickwebcontentsview.h
rename to lib/quick/qquickwebcontentsview_p.h
index 2c19bce0adde5d891d8f77abe40488e8fd4d470b..61aca128e04da4764ec3c445df955779e3113fbe 100644
--- a/lib/qquickwebcontentsview.h
+++ b/lib/quick/qquickwebcontentsview_p.h
@@ -39,15 +39,15 @@
 **
 ****************************************************************************/
 
-#ifndef QQUICKWEBCONTESTSVIEW_H
-#define QQUICKWEBCONTESTSVIEW_H
+#ifndef QQUICKWEBCONTESTSVIEW_P_H
+#define QQUICKWEBCONTESTSVIEW_P_H
 
 #include <QQuickItem>
 #include <QScopedPointer>
 
 class QQuickWebContentsViewPrivate;
 
-class Q_DECL_EXPORT QQuickWebContentsView : public QQuickItem {
+class QQuickWebContentsView : public QQuickItem {
     Q_OBJECT
     Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
     Q_PROPERTY(bool loading READ isLoading NOTIFY loadingStateChanged)
@@ -56,8 +56,6 @@ class Q_DECL_EXPORT QQuickWebContentsView : public QQuickItem {
     Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingStateChanged)
 
 public:
-    static void registerType();
-
     QQuickWebContentsView();
     ~QQuickWebContentsView();
 
@@ -75,7 +73,7 @@ public Q_SLOTS:
     void stop();
 
 Q_SIGNALS:
-    void titleChanged(QString);
+    void titleChanged();
     void urlChanged();
     void loadingStateChanged();
 
@@ -90,4 +88,4 @@ private:
 
 QML_DECLARE_TYPE(QQuickWebContentsView)
 
-#endif // QQUICKWEBCONTESTSVIEW_H
+#endif // QQUICKWEBCONTESTSVIEW_P_H
diff --git a/lib/quick/qquickwebcontentsview_p_p.h b/lib/quick/qquickwebcontentsview_p_p.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c9c32c46351b445e8d6a4f7b077ae5556a6f387
--- /dev/null
+++ b/lib/quick/qquickwebcontentsview_p_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBCONTENTSVIEW_P_P_H
+#define QQUICKWEBCONTENTSVIEW_P_P_H
+
+#include "web_contents_adapter_client.h"
+
+#include <QScopedPointer>
+
+class QQuickWebContentsView;
+class WebContentsAdapter;
+
+class QQuickWebContentsViewPrivate : public WebContentsAdapterClient
+{
+    QQuickWebContentsView *q_ptr;
+    Q_DECLARE_PUBLIC(QQuickWebContentsView)
+public:
+    QQuickWebContentsViewPrivate();
+
+    virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt*) Q_DECL_OVERRIDE;
+    virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
+    virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
+    virtual void loadingStateChanged() Q_DECL_OVERRIDE;
+
+    QScopedPointer<WebContentsAdapter> adapter;
+};
+
+#endif // QQUICKWEBCONTENTSVIEW_P_P_H
diff --git a/lib/quick/quick.pro b/lib/quick/quick.pro
new file mode 100644
index 0000000000000000000000000000000000000000..e2eec55dc9f1dc12a3dec305b5d52dc7ffea1723
--- /dev/null
+++ b/lib/quick/quick.pro
@@ -0,0 +1,28 @@
+CXX_MODULE = qml
+TARGET = qtwebengineplugin
+TARGETPATH = QtWebEngine
+IMPORT_VERSION = 1.0
+
+QT += qml quick
+
+INCLUDEPATH += ../
+
+# FIXME: all this should eventually be turned into QT += webenginecore
+macx:LIBPATH = $$getOutDir()/$$getConfigDir()
+else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
+LIBS += -lQt5WebEngineCore -L$$LIBPATH
+QMAKE_RPATHDIR += $$LIBPATH
+
+#DESTDIR = $$LIBPATH
+
+SOURCES = \
+        qquickwebcontentsview.cpp \
+        plugin.cpp \
+        render_widget_host_view_qt_delegate_quick.cpp
+
+HEADERS = \
+        qquickwebcontentsview_p.h \
+        qquickwebcontentsview_p_p.h \
+        render_widget_host_view_qt_delegate_quick.h
+
+load(qml_plugin)
diff --git a/lib/render_widget_host_view_qt_delegate_quick.cpp b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
similarity index 84%
rename from lib/render_widget_host_view_qt_delegate_quick.cpp
rename to lib/quick/render_widget_host_view_qt_delegate_quick.cpp
index fabd4174c3a1fbf650830c38108d760e02f7beb5..d15bac21fa87fa1464d2fd596b33dd96b39898ca 100644
--- a/lib/render_widget_host_view_qt_delegate_quick.cpp
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
@@ -41,18 +41,11 @@
 
 #include "render_widget_host_view_qt_delegate_quick.h"
 
-#include "backing_store_qt.h"
-#include "render_widget_host_view_qt.h"
-
-#include "content/browser/renderer_host/render_view_host_impl.h"
-
 #include <QQuickWindow>
 #include <QWindow>
 
-RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQt* view, QQuickItem *parent)
+RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(QQuickItem *parent)
     : QQuickPaintedItem(parent)
-    , RenderWidgetHostViewQtDelegate(view)
-    , m_backingStore(0)
 {
     setAcceptedMouseButtons(Qt::AllButtons);
 }
@@ -101,10 +94,7 @@ void RenderWidgetHostViewQtDelegateQuick::update(const QRect& rect)
 
 void RenderWidgetHostViewQtDelegateQuick::paint(QPainter *painter)
 {
-    if (!m_backingStore)
-        return;
-
-    m_backingStore->paintToTarget(painter, boundingRect());
+    RenderWidgetHostViewQtDelegate::paint(painter, boundingRect());
 }
 
 void RenderWidgetHostViewQtDelegateQuick::updatePolish()
@@ -112,63 +102,62 @@ void RenderWidgetHostViewQtDelegateQuick::updatePolish()
     // paint will be called from the scene graph thread and this doesn't play well
     // with chromium's use of TLS while getting the backing store.
     // updatePolish() should be called from the GUI thread right before the rendering thread starts.
-    m_backingStore = m_view->GetBackingStore();
+    fetchBackingStore();
 }
 
 void RenderWidgetHostViewQtDelegateQuick::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
 {
     QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
-
-    m_view->GetRenderWidgetHost()->WasResized();
+    notifyResize();
 }
 
 void RenderWidgetHostViewQtDelegateQuick::focusInEvent(QFocusEvent *event)
 {
-    m_view->handleFocusEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event)
 {
-    m_view->handleFocusEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event)
 {
     setFocus(true);
-    m_view->handleMouseEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::mouseMoveEvent(QMouseEvent *event)
 {
-    m_view->handleMouseEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::mouseReleaseEvent(QMouseEvent *event)
 {
-    m_view->handleMouseEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::mouseDoubleClickEvent(QMouseEvent *event)
 {
-    m_view->handleMouseEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::keyPressEvent(QKeyEvent *event)
 {
-    m_view->handleKeyEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::keyReleaseEvent(QKeyEvent *event)
 {
-    m_view->handleKeyEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event)
 {
-    m_view->handleWheelEvent(event);
+    forwardEvent(event);
 }
 
 void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event)
 {
-    m_view->handleTouchEvent(event);
+    forwardEvent(event);
 }
diff --git a/lib/render_widget_host_view_qt_delegate_quick.h b/lib/quick/render_widget_host_view_qt_delegate_quick.h
similarity index 96%
rename from lib/render_widget_host_view_qt_delegate_quick.h
rename to lib/quick/render_widget_host_view_qt_delegate_quick.h
index 1b77de50ba51bf7cfb65220b2a0992cabcd1bf11..38ddf01462f801dd15bc580139d3e40f5fc4f454 100644
--- a/lib/render_widget_host_view_qt_delegate_quick.h
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.h
@@ -67,7 +67,7 @@ class RenderWidgetHostViewQtDelegateQuick : public QQuickPaintedItem, public Ren
 {
     Q_OBJECT
 public:
-    RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQt* view, QQuickItem *parent = 0);
+    RenderWidgetHostViewQtDelegateQuick(QQuickItem *parent);
 
     virtual QRectF screenRect() const;
     virtual void setKeyboardFocus();
@@ -95,8 +95,6 @@ protected:
     void updatePolish();
     void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
 
-private:
-    BackingStoreQt* m_backingStore;
 };
 
 #endif
diff --git a/lib/render_widget_host_view_qt.cpp b/lib/render_widget_host_view_qt.cpp
index 2bf9d4317232e525b3bad5bfbbbb53d3d9a14cb4..ed648f8ecb32206092ca87f2ccbdd1a6980367d4 100644
--- a/lib/render_widget_host_view_qt.cpp
+++ b/lib/render_widget_host_view_qt.cpp
@@ -61,7 +61,6 @@
 
 RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget)
     : m_host(content::RenderWidgetHostImpl::From(widget))
-    , m_delegate(0)
 {
     m_host->SetView(this);
 }
@@ -70,6 +69,11 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
 {
 }
 
+void RenderWidgetHostViewQt::SetDelegate(RenderWidgetHostViewQtDelegate* delegate)
+{
+    m_delegate.reset(delegate);
+}
+
 bool RenderWidgetHostViewQt::handleEvent(QEvent* event) {
 
     switch(event->type()) {
@@ -335,8 +339,7 @@ void RenderWidgetHostViewQt::RenderProcessGone(base::TerminationStatus, int)
 
 void RenderWidgetHostViewQt::Destroy()
 {
-    delete m_delegate;
-    m_delegate = 0;
+    m_delegate.reset();
 }
 
 void RenderWidgetHostViewQt::SetTooltipText(const string16&)
diff --git a/lib/render_widget_host_view_qt.h b/lib/render_widget_host_view_qt.h
index 7a29e1d4b81e1b8adc0b15aff4e09b606b453241..05713d2b23c62188a077621a2bc33ac6d8f05799 100644
--- a/lib/render_widget_host_view_qt.h
+++ b/lib/render_widget_host_view_qt.h
@@ -44,6 +44,7 @@
 
 #include "shared/shared_globals.h"
 
+#include "base/memory/scoped_ptr.h"
 #include "content/browser/renderer_host/render_widget_host_view_base.h"
 #include <qglobal.h>
 
@@ -63,7 +64,7 @@ public:
     RenderWidgetHostViewQt(content::RenderWidgetHost* widget);
     ~RenderWidgetHostViewQt();
 
-    void SetDelegate(RenderWidgetHostViewQtDelegate* delegate) { m_delegate = delegate; }
+    void SetDelegate(RenderWidgetHostViewQtDelegate* delegate);
     bool handleEvent(QEvent* event);
     BackingStoreQt* GetBackingStore();
 
@@ -150,7 +151,7 @@ private:
     bool IsPopup() const;
 
     content::RenderWidgetHostImpl *m_host;
-    RenderWidgetHostViewQtDelegate *m_delegate;
+    scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
     gfx::Size m_requestedSize;
 };
 
diff --git a/lib/render_widget_host_view_qt_delegate.cpp b/lib/render_widget_host_view_qt_delegate.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b6ae928bc4342947be92895dde4dc71d147f8f02
--- /dev/null
+++ b/lib/render_widget_host_view_qt_delegate.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "render_widget_host_view_qt_delegate.h"
+
+#include "backing_store_qt.h"
+#include "render_widget_host_view_qt.h"
+
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include <QPainter>
+
+RenderWidgetHostViewQtDelegate::RenderWidgetHostViewQtDelegate()
+    : m_view(0), m_backingStore(0)
+{
+}
+
+RenderWidgetHostViewQtDelegate::~RenderWidgetHostViewQtDelegate()
+{
+}
+
+void RenderWidgetHostViewQtDelegate::resetView(RenderWidgetHostViewQt* view)
+{
+    m_view.reset(view);
+}
+
+void RenderWidgetHostViewQtDelegate::paint(QPainter *painter, const QRectF &boundingRect)
+{
+    if (m_backingStore)
+        m_backingStore->paintToTarget(painter, boundingRect);
+}
+
+void RenderWidgetHostViewQtDelegate::fetchBackingStore()
+{
+    Q_ASSERT(m_view);
+    m_backingStore = m_view->GetBackingStore();
+}
+
+void RenderWidgetHostViewQtDelegate::notifyResize()
+{
+    Q_ASSERT(m_view);
+    m_view->GetRenderWidgetHost()->WasResized();
+}
+
+bool RenderWidgetHostViewQtDelegate::forwardEvent(QEvent *event)
+{
+    Q_ASSERT(m_view);
+    return (m_view && m_view->handleEvent(event));
+}
diff --git a/lib/render_widget_host_view_qt_delegate.h b/lib/render_widget_host_view_qt_delegate.h
index ac57e5784cbdef48bea5b69f7b7ed184fcebbe62..b58fefcce7f32ba71b550f8cd6a53093531854ad 100644
--- a/lib/render_widget_host_view_qt_delegate.h
+++ b/lib/render_widget_host_view_qt_delegate.h
@@ -42,19 +42,21 @@
 #ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_H
 #define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_H
 
-#include "base/memory/scoped_ptr.h"
+#include "qtwebengineglobal.h"
 
-#include "render_widget_host_view_qt.h"
 #include <QRect>
+#include <QScopedPointer>
 
+class BackingStoreQt;
+class QEvent;
+class QPainter;
 class QWindow;
+class RenderWidgetHostViewQt;
+
+class QWEBENGINE_EXPORT RenderWidgetHostViewQtDelegate {
 
-class RenderWidgetHostViewQtDelegate {
-protected:
-    scoped_ptr<RenderWidgetHostViewQt> m_view;
-    RenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt* view) : m_view(view) { Q_ASSERT(m_view); }
 public:
-    virtual ~RenderWidgetHostViewQtDelegate() {}
+    virtual ~RenderWidgetHostViewQtDelegate();
     virtual QRectF screenRect() const = 0;
     virtual void setKeyboardFocus() = 0;
     virtual bool hasKeyboardFocus() = 0;
@@ -63,6 +65,18 @@ public:
     virtual bool isVisible() const = 0;
     virtual QWindow* window() const = 0;
     virtual void update(const QRect& rect = QRect()) = 0;
+    void resetView(RenderWidgetHostViewQt*);
+
+protected:
+    RenderWidgetHostViewQtDelegate();
+    void paint(QPainter*, const QRectF& boundingRect);
+    void fetchBackingStore();
+    void notifyResize();
+    bool forwardEvent(QEvent*);
+
+private:
+    QScopedPointer<RenderWidgetHostViewQt> m_view;
+    BackingStoreQt *m_backingStore;
 };
 
 #endif
diff --git a/lib/web_contents_adapter.cpp b/lib/web_contents_adapter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a815628ac7d092053ce1d38d85ab7ec305e4b340
--- /dev/null
+++ b/lib/web_contents_adapter.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "web_contents_adapter.h"
+
+#include "content_browser_client_qt.h"
+#include "browser_context_qt.h"
+#include "web_contents_adapter_client.h"
+#include "web_contents_delegate_qt.h"
+#include "web_contents_view_qt.h"
+#include "web_engine_context.h"
+
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/navigation_entry.h"
+
+// Used to maintain a WebEngineContext for as long as we need one
+class WebContentsAdapterPrivate {
+public:
+    WebContentsAdapterPrivate() : engineContext(WebEngineContext::current()) { }
+    scoped_refptr<WebEngineContext> engineContext;
+};
+
+
+WebContentsAdapter::WebContentsAdapter(WebContentsAdapterClient *adapterClient)
+// This has to be the first thing we do.
+    : d(new WebContentsAdapterPrivate())
+{
+    content::BrowserContext* browserContext = ContentBrowserClientQt::Get()->browser_context();
+    webContentsDelegate.reset(new WebContentsDelegateQt(browserContext, NULL, MSG_ROUTING_NONE, gfx::Size()));
+    webContentsDelegate->m_viewClient = adapterClient;
+    WebContentsViewQt* contentsView = static_cast<WebContentsViewQt*>(webContentsDelegate->web_contents()->GetView());
+    contentsView->SetClient(adapterClient);
+}
+
+WebContentsAdapter::~WebContentsAdapter()
+{
+}
+
+bool WebContentsAdapter::canGoBack() const
+{
+    return webContents()->GetController().CanGoBack();
+}
+
+bool WebContentsAdapter::canGoForward() const
+{
+    return webContents()->GetController().CanGoForward();
+}
+bool WebContentsAdapter::isLoading() const
+{
+    return webContents()->IsLoading();
+}
+
+void WebContentsAdapter::navigateHistory(int offset)
+{
+    webContents()->GetController().GoToOffset(offset);
+    webContents()->GetView()->Focus();
+}
+
+void WebContentsAdapter::stop()
+{
+    content::NavigationController& controller = webContents()->GetController();
+
+    int index = controller.GetPendingEntryIndex();
+    if (index != -1)
+        controller.RemoveEntryAtIndex(index);
+
+    webContents()->GetView()->Focus();
+}
+
+void WebContentsAdapter::reload()
+{
+    webContents()->GetController().Reload(/*checkRepost = */false);
+    webContents()->GetView()->Focus();
+}
+
+void WebContentsAdapter::load(const QUrl &url)
+{
+    QString urlString = url.toString();
+    GURL gurl(urlString.toStdString());
+    if (!gurl.has_scheme())
+        gurl = GURL(std::string("http://") + urlString.toStdString());
+
+    content::NavigationController::LoadURLParams params(gurl);
+    params.transition_type = content::PageTransitionFromInt(content::PAGE_TRANSITION_TYPED | content::PAGE_TRANSITION_FROM_ADDRESS_BAR);
+    webContents()->GetController().LoadURLWithParams(params);
+    webContents()->GetView()->Focus();
+}
+
+QUrl WebContentsAdapter::activeUrl() const
+{
+    GURL gurl = webContents()->GetVisibleURL();
+    return QUrl(QString::fromStdString(gurl.spec()));
+}
+
+QString WebContentsAdapter::pageTitle() const
+{
+    content::NavigationEntry* entry = webContents()->GetController().GetVisibleEntry();
+    if (!entry)
+        return QString();
+    return QString::fromUtf16(entry->GetTitle().data());
+}
+
+content::WebContents *WebContentsAdapter::webContents() const
+{
+    Q_ASSERT(webContentsDelegate);
+    return webContentsDelegate->web_contents();
+}
diff --git a/lib/web_contents_adapter.h b/lib/web_contents_adapter.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc65cd0f94be469d7da43b7440d28b6c52d6b9d0
--- /dev/null
+++ b/lib/web_contents_adapter.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WEB_CONTENTS_ADAPTER_H
+#define WEB_CONTENTS_ADAPTER_H
+
+#include "qtwebengineglobal.h"
+
+#include <QScopedPointer>
+#include <QString>
+#include <QUrl>
+
+namespace content {
+class WebContents;
+}
+class WebContentsAdapterClient;
+class WebContentsDelegateQt;
+class WebContentsAdapterPrivate;
+
+class QWEBENGINE_EXPORT WebContentsAdapter {
+
+public:
+    WebContentsAdapter(WebContentsAdapterClient* adapterClient);
+    ~WebContentsAdapter();
+
+    bool canGoBack() const;
+    bool canGoForward() const;
+    bool isLoading() const;
+    void navigateHistory(int);
+    void stop();
+    void reload();
+    void load(const QUrl&);
+    QUrl activeUrl() const;
+    QString pageTitle() const;
+
+private:
+    inline content::WebContents* webContents() const;
+    QScopedPointer<WebContentsDelegateQt> webContentsDelegate;
+    QScopedPointer<WebContentsAdapterPrivate> d;
+};
+#endif // WEB_CONTENTS_ADAPTER_H
diff --git a/lib/web_contents_adapter_client.h b/lib/web_contents_adapter_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..c44b87bb12d3e09694d4271acf6d739e7ba09469
--- /dev/null
+++ b/lib/web_contents_adapter_client.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WEB_CONTENTS_ADAPTER_CLIENT_H
+#define WEB_CONTENTS_ADAPTER_CLIENT_H
+
+#include "qtwebengineglobal.h"
+
+#include <QString>
+#include <QUrl>
+
+
+class RenderWidgetHostViewQt;
+class RenderWidgetHostViewQtDelegate;
+class WebContentsDelegateQt;
+
+class QWEBENGINE_EXPORT WebContentsAdapterClient {
+public:
+    virtual ~WebContentsAdapterClient() { }
+
+    virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt*) = 0;
+    virtual void titleChanged(const QString&) = 0;
+    virtual void urlChanged(const QUrl&) = 0;
+    virtual void loadingStateChanged() = 0;
+};
+
+#endif // WEB_CONTENTS_ADAPTER_CLIENT_H
diff --git a/lib/web_contents_delegate_qt.cpp b/lib/web_contents_delegate_qt.cpp
index 5b6c39fb599f194009831409636d7f1efa0631e2..72a50ac1d30bb8824b3b907e2145f5714dbbb0ec 100644
--- a/lib/web_contents_delegate_qt.cpp
+++ b/lib/web_contents_delegate_qt.cpp
@@ -41,6 +41,8 @@
 
 #include "web_contents_delegate_qt.h"
 
+#include "web_contents_adapter_client.h"
+
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/notification_source.h"
@@ -59,6 +61,7 @@ static const int kTestWindowWidth = 800;
 static const int kTestWindowHeight = 600;
 
 WebContentsDelegateQt::WebContentsDelegateQt(content::BrowserContext* browser_context, content::SiteInstance* site_instance, int routing_id, const gfx::Size& initial_size)
+    : m_viewClient(0)
 {
     content::WebContents::CreateParams create_params(browser_context, site_instance);
     create_params.routing_id = routing_id;
@@ -82,15 +85,16 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::BrowserContext* browser_co
 void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* source, unsigned changed_flags)
 {
     if (changed_flags & content::INVALIDATE_TYPE_URL) {
+        Q_ASSERT(m_viewClient);
         GURL gurl = web_contents()->GetVisibleURL();
         QUrl url(QString::fromStdString(gurl.spec()));
-        Q_EMIT urlChanged(url);
+        m_viewClient->urlChanged(url);
     }
 }
 
 void WebContentsDelegateQt::LoadingStateChanged(content::WebContents* source)
 {
-    Q_EMIT loadingStateChanged();
+    m_viewClient->loadingStateChanged();
 }
 
 content::WebContents* WebContentsDelegateQt::web_contents()
diff --git a/lib/web_contents_delegate_qt.h b/lib/web_contents_delegate_qt.h
index dac00b980367efc396e7e3e9f888ae27910a1221..85fffcba94dc45a44ae47aeccd39bb11719f2332 100644
--- a/lib/web_contents_delegate_qt.h
+++ b/lib/web_contents_delegate_qt.h
@@ -52,11 +52,10 @@ namespace content {
     class BrowserContext;
     class SiteInstance;
 }
+class WebContentsAdapterClient;
 
-class WebContentsDelegateQt : public QObject
-                            , public content::WebContentsDelegate
+class WebContentsDelegateQt : public content::WebContentsDelegate
 {
-    Q_OBJECT
 public:
     WebContentsDelegateQt(content::BrowserContext*, content::SiteInstance*, int routing_id, const gfx::Size& initial_size);
     content::WebContents* web_contents();
@@ -64,13 +63,10 @@ public:
     virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags);
     virtual void LoadingStateChanged(content::WebContents* source);
 
-Q_SIGNALS:
-    void titleChanged(const QString& title);
-    void urlChanged(const QUrl& url);
-    void loadingStateChanged();
-
 private:
     scoped_ptr<content::WebContents> m_webContents;
+    WebContentsAdapterClient *m_viewClient;
+    friend class WebContentsAdapter;
 };
 
 #endif
diff --git a/lib/web_contents_view_qt.cpp b/lib/web_contents_view_qt.cpp
index 2a44da7ab36a413a005f91ccb1983bcb3e862ae9..ba588754103ae60821ba16828e9dea3f95ced93f 100644
--- a/lib/web_contents_view_qt.cpp
+++ b/lib/web_contents_view_qt.cpp
@@ -47,14 +47,6 @@
 
 #include "content/browser/renderer_host/render_view_host_impl.h"
 
-WebContentsViewQtClient::WebContentsViewQtClient()
-// This has to be the first thing we do.
-    : context(WebEngineContext::current())
-{
-    content::BrowserContext* browser_context = ContentBrowserClientQt::Get()->browser_context();
-    webContentsDelegate.reset(new WebContentsDelegateQt(browser_context, NULL, MSG_ROUTING_NONE, gfx::Size()));
-}
-
 content::RenderWidgetHostView* WebContentsViewQt::CreateViewForWidget(content::RenderWidgetHost* render_widget_host)
 {
     RenderWidgetHostViewQt *view = new RenderWidgetHostViewQt(render_widget_host);
@@ -67,14 +59,13 @@ content::RenderWidgetHostView* WebContentsViewQt::CreateViewForWidget(content::R
 void WebContentsViewQt::SetPageTitle(const string16& title)
 {
     QString string = QString::fromUtf16(title.data());
-    Q_EMIT m_client->webContentsDelegate->titleChanged(string);
+    m_client->titleChanged(string);
 }
 
 void WebContentsViewQt::GetContainerBounds(gfx::Rect* out) const
 {
-    content::RenderWidgetHostView* rwhv = m_client->webContentsDelegate->web_contents()->GetRenderWidgetHostView();
-    if (rwhv)
-      *out = rwhv->GetViewBounds();
+    const QRectF r(m_viewDelegate->screenRect());
+    *out = gfx::Rect(r.x(), r.y(), r.width(), r.height());
 }
 
 void WebContentsViewQt::Focus()
diff --git a/lib/web_contents_view_qt.h b/lib/web_contents_view_qt.h
index c7853adda5a24d6706be74581b843eb508e5d953..0eb0cb08601492194d98ca5b5644b0f6c503afbc 100644
--- a/lib/web_contents_view_qt.h
+++ b/lib/web_contents_view_qt.h
@@ -48,20 +48,11 @@
 #include "content/port/browser/render_view_host_delegate_view.h"
 #include "content/port/browser/web_contents_view_port.h"
 
+#include "web_contents_adapter_client.h"
 #include "render_widget_host_view_qt.h"
 #include "web_contents_delegate_qt.h"
 #include "web_engine_context.h"
 
-class WebContentsViewQtClient {
-public:
-    WebContentsViewQtClient();
-    virtual ~WebContentsViewQtClient() { }
-    virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *view) = 0;
-
-    scoped_refptr<WebEngineContext> context;
-    scoped_ptr<WebContentsDelegateQt> webContentsDelegate;
-};
-
 class WebContentsViewQt
     : public content::WebContentsViewPort
     , public content::RenderViewHostDelegateView
@@ -71,7 +62,7 @@ public:
         : m_client(0)
     { }
 
-    void SetClient(WebContentsViewQtClient* client) { m_client = client; }
+    void SetClient(WebContentsAdapterClient* client) { m_client = client; }
 
     virtual content::RenderWidgetHostView *CreateViewForWidget(content::RenderWidgetHost* render_widget_host);
 
@@ -122,7 +113,7 @@ public:
 #endif // defined(OS_MACOSX)
 
 private:
-    WebContentsViewQtClient* m_client;
+    WebContentsAdapterClient* m_client;
     RenderWidgetHostViewQtDelegate* m_viewDelegate;
 };
 
diff --git a/lib/web_event_factory.cpp b/lib/web_event_factory.cpp
index 388e0f9b29e5e647f338dfe3b5e41af134f47884..40b6b5e6fd7b5a41f34fd877a42c8f43e9547152 100644
--- a/lib/web_event_factory.cpp
+++ b/lib/web_event_factory.cpp
@@ -43,13 +43,14 @@
 #include "web_event_factory.h"
 #include "third_party/WebKit/Source/core/platform/WindowsKeyboardCodes.h"
 
-#include <QApplication>
 #include <QElapsedTimer>
 #include <QEvent>
 #include <QKeyEvent>
 #include <QMouseEvent>
 #include <QWheelEvent>
 
+static const int wheelScrollLines = 3; // FIXME: Still not available in QStyleHints in 5.1
+
 using namespace WebKit;
 
 static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
@@ -593,8 +594,6 @@ WebKit::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev)
     // Use the same single scroll step as QTextEdit (in QTextEditPrivate::init [h,v]bar->setSingleStep)
     static const float cDefaultQtScrollStep = 20.f;
 
-    const int wheelScrollLines = qApp->wheelScrollLines(); // can be hardcoded to 3 if we don't want to depend on QtWidgets
-
     webEvent.deltaX = webEvent.wheelTicksX * wheelScrollLines * cDefaultQtScrollStep;
     webEvent.deltaY = webEvent.wheelTicksY * wheelScrollLines * cDefaultQtScrollStep;
 
diff --git a/lib/qwebcontentsview.cpp b/lib/widgets/Api/qwebcontentsview.cpp
similarity index 57%
rename from lib/qwebcontentsview.cpp
rename to lib/widgets/Api/qwebcontentsview.cpp
index fced1e1be73f2a8fb059c54ca9ed4df2c847f535..612f7699b1c74e60253ed6ac337e48b30387bf4a 100644
--- a/lib/qwebcontentsview.cpp
+++ b/lib/widgets/Api/qwebcontentsview.cpp
@@ -42,30 +42,57 @@
 #include "qwebcontentsview.h"
 #include "qwebcontentsview_p.h"
 
-#include "content/public/browser/web_contents.h"
-
-#include "content_browser_client_qt.h"
 #include "render_widget_host_view_qt_delegate_widget.h"
-#include "web_contents_delegate_qt.h"
-#include "web_engine_context.h"
+#include "web_contents_adapter.h"
 
 #include <QStackedLayout>
 #include <QUrl>
 
+QWebContentsViewPrivate::QWebContentsViewPrivate()
+    : m_isLoading(false)
+    , adapter(new WebContentsAdapter(this))
+{
+}
+
+void QWebContentsViewPrivate::titleChanged(const QString &title)
+{
+    Q_EMIT q_ptr->titleChanged(title);
+}
+
+void QWebContentsViewPrivate::urlChanged(const QUrl &url)
+{
+    Q_EMIT q_ptr->urlChanged(url);
+}
+
+void QWebContentsViewPrivate::loadingStateChanged()
+{
+    Q_Q(QWebContentsView);
+    const bool wasLoading = m_isLoading;
+    m_isLoading = adapter->isLoading();
+    if (m_isLoading != wasLoading) {
+        if (m_isLoading)
+            Q_EMIT q->loadStarted();
+        else
+            Q_EMIT q->loadFinished(true);
+    }
+}
+
+RenderWidgetHostViewQtDelegate *QWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt* rwhv)
+{
+    Q_Q(QWebContentsView);
+    RenderWidgetHostViewQtDelegateWidget *viewDelegate = new RenderWidgetHostViewQtDelegateWidget(q);
+    viewDelegate->resetView(rwhv);
+    // Parent the RWHVQtDelegate directly, this might have to be changed to handle popups and fullscreen.
+    q->layout()->addWidget(viewDelegate);
+    return viewDelegate;
+}
 
 QWebContentsView::QWebContentsView()
     : d_ptr(new QWebContentsViewPrivate)
 {
-    d_ptr->q_ptr = this;
-
-    Q_D(QWebContentsView);
+    d_ptr->q_ptr=this;
     // This causes the child RenderWidgetHostViewQtDelegateWidgets to fill this widget.
     setLayout(new QStackedLayout);
-
-    WebContentsDelegateQt* delegate = d->webContentsDelegate.get();
-    connect(delegate, SIGNAL(titleChanged(const QString&)), this, SIGNAL(titleChanged(const QString&)));
-    connect(delegate, SIGNAL(urlChanged(const QUrl&)), this, SIGNAL(urlChanged(const QUrl&)));
-    connect(delegate, SIGNAL(loadingStateChanged()), this, SLOT(_q_onLoadingStateChanged()));
 }
 
 QWebContentsView::~QWebContentsView()
@@ -75,90 +102,43 @@ QWebContentsView::~QWebContentsView()
 void QWebContentsView::load(const QUrl& url)
 {
     Q_D(QWebContentsView);
-    QString urlString = url.toString();
-    GURL gurl(urlString.toStdString());
-    if (!gurl.has_scheme())
-        gurl = GURL(std::string("http://") + urlString.toStdString());
-
-    content::NavigationController::LoadURLParams params(gurl);
-    params.transition_type = content::PageTransitionFromInt(content::PAGE_TRANSITION_TYPED | content::PAGE_TRANSITION_FROM_ADDRESS_BAR);
-    d->webContentsDelegate->web_contents()->GetController().LoadURLWithParams(params);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->load(url);
 }
 
 bool QWebContentsView::canGoBack() const
 {
     Q_D(const QWebContentsView);
-    return d->webContentsDelegate->web_contents()->GetController().CanGoBack();
+    return d->adapter->canGoBack();
 }
 
 bool QWebContentsView::canGoForward() const
 {
     Q_D(const QWebContentsView);
-    return d->webContentsDelegate->web_contents()->GetController().CanGoForward();
+    return d->adapter->canGoForward();
 }
 
 void QWebContentsView::back()
 {
     Q_D(QWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().GoToOffset(-1);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->navigateHistory(-1);
 }
 
 void QWebContentsView::forward()
 {
     Q_D(QWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().GoToOffset(1);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->navigateHistory(1);
 }
 
 void QWebContentsView::reload()
 {
     Q_D(QWebContentsView);
-    d->webContentsDelegate->web_contents()->GetController().Reload(false);
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
+    d->adapter->reload();
 }
 
 void QWebContentsView::stop()
 {
     Q_D(QWebContentsView);
-    content::NavigationController& controller = d->webContentsDelegate->web_contents()->GetController();
-
-    int index = controller.GetPendingEntryIndex();
-    if (index != -1)
-        controller.RemoveEntryAtIndex(index);
-
-    d->webContentsDelegate->web_contents()->GetView()->Focus();
-
-}
-
-QWebContentsViewPrivate::QWebContentsViewPrivate()
-    : m_isLoading(false)
-{
-    WebContentsViewQt* contents_view = static_cast<WebContentsViewQt*>(webContentsDelegate->web_contents()->GetView());
-    contents_view->SetClient(this);
-}
-
-void QWebContentsViewPrivate::_q_onLoadingStateChanged()
-{
-    Q_Q(QWebContentsView);
-    bool isLoading = webContentsDelegate->web_contents()->IsLoading();
-    if (m_isLoading != isLoading) {
-        m_isLoading = isLoading;
-        if (m_isLoading)
-            Q_EMIT q->loadStarted();
-        else
-            Q_EMIT q->loadFinished(true);
-    }
-}
-
-RenderWidgetHostViewQtDelegate *QWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *view)
-{
-    Q_Q(QWebContentsView);
-    RenderWidgetHostViewQtDelegateWidget *viewDelegate = new RenderWidgetHostViewQtDelegateWidget(view, q);
-    // Parent the RWHV directly, this might have to be changed to handle popups and fullscreen.
-    q->layout()->addWidget(viewDelegate);
-    return viewDelegate;
+    d->adapter->stop();
 }
 
 #include "moc_qwebcontentsview.cpp"
diff --git a/lib/qwebcontentsview.h b/lib/widgets/Api/qwebcontentsview.h
similarity index 91%
rename from lib/qwebcontentsview.h
rename to lib/widgets/Api/qwebcontentsview.h
index b9753c7199fb33952842e47e9768c9edb8752876..92f41c6a6c01be783a9fa5f0fb83690576edb53f 100644
--- a/lib/qwebcontentsview.h
+++ b/lib/widgets/Api/qwebcontentsview.h
@@ -42,12 +42,14 @@
 #ifndef QWEBCONTESTSVIEW_H
 #define QWEBCONTESTSVIEW_H
 
+#include <qtwebengineglobal.h>
+
 #include <QWidget>
 #include <QScopedPointer>
 
 class QWebContentsViewPrivate;
 
-class Q_DECL_EXPORT QWebContentsView : public QWidget {
+class QWEBENGINEWIDGETS_EXPORT QWebContentsView : public QWidget {
     Q_OBJECT
 public:
     QWebContentsView();
@@ -70,10 +72,7 @@ Q_SIGNALS:
     void urlChanged(const QUrl& url);
 
 private:
-    Q_DECLARE_PRIVATE(QWebContentsView)
-    Q_PRIVATE_SLOT(d_func(), void _q_onLoadingStateChanged());
-
-    // Hides QObject::d_ptr allowing us to use the convenience macros.
+    Q_DECLARE_PRIVATE(QWebContentsView);
     QScopedPointer<QWebContentsViewPrivate> d_ptr;
 };
 
diff --git a/lib/qwebcontentsview_p.h b/lib/widgets/Api/qwebcontentsview_p.h
similarity index 81%
rename from lib/qwebcontentsview_p.h
rename to lib/widgets/Api/qwebcontentsview_p.h
index 123d028e60fbda93fdbf92b76b850e0f51f629c7..ba3739c4b087b3faa3e9355be992b538a7619482 100644
--- a/lib/qwebcontentsview_p.h
+++ b/lib/widgets/Api/qwebcontentsview_p.h
@@ -42,24 +42,29 @@
 #ifndef QWEBCONTESTSVIEWPRIVATE_H
 #define QWEBCONTESTSVIEWPRIVATE_H
 
-#include "web_contents_view_qt.h"
+#include "web_contents_adapter_client.h"
 
 #include <QScopedPointer>
 
 class QWebContentsView;
+class RenderWidgetHostViewQtDelegate;
+class WebContentsAdapter;
 
-class QWebContentsViewPrivate : public WebContentsViewQtClient
+class QWebContentsViewPrivate : public WebContentsAdapterClient
 {
-    QWebContentsView *q_ptr;
     Q_DECLARE_PUBLIC(QWebContentsView)
+    QWebContentsView *q_ptr;
+
 public:
     QWebContentsViewPrivate();
 
-    RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *view) Q_DECL_OVERRIDE;
-
-    void _q_onLoadingStateChanged();
+    virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *) Q_DECL_OVERRIDE;
+    virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
+    virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
+    virtual void loadingStateChanged() Q_DECL_OVERRIDE;
 
     bool m_isLoading;
+    QScopedPointer<WebContentsAdapter> adapter;
 };
 
 #endif
diff --git a/lib/render_widget_host_view_qt_delegate_widget.cpp b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp
similarity index 83%
rename from lib/render_widget_host_view_qt_delegate_widget.cpp
rename to lib/widgets/render_widget_host_view_qt_delegate_widget.cpp
index 5baf6a3b09b70d2a9456fd4fe0a00a825a4d7844..d90190edbca0631a91f8f08fefb5ea40b381b717 100644
--- a/lib/render_widget_host_view_qt_delegate_widget.cpp
+++ b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -41,18 +41,12 @@
 
 #include "render_widget_host_view_qt_delegate_widget.h"
 
-#include "backing_store_qt.h"
-#include "render_widget_host_view_qt.h"
-
-#include "content/browser/renderer_host/render_view_host_impl.h"
-
 #include <QResizeEvent>
+#include <QPainter>
 #include <QPaintEvent>
 
-RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(RenderWidgetHostViewQt* view, QWidget *parent)
+RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(QWidget *parent)
     : QWidget(parent)
-    , RenderWidgetHostViewQtDelegate(view)
-    , m_painter(0)
 {
     setFocusPolicy(Qt::ClickFocus);
     setAttribute(Qt::WA_AcceptTouchEvents);
@@ -101,27 +95,20 @@ void RenderWidgetHostViewQtDelegateWidget::update(const QRect& rect)
 
 void RenderWidgetHostViewQtDelegateWidget::paintEvent(QPaintEvent * event)
 {
-    if (BackingStoreQt *backingStore = m_view->GetBackingStore()) {
-        QPainter painter(this);
-        backingStore->paintToTarget(&painter, event->rect());
-    }
-}
-
-QPainter* RenderWidgetHostViewQtDelegateWidget::painter()
-{
-    if (!m_painter)
-        m_painter = new QPainter(this);
-    return m_painter;
+    QPainter painter(this);
+    fetchBackingStore();
+    paint(&painter, event->rect());
 }
 
 void RenderWidgetHostViewQtDelegateWidget::resizeEvent(QResizeEvent *resizeEvent)
 {
-    m_view->GetRenderWidgetHost()->WasResized();
+    Q_UNUSED(resizeEvent);
+    notifyResize();
 }
 
 bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event)
 {
-    if (!m_view || !m_view->handleEvent(event))
+    if (!forwardEvent(event))
         return QWidget::event(event);
     return true;
 }
diff --git a/lib/render_widget_host_view_qt_delegate_widget.h b/lib/widgets/render_widget_host_view_qt_delegate_widget.h
similarity index 94%
rename from lib/render_widget_host_view_qt_delegate_widget.h
rename to lib/widgets/render_widget_host_view_qt_delegate_widget.h
index 40e50889d0fadedb4d52739345f9b35c9d13ccf1..fbde05ce4254fc26f7ad90038f8829c933c0790c 100644
--- a/lib/render_widget_host_view_qt_delegate_widget.h
+++ b/lib/widgets/render_widget_host_view_qt_delegate_widget.h
@@ -52,7 +52,7 @@ class QWindow;
 class RenderWidgetHostViewQtDelegateWidget : public QWidget, public RenderWidgetHostViewQtDelegate
 {
 public:
-    RenderWidgetHostViewQtDelegateWidget(RenderWidgetHostViewQt* view, QWidget *parent = 0);
+    RenderWidgetHostViewQtDelegateWidget(QWidget *parent = 0);
 
     virtual QRectF screenRect() const;
     virtual void setKeyboardFocus();
@@ -63,15 +63,11 @@ public:
     virtual QWindow* window() const;
     virtual void update(const QRect& rect = QRect());
 
-    QPainter* painter();
-
 protected:
     void paintEvent(QPaintEvent * event);
     bool event(QEvent *event);
     void resizeEvent(QResizeEvent *resizeEvent);
 
-private:
-    QPainter* m_painter;
 };
 
 #endif
diff --git a/lib/widgets/widgets.pro b/lib/widgets/widgets.pro
new file mode 100644
index 0000000000000000000000000000000000000000..351264d57355a31fb731c44ce4b496d854622854
--- /dev/null
+++ b/lib/widgets/widgets.pro
@@ -0,0 +1,33 @@
+# Use Qt5 module system
+load(qt_build_config)
+
+TEMPLATE = lib
+TARGET = QtWebEngineWidgets
+
+MODULE = webenginewidgets
+
+# For our export macros
+DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
+
+QT += widgets
+
+# FIXME: all this should eventually be turned into QT += webenginecore
+macx:LIBPATH = $$getOutDir()/$$getConfigDir()
+else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
+LIBS += -L$$LIBPATH -lQt5WebEngineCore
+QMAKE_RPATHDIR += $$LIBPATH
+
+DESTDIR = $$LIBPATH
+
+INCLUDEPATH += ../
+
+SOURCES = \
+        Api/qwebcontentsview.cpp\
+        render_widget_host_view_qt_delegate_widget.cpp
+
+HEADERS = \
+        Api/qwebcontentsview.h \
+        Api/qwebcontentsview_p.h \
+        render_widget_host_view_qt_delegate_widget.h
+
+load(qt_module)
diff --git a/qtwebengine.pro b/qtwebengine.pro
index c15cb1919ed549e46d317161fc4c4c5509733dc7..49108691f3ec53b042bdbad50133d66eab98eb20 100644
--- a/qtwebengine.pro
+++ b/qtwebengine.pro
@@ -9,7 +9,11 @@ SUBDIRS = resources \
           lib \
           process \
           build \ # This is where we use the generated qt_generated.gypi and run gyp
-          examples \
+          # Now build the API libraries
+          lib/quick
+qtHaveModule(widgets): SUBDIRS += lib/widgets
+
+SUBDIRS += examples
 
 # Ninja executable location needs to be determined early for extra targets. Should be fetched from cache most of the time anyway.
 NINJA_EXECUTABLE = $$findNinja()
diff --git a/sync.profile b/sync.profile
index 24a6cba89ba6db8555f7940d29030480886898de..da4707588133f14d5145081c05702fd8292cc669 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,7 +1,23 @@
-# A list of Qt dependencies to build QtWebEngine.
+%modules = ( # path to module name map
+    "QtWebEngineWidgets" => "$basedir/lib/widgets",
+);
+%moduleheaders = ( # restrict the module headers to those found in relative path
+    "QtWebEngineWidgets" => "Api",
+);
+%classnames = (
+);
+
+# Module dependencies.
+# Every module that is required to build this module should have one entry.
+# Each of the module version specifiers can take one of the following values:
+#   - A specific Git revision.
+#   - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
+#
 %dependencies = (
-        "qtbase" => "refs/heads/stable",
-        "qtxmlpatterns" => "refs/heads/stable",
-        "qtjsbackend" => "refs/heads/stable",
-        "qtdeclartive" => "refs/heads/stable",
+    "qtbase" => "refs/heads/stable",
+    "qtdeclarative" => "refs/heads/stable",
+    "qtjsbackend" => "refs/heads/stable",
+    "qtxmlpatterns" => "refs/heads/stable",
+# FIXME: take examples out into their own module to avoid a potential circular dependency later ?
+    "qtquickcontrols" => "refs/heads/stable",
 );