summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-01-15 19:06:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 08:45:14 +0100
commit3fcd31f5bd86cb568b1ca4f4f5c7c12c6675dceb (patch)
tree174654f0843830a86f80c3a379442708003e4f7e
parent6d760436bc0d7081d5bdb50e4141171b6ba940ee (diff)
Add a stub message system to communicate with the blink WebView
This follows the model used by the Android WebView's AwRenderViewExt class. QtRenderViewObserverHost is attached to the WebContents and QtRenderViewObserver is attached to the RenderView in the render process. Both can exchange messages together and allow async commands to be carried from WebContentsAdapter and the result sent back through WebContentsAdapterClient. This patch also adds a renderer subdirectory to start matching the directory structure of Chromium. Change-Id: I724ca2fe2a597dcd2a15e8e1a23c4eeba1190703 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
-rw-r--r--patches/0001-Declare-a-Qt-IPC-message-class.patch28
-rwxr-xr-xpatches/patch-chromium.sh1
m---------src/3rdparty0
-rw-r--r--src/core/common/qt_messages.cpp34
-rw-r--r--src/core/common/qt_messages.h20
-rw-r--r--src/core/content_main_delegate_qt.cpp6
-rw-r--r--src/core/content_main_delegate_qt.h1
-rw-r--r--src/core/core_gyp_generator.pro10
-rw-r--r--src/core/qt_render_view_observer_host.cpp72
-rw-r--r--src/core/qt_render_view_observer_host.h65
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp50
-rw-r--r--src/core/renderer/content_renderer_client_qt.h49
-rw-r--r--src/core/renderer/qt_render_view_observer.cpp64
-rw-r--r--src/core/renderer/qt_render_view_observer.h54
-rw-r--r--src/core/web_contents_adapter.cpp5
15 files changed, 457 insertions, 2 deletions
diff --git a/patches/0001-Declare-a-Qt-IPC-message-class.patch b/patches/0001-Declare-a-Qt-IPC-message-class.patch
new file mode 100644
index 000000000..b86968800
--- /dev/null
+++ b/patches/0001-Declare-a-Qt-IPC-message-class.patch
@@ -0,0 +1,28 @@
+From de3f8ee976ac7e438616bc28dac2cb418781b103 Mon Sep 17 00:00:00 2001
+From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
+Date: Wed, 15 Jan 2014 17:22:44 +0100
+Subject: [PATCH] Declare a Qt IPC message class
+
+This allows Qt-specific IPC messages to be declared in QtWebEngine.
+
+Change-Id: Id6af79becf14c8c621df6752c6183ff550524859
+Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
+---
+ ipc/ipc_message_start.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h
+index a8cca53..314ed0e 100644
+--- a/ipc/ipc_message_start.h
++++ b/ipc/ipc_message_start.h
+@@ -10,6 +10,7 @@
+ // code to figure out the message class from its ID.
+ enum IPCMessageStart {
+ AutomationMsgStart = 0,
++ QtMsgStart,
+ ViewMsgStart,
+ InputMsgStart,
+ PluginMsgStart,
+--
+1.8.4.2
+
diff --git a/patches/patch-chromium.sh b/patches/patch-chromium.sh
index a048d2e7d..7dd0f153e 100755
--- a/patches/patch-chromium.sh
+++ b/patches/patch-chromium.sh
@@ -69,6 +69,7 @@ git am $PATCH_DIR/0001-Fix-the-build-with-a-GL-ES2-configured-Qt.patch
git am $PATCH_DIR/0001-Hide-the-definition-of-MessagePumpGtk-GetDefaultXDis.patch
git am $PATCH_DIR/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch
git am $PATCH_DIR/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch
+git am $PATCH_DIR/0001-Declare-a-Qt-IPC-message-class.patch
cd $CHROMIUM_SRC_DIR/third_party/WebKit
echo "Entering $PWD"
diff --git a/src/3rdparty b/src/3rdparty
-Subproject e4d96858acc5c6c1bfa47fe4a6a3b8bbf986e60
+Subproject b89ebf898a48afcaaa4fb48e6f3f3cbd8febd13
diff --git a/src/core/common/qt_messages.cpp b/src/core/common/qt_messages.cpp
new file mode 100644
index 000000000..43c29ad93
--- /dev/null
+++ b/src/core/common/qt_messages.cpp
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "common/qt_messages.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "common/qt_messages.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "common/qt_messages.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "common/qt_messages.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "common/qt_messages.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "common/qt_messages.h"
+} // namespace IPC
+
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
new file mode 100644
index 000000000..77be79360
--- /dev/null
+++ b/src/core/common/qt_messages.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, no traditional include guard.
+#include "ipc/ipc_message_macros.h"
+
+// Singly-included section for enums and custom IPC traits.
+#ifndef RENDER_VIEW_MESSAGES_H
+#define RENDER_VIEW_MESSAGES_H
+
+namespace IPC {
+
+// TODO - add enums and custom IPC traits here when needed.
+
+} // namespace IPC
+
+#endif // RENDER_VIEW_MESSAGES_H
+
+#define IPC_MESSAGE_START QtMsgStart
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 8fe2f3378..a8e5386de 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -49,6 +49,7 @@
#include "net/base/net_module.h"
#include "content_client_qt.h"
+#include "renderer/content_renderer_client_qt.h"
#include "web_engine_library_info.h"
static base::StringPiece PlatformResourceProvider(int key) {
@@ -74,6 +75,11 @@ content::ContentBrowserClient *ContentMainDelegateQt::CreateContentBrowserClient
return m_browserClient.get();
}
+content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClient()
+{
+ return new ContentRendererClientQt;
+}
+
bool ContentMainDelegateQt::BasicStartupComplete(int *exit_code)
{
SetContentClient(new ContentClientQt);
diff --git a/src/core/content_main_delegate_qt.h b/src/core/content_main_delegate_qt.h
index af58bc323..71a0aaa34 100644
--- a/src/core/content_main_delegate_qt.h
+++ b/src/core/content_main_delegate_qt.h
@@ -59,6 +59,7 @@ public:
void PreSandboxStartup() Q_DECL_OVERRIDE;
content::ContentBrowserClient* CreateContentBrowserClient() Q_DECL_OVERRIDE;
+ content::ContentRendererClient* CreateContentRendererClient() Q_DECL_OVERRIDE;
bool BasicStartupComplete(int* /*exit_code*/) Q_DECL_OVERRIDE;
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index a22b9126a..b6fb85418 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -29,11 +29,12 @@ CONFIG(release, debug|release): DEFINES += NDEBUG
RESOURCES += devtools.qrc
# something fishy with qmake in 5.2 ?
-INCLUDEPATH += $$[QT_INSTALL_HEADERS]
+INCLUDEPATH += $$[QT_INSTALL_HEADERS] $$PWD
SOURCES = \
backing_store_qt.cpp \
chromium_overrides.cpp \
+ common/qt_messages.cpp \
content_client_qt.cpp \
content_browser_client_qt.cpp \
content_main_delegate_qt.cpp \
@@ -44,7 +45,10 @@ SOURCES = \
javascript_dialog_controller.cpp \
javascript_dialog_manager_qt.cpp \
process_main.cpp \
+ qt_render_view_observer_host.cpp \
render_widget_host_view_qt.cpp \
+ renderer/content_renderer_client_qt.cpp \
+ renderer/qt_render_view_observer.cpp \
resource_bundle_qt.cpp \
resource_context_qt.cpp \
url_request_context_getter_qt.cpp \
@@ -63,6 +67,7 @@ HEADERS = \
backing_store_qt.h \
browser_context_qt.h \
chromium_overrides.h \
+ common/qt_messages.h \
content_client_qt.h \
content_browser_client_qt.h \
content_main_delegate_qt.h \
@@ -74,8 +79,11 @@ HEADERS = \
javascript_dialog_controller.h \
javascript_dialog_manager_qt.h \
process_main.h \
+ qt_render_view_observer_host.h \
render_widget_host_view_qt.h \
render_widget_host_view_qt_delegate.h \
+ renderer/content_renderer_client_qt.h \
+ renderer/qt_render_view_observer.h \
resource_context_qt.h \
url_request_context_getter_qt.h \
web_contents_adapter.h \
diff --git a/src/core/qt_render_view_observer_host.cpp b/src/core/qt_render_view_observer_host.cpp
new file mode 100644
index 000000000..fec2c4b0c
--- /dev/null
+++ b/src/core/qt_render_view_observer_host.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 "qt_render_view_observer_host.h"
+
+#include "common/qt_messages.h"
+#include "type_conversion.h"
+#include "web_contents_adapter_client.h"
+
+QtRenderViewObserverHost::QtRenderViewObserverHost(content::WebContents *webContents, WebContentsAdapterClient *adapterClient)
+ : content::WebContentsObserver(webContents)
+ , m_adapterClient(adapterClient)
+{
+}
+
+bool QtRenderViewObserverHost::OnMessageReceived(const IPC::Message& message)
+{
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(QtRenderViewObserverHost, message)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+
+}
+
+void QtRenderViewObserverHost::onDidFetchDocumentMarkup(const base::string16& markup, quint64 requestId)
+{
+ m_adapterClient->didFetchDocumentMarkup(toQt(markup), requestId);
+}
+
+void QtRenderViewObserverHost::onDidFetchDocumentInnerText(const base::string16& innerText, quint64 requestId)
+{
+ m_adapterClient->didFetchDocumentInnerText(toQt(innerText), requestId);
+}
diff --git a/src/core/qt_render_view_observer_host.h b/src/core/qt_render_view_observer_host.h
new file mode 100644
index 000000000..61b6a4124
--- /dev/null
+++ b/src/core/qt_render_view_observer_host.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 QT_RENDER_VIEW_OBSERVER_HOST_H
+#define QT_RENDER_VIEW_OBSERVER_HOST_H
+
+#include "content/public/browser/web_contents_observer.h"
+
+#include <QtGlobal>
+
+namespace content {
+ class WebContents;
+}
+class WebContentsAdapterClient;
+
+class QtRenderViewObserverHost : public content::WebContentsObserver
+{
+public:
+ QtRenderViewObserverHost(content::WebContents*, WebContentsAdapterClient *adapterClient);
+
+private:
+ bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE;
+
+ WebContentsAdapterClient *m_adapterClient;
+};
+
+#endif // QT_RENDER_VIEW_OBSERVER_HOST_H
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
new file mode 100644
index 000000000..0b497a004
--- /dev/null
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 "renderer/content_renderer_client_qt.h"
+
+#include "renderer/qt_render_view_observer.h"
+
+void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view)
+{
+ // RenderViewObserver destroys itself with its RenderView.
+ new QtRenderViewObserver(render_view);
+}
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
new file mode 100644
index 000000000..9be3d5dc8
--- /dev/null
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 "content/public/renderer/content_renderer_client.h"
+
+#include <QtGlobal>
+
+class ContentRendererClientQt : public content::ContentRendererClient {
+public:
+ virtual void RenderViewCreated(content::RenderView* render_view) Q_DECL_OVERRIDE;
+};
diff --git a/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp
new file mode 100644
index 000000000..b3b4c38c4
--- /dev/null
+++ b/src/core/renderer/qt_render_view_observer.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 "renderer/qt_render_view_observer.h"
+
+#include "common/qt_messages.h"
+
+#include "content/public/renderer/render_view.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebElement.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebView.h"
+
+QtRenderViewObserver::QtRenderViewObserver(content::RenderView* render_view)
+ : content::RenderViewObserver(render_view)
+{
+}
+
+bool QtRenderViewObserver::OnMessageReceived(const IPC::Message& message)
+{
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(QtRenderViewObserver, message)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
diff --git a/src/core/renderer/qt_render_view_observer.h b/src/core/renderer/qt_render_view_observer.h
new file mode 100644
index 000000000..8c5713c4a
--- /dev/null
+++ b/src/core/renderer/qt_render_view_observer.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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 "content/public/renderer/render_view_observer.h"
+
+#include <QtGlobal>
+
+class QtRenderViewObserver : public content::RenderViewObserver {
+public:
+ QtRenderViewObserver(content::RenderView* render_view);
+
+private:
+ virtual bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(QtRenderViewObserver);
+};
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 56b56ce33..bd3be1744 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -43,6 +43,7 @@
#include "browser_context_qt.h"
#include "content_browser_client_qt.h"
#include "javascript_dialog_manager_qt.h"
+#include "qt_render_view_observer_host.h"
#include "type_conversion.h"
#include "web_contents_adapter_client.h"
#include "web_contents_delegate_qt.h"
@@ -167,6 +168,7 @@ public:
scoped_refptr<WebEngineContext> engineContext;
scoped_ptr<content::WebContents> webContents;
scoped_ptr<WebContentsDelegateQt> webContentsDelegate;
+ scoped_ptr<QtRenderViewObserverHost> renderViewObserverHost;
WebContentsAdapterClient *adapterClient;
quint64 lastRequestId;
};
@@ -211,8 +213,9 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient)
rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000;
d->webContents->GetRenderViewHost()->SyncRendererPrefs();
- // Create and attach a WebContentsDelegateQt to the WebContents.
+ // Create and attach observers to the WebContents.
d->webContentsDelegate.reset(new WebContentsDelegateQt(d->webContents.get(), adapterClient));
+ d->renderViewObserverHost.reset(new QtRenderViewObserverHost(d->webContents.get(), adapterClient));
// Let the WebContent's view know about the WebContentsAdapterClient.
WebContentsViewQt* contentsView = static_cast<WebContentsViewQt*>(d->webContents->GetView());