summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/qwebenginecookiestore.cpp3
-rw-r--r--src/core/browser_context_adapter.cpp14
-rw-r--r--src/core/browser_context_adapter.h3
-rw-r--r--src/core/config/linux.pri9
-rw-r--r--src/core/core_gyp_generator.pro3
-rw-r--r--src/core/core_headers.pro2
-rw-r--r--src/core/permission_manager_qt.cpp6
-rw-r--r--src/core/permission_manager_qt.h1
-rw-r--r--src/core/render_widget_host_view_qt.cpp53
-rw-r--r--src/core/render_widget_host_view_qt.h3
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp4
-rw-r--r--src/core/web_contents_adapter.cpp5
-rw-r--r--src/core/web_contents_delegate_qt.cpp28
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/core/web_engine_context.cpp28
15 files changed, 141 insertions, 23 deletions
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 06912ce9..4617882a 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -191,6 +191,9 @@ void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie,
to get notified about the success of the operation.
The signal handlers for removal and addition should not be used to execute heavy tasks,
because they might block the IO thread in case of a blocking connection.
+
+ Use QWebEngineProfile::cookieStore() and QQuickWebEngineProfile::cookieStore()
+ to access the cookie store object for a specific profile.
*/
/*!
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 19280cf1..9980bf11 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -224,8 +224,13 @@ QString BrowserContextAdapter::cookiesPath() const
if (m_offTheRecord)
return QString();
QString basePath = dataPath();
- if (!basePath.isEmpty())
- return basePath % QLatin1String("/Coookies");
+ if (!basePath.isEmpty()) {
+ // This is a typo fix. We still need the old path in order to avoid breaking migration.
+ QDir coookiesFolder(basePath % QLatin1String("/Coookies"));
+ if (coookiesFolder.exists())
+ return coookiesFolder.path();
+ return basePath % QLatin1String("/Cookies");
+ }
return QString();
}
@@ -403,6 +408,11 @@ void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, Permissio
static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->permissionRequestReply(origin, type, reply);
}
+bool BrowserContextAdapter::checkPermission(const QUrl &origin, PermissionType type)
+{
+ return static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->checkPermission(origin, type);
+}
+
QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const
{
const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(','));
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 55ab688a..cbdc80da 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -138,6 +138,8 @@ public:
GeolocationPermission = 1,
// Reserved:
// NotificationPermission = 2,
+ AudioCapturePermission = 3,
+ VideoCapturePermission = 4,
};
HttpCacheType httpCacheType() const;
@@ -163,6 +165,7 @@ public:
UserResourceControllerHost *userResourceController();
void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
+ bool checkPermission(const QUrl &origin, PermissionType type);
QString httpAcceptLanguageWithoutQualities() const;
QString httpAcceptLanguage() const;
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 7d6c7bfb..3245888e 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -18,11 +18,14 @@ GYP_CONFIG += \
use_gio=0 \
use_gnome_keyring=0 \
use_kerberos=0 \
- use_pango=0
+ use_pango=0 \
+ use_openssl=1
-!use?(nss) {
+use?(nss) {
+ GYP_CONFIG += use_nss_certs=1 \
+ use_openssl_certs=0
+} else {
GYP_CONFIG += use_nss_certs=0 \
- use_openssl=1 \
use_openssl_certs=1
}
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index e04e34c5..639470a3 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -17,6 +17,9 @@ DEFINES += QT_NO_KEYWORDS \
QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \
BUILDING_CHROMIUM
+# Ensure that response files, generated by qtbase/mkspecs/features/moc.prf, are found by moc.
+MOC_DIR = $$OUT_PWD/$$getConfigDir()/.moc
+
# Assume that we want mobile touch and low-end hardware behaviors
# whenever we are cross compiling.
cross_compile: DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES
diff --git a/src/core/core_headers.pro b/src/core/core_headers.pro
index ebafe58e..52c6ca57 100644
--- a/src/core/core_headers.pro
+++ b/src/core/core_headers.pro
@@ -1,5 +1,5 @@
TARGET = QtWebEngineCore
-CONFIG += no_private_module header_module internal_module
+CONFIG += no_private_module header_module internal_module no_plist
MODULE = webenginecoreheaders
load(qt_module)
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp
index 1562a02c..fd57ad7b 100644
--- a/src/core/permission_manager_qt.cpp
+++ b/src/core/permission_manager_qt.cpp
@@ -99,6 +99,12 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserCont
}
}
+bool PermissionManagerQt::checkPermission(const QUrl &origin, BrowserContextAdapter::PermissionType type)
+{
+ QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, type);
+ return m_permissions.contains(key) && m_permissions[key];
+}
+
int PermissionManagerQt::RequestPermission(content::PermissionType permission,
content::RenderFrameHost *frameHost,
const GURL& requesting_origin,
diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h
index 7c42a06e..928f11c6 100644
--- a/src/core/permission_manager_qt.h
+++ b/src/core/permission_manager_qt.h
@@ -57,6 +57,7 @@ public:
typedef BrowserContextAdapter::PermissionType PermissionType;
void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
+ bool checkPermission(const QUrl &origin, PermissionType type);
// content::PermissionManager implementation:
int RequestPermission(
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index eaf8485d..27eda06a 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -229,6 +229,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget
: m_host(content::RenderWidgetHostImpl::From(widget))
, m_gestureProvider(QtGestureProviderConfig(), this)
, m_sendMotionActionDown(false)
+ , m_touchMotionStarted(false)
, m_chromiumCompositorData(new ChromiumCompositorData)
, m_needsDelegatedFrameAck(false)
, m_didFirstVisuallyNonEmptyLayout(false)
@@ -1005,6 +1006,12 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev)
m_host->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale()));
}
+void RenderWidgetHostViewQt::clearPreviousTouchMotionState()
+{
+ m_previousTouchPoints.clear();
+ m_touchMotionStarted = false;
+}
+
void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
{
// Chromium expects the touch event timestamps to be comparable to base::TimeTicks::Now().
@@ -1019,19 +1026,46 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
QList<QTouchEvent::TouchPoint> touchPoints = mapTouchPointIds(ev->touchPoints());
- if (ev->type() == QEvent::TouchCancel) {
- MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL, ev->modifiers(), dpiScale());
+ switch (ev->type()) {
+ case QEvent::TouchBegin:
+ m_sendMotionActionDown = true;
+ m_touchMotionStarted = true;
+ break;
+ case QEvent::TouchUpdate:
+ m_touchMotionStarted = true;
+ break;
+ case QEvent::TouchCancel:
+ {
+ // Don't process a TouchCancel event if no motion was started beforehand, or if there are
+ // no touch points in the current event or in the previously processed event.
+ if (!m_touchMotionStarted || (touchPoints.isEmpty() && m_previousTouchPoints.isEmpty())) {
+ clearPreviousTouchMotionState();
+ return;
+ }
+
+ // Use last saved touch points for the cancel event, to get rid of a QList assert,
+ // because Chromium expects a MotionEvent::ACTION_CANCEL instance to contain at least
+ // one touch point, whereas a QTouchCancel may not contain any touch points at all.
+ if (touchPoints.isEmpty())
+ touchPoints = m_previousTouchPoints;
+ clearPreviousTouchMotionState();
+ MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL,
+ ev->modifiers(), dpiScale());
processMotionEvent(cancelEvent);
return;
}
-
- if (ev->type() == QEvent::TouchBegin)
- m_sendMotionActionDown = true;
+ case QEvent::TouchEnd:
+ clearPreviousTouchMotionState();
+ break;
+ default:
+ break;
+ }
// 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);
+ m_previousTouchPoints = touchPoints;
for (int i = 0; i < touchPoints.size(); ++i) {
ui::MotionEvent::Action action;
switch (touchPoints[i].state()) {
@@ -1039,21 +1073,24 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
if (m_sendMotionActionDown) {
action = ui::MotionEvent::ACTION_DOWN;
m_sendMotionActionDown = false;
- } else
+ } else {
action = ui::MotionEvent::ACTION_POINTER_DOWN;
+ }
break;
case Qt::TouchPointMoved:
action = ui::MotionEvent::ACTION_MOVE;
break;
case Qt::TouchPointReleased:
- action = touchPoints.size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP : ui::MotionEvent::ACTION_UP;
+ action = touchPoints.size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP :
+ ui::MotionEvent::ACTION_UP;
break;
default:
// Ignore Qt::TouchPointStationary
continue;
}
- MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), dpiScale(), i);
+ MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), dpiScale(),
+ i);
processMotionEvent(motionEvent);
}
}
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index b59de6c2..8c9e6b9f 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -214,6 +214,7 @@ public:
private:
void sendDelegatedFrameAck();
void processMotionEvent(const ui::MotionEvent &motionEvent);
+ void clearPreviousTouchMotionState();
QList<QTouchEvent::TouchPoint> mapTouchPointIds(const QList<QTouchEvent::TouchPoint> &inputPoints);
float dpiScale() const;
@@ -223,7 +224,9 @@ private:
ui::FilteredGestureProvider m_gestureProvider;
base::TimeDelta m_eventsToNowDelta;
bool m_sendMotionActionDown;
+ bool m_touchMotionStarted;
QMap<int, int> m_touchIdMapping;
+ QList<QTouchEvent::TouchPoint> m_previousTouchPoints;
scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData;
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 4503520e..f3ac0f7c 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -89,10 +89,12 @@ class RenderProcessObserverQt : public content::RenderProcessObserver {
public:
void WebKitInitialized() override
{
- // mark qrc as a secure scheme (avoids deprecation warnings)
// Can only be done after blink is initialized.
blink::WebString qrcScheme(base::ASCIIToUTF16(kQrcSchemeQt));
+ // mark qrc as a secure scheme (avoids deprecation warnings)
blink::WebSecurityPolicy::registerURLSchemeAsSecure(qrcScheme);
+ // mark qrc as a local scheme (allows local access to qrc)
+ blink::WebSecurityPolicy::registerURLSchemeAsLocal(qrcScheme);
}
};
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 7ac3ad72..37ad73ff 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -950,6 +950,11 @@ QSizeF WebContentsAdapter::lastContentsSize() const
void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags flags)
{
Q_D(WebContentsAdapter);
+ // Let the permission manager remember the reply.
+ if (flags & WebContentsAdapterClient::MediaAudioCapture)
+ d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::AudioCapturePermission, true);
+ if (flags & WebContentsAdapterClient::MediaVideoCapture)
+ d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::VideoCapturePermission, true);
MediaCaptureDevicesDispatcher::GetInstance()->handleMediaAccessPermissionResponse(d->webContents.get(), securityOrigin, flags);
}
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index e7d94d33..2dd75df8 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -135,6 +135,20 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source,
}
}
+bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *source)
+{
+ Q_UNUSED(source)
+
+ // Allow failed URLs to stick around in the URL bar, but only when the error-page is enabled.
+ WebEngineSettings *settings = m_viewClient->webEngineSettings();
+ bool isErrorPageEnabled = settings->testAttribute(settings->Attribute::ErrorPageEnabled);
+
+ if (isErrorPageEnabled)
+ return true;
+
+ return false;
+}
+
void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
{
Q_UNUSED(source)
@@ -441,6 +455,20 @@ void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool pr
m_viewClient->windowCloseRejected();
}
+bool WebContentsDelegateQt::CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type)
+{
+ switch (type) {
+ case content::MEDIA_DEVICE_AUDIO_CAPTURE:
+ return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::AudioCapturePermission);
+ case content::MEDIA_DEVICE_VIDEO_CAPTURE:
+ return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::VideoCapturePermission);
+ default:
+ LOG(INFO) << "WebContentsDelegateQt::CheckMediaAccessPermission: "
+ << "Unsupported media stream type checked" << type;
+ return false;
+ }
+}
+
FaviconManager *WebContentsDelegateQt::faviconManager()
{
return m_faviconManager.data();
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 12e33eb1..e6deaa40 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -100,10 +100,12 @@ public:
virtual bool IsPopupOrPanel(const content::WebContents *source) const Q_DECL_OVERRIDE;
virtual void UpdateTargetURL(content::WebContents* source, const GURL& url) Q_DECL_OVERRIDE;
virtual void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) Q_DECL_OVERRIDE;
+ virtual bool ShouldPreserveAbortedURLs(content::WebContents *source) Q_DECL_OVERRIDE;
virtual void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) Q_DECL_OVERRIDE;
virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE;
virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE;
void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) Q_DECL_OVERRIDE;
+ bool CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) Q_DECL_OVERRIDE;
// WebContentsObserver overrides
virtual void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) Q_DECL_OVERRIDE;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index d7254c8b..bf7b2943 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -219,13 +219,10 @@ WebEngineContext::WebEngineContext()
, m_browserRunner(content::BrowserMainRunner::Create())
, m_globalQObject(new QObject())
{
- QVector<QByteArray> args;
- Q_FOREACH (const QString& arg, QCoreApplication::arguments())
- args << arg.toUtf8();
-
- bool useEmbeddedSwitches = args.removeAll("--enable-embedded-switches");
+ QStringList appArgs = QCoreApplication::arguments();
+ bool useEmbeddedSwitches = appArgs.removeAll(QStringLiteral("--enable-embedded-switches"));
#if defined(QTWEBENGINE_EMBEDDED_SWITCHES)
- useEmbeddedSwitches = !args.removeAll("--disable-embedded-switches");
+ useEmbeddedSwitches = !appArgs.removeAll(QStringLiteral("--disable-embedded-switches"));
#endif
#ifdef Q_OS_LINUX
@@ -234,16 +231,31 @@ WebEngineContext::WebEngineContext()
qputenv("force_s3tc_enable", "true");
#endif
-
// Allow us to inject javascript like any webview toolkit.
content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView();
+#if defined(Q_OS_WIN)
+ // We must initialize the command line with the UTF-16 arguments vector we got from
+ // QCoreApplication. CommandLine::Init ignores its arguments on Windows and calls
+ // GetCommandLineW() instead.
+ base::CommandLine::CreateEmpty();
+ base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess();
+ base::CommandLine::StringVector argv;
+ argv.resize(appArgs.size());
+ std::transform(appArgs.constBegin(), appArgs.constEnd(), argv.begin(), &toString16);
+ parsedCommandLine->InitFromArgv(argv);
+#else
+ QVector<QByteArray> args;
+ Q_FOREACH (const QString& arg, appArgs)
+ args << arg.toUtf8();
+
QVector<const char*> argv(args.size());
for (int i = 0; i < args.size(); ++i)
argv[i] = args[i].constData();
base::CommandLine::Init(argv.size(), argv.constData());
-
base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess();
+#endif
+
parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE));
// Enable sandboxing on OS X and Linux (Desktop / Embedded) by default.