summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-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
12 files changed, 428 insertions, 2 deletions
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());