Source

Target

Commits (17)
Showing with 305 additions and 32 deletions
examples/webengine/quicknanobrowser/doc/images/quicknanobrowser-demo.jpg

29.4 KB

/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example quicknanobrowser
\title WebEngine Quick Nano Browser
\ingroup webengine-examples
\brief A web browser implemented using the WebEngineView QML type.
The Quick Nano Browser demo shows the \l{Qt WebEngine} module in action,
providing a little QML web browser with support for tabs and keyboard
shortcuts.
\image quicknanobrowser-demo.jpg
\include examples-run.qdocinc
*/
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
......@@ -28,10 +28,13 @@
/*!
\example browser
\title WebEngine Tab Browser Example
\ingroup webengine-widgetexamples
\brief The QtWebKit browser example ported to use QtWebEngine
The Tab Browser example shows the \l{Qt WebEngine Widgets} module in action,
providing a little Web browser application with support for tabs.
\image browser-demo.png
\include examples-run.qdocinc
*/
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
......@@ -28,6 +28,7 @@
/*!
\example fancybrowser
\title WebEngine Fancy Browser Example
\ingroup webengine-widgetexamples
\brief Demonstrates how to use browse web and manipulate content
\brief The Fancy Browser example shows how to use JQuery with QtWebEngine to
......@@ -40,6 +41,8 @@
evaluate the jQuery JavaScript code. A QMainWindow with a QWebEngineView
as central widget builds up the browser itself.
\include examples-run.qdocinc
\section1 MainWindow Class Definition
The \c MainWindow class inherits QMainWindow. It implements a number of
......
Subproject commit 0dcd4e35086a90f643bb721fad1ef786f5fff8ba
Subproject commit 577cd47e54bb88c81b7a5b5a6d658d8d61b2c747
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleVersion</key>
<string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>@TYPEINFO@</string>
<key>CFBundleExecutable</key>
<string>@LIBRARY@</string>
<key>CFBundleIdentifier</key>
<string>org.qt-project.Qt.QtWebEngineCore</string>
</dict>
</plist>
/****************************************************************************
**
** 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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later 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 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "access_token_store_qt.h"
#include <QDebug>
AccessTokenStoreQt::AccessTokenStoreQt()
{
}
AccessTokenStoreQt::~AccessTokenStoreQt()
{
}
void AccessTokenStoreQt::LoadAccessTokens(const LoadAccessTokensCallbackType& callback)
{
}
void AccessTokenStoreQt::SaveAccessToken(const GURL& server_url, const base::string16& access_token)
{
}
/****************************************************************************
**
** 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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later 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 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ACCESS_TOKEN_STORE_QT_H
#define ACCESS_TOKEN_STORE_QT_H
#include "content/public/browser/access_token_store.h"
#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE
class AccessTokenStoreQt : public content::AccessTokenStore
{
public:
AccessTokenStoreQt();
~AccessTokenStoreQt();
virtual void LoadAccessTokens(const LoadAccessTokensCallbackType& callback) Q_DECL_OVERRIDE;
virtual void SaveAccessToken(const GURL& server_url, const base::string16& access_token) Q_DECL_OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(AccessTokenStoreQt);
};
#endif // ACCESS_TOKEN_STORE_QT_H
......@@ -46,6 +46,7 @@ GYP_CONFIG += \
use_pulseaudio=0 \
use_system_harfbuzz=0 \
use_system_icu=1 \
icu_use_data_file_flag=0 \
use_x11=0 \
v8_use_snapshot=false \
want_separate_host_toolset=1 \
......
......@@ -62,6 +62,7 @@
#include "media_capture_devices_dispatcher.h"
#include "resource_dispatcher_host_delegate_qt.h"
#include "web_contents_delegate_qt.h"
#include "access_token_store_qt.h"
#include <QGuiApplication>
#include <QOpenGLContext>
......@@ -347,6 +348,11 @@ void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, c
static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs);
}
content::AccessTokenStore *ContentBrowserClientQt::CreateAccessTokenStore()
{
return new AccessTokenStoreQt;
}
BrowserContextQt* ContentBrowserClientQt::browser_context() {
Q_ASSERT(m_browserMainParts);
return static_cast<BrowserMainPartsQt*>(m_browserMainParts)->browser_context();
......
......@@ -79,6 +79,7 @@ public:
virtual gfx::GLShareGroup* GetInProcessGpuShareGroup() Q_DECL_OVERRIDE;
virtual content::MediaObserver* GetMediaObserver() Q_DECL_OVERRIDE;
virtual void OverrideWebkitPrefs(content::RenderViewHost *, const GURL &, WebPreferences *) Q_DECL_OVERRIDE;
virtual content::AccessTokenStore *CreateAccessTokenStore() Q_DECL_OVERRIDE;
virtual void AllowCertificateError(
int render_process_id,
int render_frame_id,
......
......@@ -28,30 +28,3 @@ SUBDIRS += core_gyp_generator \
gyp_run.depends += gyp_configure_host gyp_configure_target
SUBDIRS += gyp_configure_host gyp_configure_target
}
REPACK_DIR = $$OUT_PWD/$$getConfigDir()/gen/repack
locales.files = "$$REPACK_DIR/qtwebengine_locales/*"
locales.CONFIG += no_check_exist
locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
resources.files = $$REPACK_DIR/qtwebengine_resources.pak
resources.CONFIG += no_check_exist
resources.path = $$[QT_INSTALL_DATA]
PLUGIN_EXTENSION = .so
PLUGIN_PREFIX = lib
macx: PLUGIN_PREFIX =
win32 {
PLUGIN_EXTENSION = .dll
PLUGIN_PREFIX =
}
icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
icu.CONFIG += no_check_exist
icu.path = $$[QT_INSTALL_DATA]
plugins.files = $$OUT_PWD/$$getConfigDir()/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION}
plugins.CONFIG += no_check_exist
plugins.path = $$[QT_INSTALL_PLUGINS]/qtwebengine
INSTALLS += icu locales resources plugins
......@@ -33,6 +33,7 @@ RESOURCES += devtools.qrc
INCLUDEPATH += $$[QT_INSTALL_HEADERS] $$PWD
SOURCES = \
access_token_store_qt.cpp \
browser_accessibility_manager_qt.cpp \
browser_accessibility_qt.cpp \
browser_context_qt.cpp \
......@@ -80,6 +81,7 @@ SOURCES = \
yuv_video_node.cpp
HEADERS = \
access_token_store_qt.h \
browser_accessibility_manager_qt.h \
browser_accessibility_qt.h \
browser_context_qt.h \
......
......@@ -6,11 +6,58 @@ CMAKE_MODULE_TESTS = "-"
QT += qml quick
QT_PRIVATE += gui-private
# Needed to set a CFBundleIdentifier
QMAKE_INFO_PLIST = Info_mac.plist
# Look for linking information produced by gyp for our target according to core_generated.gyp
!include($$OUT_PWD/$$getConfigDir()/$${TARGET}_linking.pri) {
error("Could not find the linking information that gyp should have generated.")
}
REPACK_DIR = $$OUT_PWD/$$getConfigDir()/gen/repack
# Duplicated from resources/resources.gyp
LOCALE_LIST = am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW
for(LOC, LOCALE_LIST) {
locales.files += $$REPACK_DIR/qtwebengine_locales/$${LOC}.pak
}
resources.files = $$REPACK_DIR/qtwebengine_resources.pak
PLUGIN_EXTENSION = .so
PLUGIN_PREFIX = lib
osx: PLUGIN_PREFIX =
win32 {
PLUGIN_EXTENSION = .dll
PLUGIN_PREFIX =
}
icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
plugins.files = $$OUT_PWD/$$getConfigDir()/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION}
!debug_and_release|!build_all|CONFIG(release, debug|release):contains(QT_CONFIG, qt_framework) {
locales.version = Versions
locales.path = Resources/qtwebengine_locales
resources.version = Versions
resources.path = Resources
icu.version = Versions
icu.path = Resources
plugins.version = Versions
plugins.path = Libraries
# No files, this prepares the bundle Helpers symlink, process.pro will create the directories
qtwebengineprocessplaceholder.version = Versions
qtwebengineprocessplaceholder.path = Helpers
QMAKE_BUNDLE_DATA += icu locales resources plugins qtwebengineprocessplaceholder
} else {
locales.CONFIG += no_check_exist
locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
resources.CONFIG += no_check_exist
resources.path = $$[QT_INSTALL_DATA]
icu.CONFIG += no_check_exist
icu.path = $$[QT_INSTALL_DATA]
plugins.CONFIG += no_check_exist
plugins.path = $$[QT_INSTALL_PLUGINS]/qtwebengine
INSTALLS += icu locales resources plugins
}
# We distribute the module binary but headers are only available in-tree.
CONFIG += no_module_headers
load(qt_module)
......@@ -22,3 +69,22 @@ CONFIG -= bsymbolic_functions
contains(QT_CONFIG, egl): CONFIG += egl
linux: contains(QT_CONFIG, separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
!contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) {
ICU_TARGET = $$shell_path($$[QT_INSTALL_DATA]/icudtl.dat)
ICU_FILE = $$shell_path($$OUT_PWD/$$getConfigDir()/icudtl.dat)
icu_rule.target = $$ICU_TARGET
unix: icu_rule.commands = if [ -e $$ICU_FILE ] ; then $$QMAKE_COPY $$ICU_FILE $$ICU_TARGET ; fi
win32: icu_rule.commands = if exist $$ICU_FILE ( $$QMAKE_COPY $$ICU_FILE $$ICU_TARGET )
PLUGIN_DIR = $$shell_path($$[QT_INSTALL_PLUGINS]/qtwebengine)
PLUGIN_TARGET = $$shell_path($$PLUGIN_DIR/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION})
PLUGIN_FILE = $$shell_path($$OUT_PWD/$$getConfigDir()/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION})
plugins_rule.target = $$PLUGIN_TARGET
unix: plugins_rule.commands = $$QMAKE_MKDIR $$PLUGIN_DIR && if [ -e $$PLUGIN_FILE ] ; then $$QMAKE_COPY $$PLUGIN_FILE $$PLUGIN_TARGET ; fi
win32: plugins_rule.commands = (if not exist $$PLUGIN_DIR ( $$QMAKE_MKDIR $$PLUGIN_DIR )) && \
if exist $$PLUGIN_FILE ( $$QMAKE_COPY $$PLUGIN_FILE $$PLUGIN_TARGET )
QMAKE_EXTRA_TARGETS += icu_rule plugins_rule
PRE_TARGETDEPS += $$ICU_TARGET $$PLUGIN_TARGET
}
......@@ -87,6 +87,11 @@ contains(QT_ARCH, "i386"): GYP_ARGS += "-D target_arch=ia32"
contains(WEBENGINE_CONFIG, proprietary_codecs): GYP_ARGS += "-Dproprietary_codecs=1 -Dffmpeg_branding=Chrome -Duse_system_ffmpeg=0"
!contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) {
GYP_ARGS += "-D qt_install_data=\"$$[QT_INSTALL_DATA]\""
GYP_ARGS += "-D qt_install_translations=\"$$[QT_INSTALL_TRANSLATIONS]\""
}
!build_pass {
message("Running gyp_qtwebengine \"$$OUT_PWD\" $${GYP_ARGS}...")
!system("python $$QTWEBENGINE_ROOT/tools/buildscripts/gyp_qtwebengine \"$$OUT_PWD\" $${GYP_ARGS}"): error("-- running gyp_qtwebengine failed --")
......
......@@ -133,6 +133,12 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() {
return config;
}
static inline bool compareTouchPoints(const QTouchEvent::TouchPoint &lhs, const QTouchEvent::TouchPoint &rhs)
{
// TouchPointPressed < TouchPointMoved < TouchPointReleased
return lhs.state() < rhs.state();
}
class MotionEventQt : public ui::MotionEvent {
public:
MotionEventQt(const QList<QTouchEvent::TouchPoint> &touchPoints, const base::TimeTicks &eventTime, Action action, int index = -1)
......@@ -983,6 +989,10 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
if (ev->type() == QEvent::TouchBegin)
m_sendMotionActionDown = true;
// Make sure that ACTION_POINTER_DOWN is delivered before ACTION_MOVE,
// and ACTION_MOVE before ACTION_POINTER_UP.
std::sort(touchPoints.begin(), touchPoints.end(), compareTouchPoints);
for (int i = 0; i < touchPoints.size(); ++i) {
ui::MotionEvent::Action action;
switch (touchPoints[i].state()) {
......
......@@ -33,6 +33,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CONTENT_RENDERER_CLIENT_QT_H
#define CONTENT_RENDERER_CLIENT_QT_H
#include "content/public/renderer/content_renderer_client.h"
......@@ -61,3 +63,5 @@ public:
private:
QScopedPointer<visitedlink::VisitedLinkSlave> m_visitedLinkSlave;
};
#endif // CONTENT_RENDERER_CLIENT_QT_H
......@@ -33,6 +33,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT_RENDER_VIEW_OBSERVER_H
#define QT_RENDER_VIEW_OBSERVER_H
#include "content/public/renderer/render_view_observer.h"
......@@ -52,3 +54,5 @@ private:
DISALLOW_COPY_AND_ASSIGN(QtRenderViewObserver);
};
#endif // QT_RENDER_VIEW_OBSERVER_H
......@@ -13,7 +13,7 @@
'<!@pymod_do_main(repack_locales -i -p <(OS) -s <(SHARED_INTERMEDIATE_DIR) -x <(repack_output_dir) <(repack_extra_flags) <(locales))'
],
'outputs': [
'<!@pymod_do_main(repack_locales -o -p <(OS) -s <(SHARED_INTERMEDIATE_DIR) -x <(repack_output_dir) <(locales))'
'<@(locale_files)'
],
'action': [
'<@(repack_locales_script)',
......
......@@ -9,6 +9,9 @@
'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
'vi', 'zh-CN', 'zh-TW',
],
'locale_files': ['<!@pymod_do_main(repack_locales -o -p <(OS) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))'],
'qt_install_data%': '',
'qt_install_translations%': '',
},
'dependencies': [
'<(chromium_src_dir)/webkit/webkit_resources.gyp:webkit_strings',
......@@ -29,7 +32,25 @@
'action_name': 'repack_locales',
'includes': [ 'repack_locales.gypi' ],
},
]
],
'conditions': [
['qt_install_data != ""', {
'copies': [
{
'destination': '<(qt_install_data)',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak' ],
},
],
}],
['qt_install_translations != ""', {
'copies': [
{
'destination': '<(qt_install_translations)/qtwebengine_locales',
'files': [ '<@(locale_files)' ],
},
],
}],
],
}
]
}