summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/content_browser_client_qt.cpp11
-rw-r--r--src/core/content_browser_client_qt.h3
-rw-r--r--src/core/content_client_qt.cpp3
-rw-r--r--src/core/gl_context_qt.cpp2
-rw-r--r--src/core/gl_surface_qt.cpp55
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp1
-rw-r--r--src/core/print_view_manager_qt.cpp76
-rw-r--r--src/core/url_request_custom_job.cpp3
-rw-r--r--src/core/web_contents_adapter.cpp22
-rw-r--r--src/core/web_contents_delegate_qt.cpp13
-rw-r--r--src/core/web_engine_context.cpp17
11 files changed, 129 insertions, 77 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index f5f490ccf..fd6bd1f86 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -47,6 +47,7 @@
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/media_observer.h"
#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
@@ -270,7 +271,8 @@ public:
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext);
else if (platform == QLatin1String("qnx"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland"))
+ else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland")
+ || platform == QLatin1String("wayland-egl"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
else if (platform == QLatin1String("windows")) {
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
@@ -433,6 +435,13 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont
*result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
}
+void ContentBrowserClientQt::SelectClientCertificate(content::WebContents * /*webContents*/,
+ net::SSLCertRequestInfo * /*certRequestInfo*/,
+ scoped_ptr<content::ClientCertificateDelegate> delegate)
+{
+ delegate->ContinueWithCertificate(nullptr);
+}
+
content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvider()
{
#ifdef QT_USE_POSITIONING
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 1878e3d27..2b023db5f 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -102,6 +102,9 @@ public:
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) Q_DECL_OVERRIDE;
+ virtual void SelectClientCertificate(content::WebContents* web_contents,
+ net::SSLCertRequestInfo* cert_request_info,
+ scoped_ptr<content::ClientCertificateDelegate> delegate) Q_DECL_OVERRIDE;
content::LocationProvider* OverrideSystemLocationProvider() Q_DECL_OVERRIDE;
content::DevToolsManagerDelegate *GetDevToolsManagerDelegate() Q_DECL_OVERRIDE;
virtual net::URLRequestContextGetter *CreateRequestContext(content::BrowserContext *browser_context, content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptorss) Q_DECL_OVERRIDE;
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 0418873be..2afd8c3ae 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -168,7 +168,8 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins)
#endif
#if defined(Q_OS_LINUX)
pluginPaths << "/opt/google/chrome/PepperFlash/libpepflashplayer.so" // Google Chrome
- << "/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so" // Ubuntu
+ << "/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so" // Ubuntu, package pepperflashplugin-nonfree
+ << "/usr/lib/adobe-flashplugin/libpepflashplayer.so" // Ubuntu, package adobe-flashplugin
<< "/usr/lib/PepperFlash/libpepflashplayer.so" // Arch
<< "/usr/lib64/chromium/PepperFlash/libpepflashplayer.so"; // OpenSuSE
pluginPaths << ppapiPluginsPath() + QStringLiteral("/libpepflashplayer.so");
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index 0cf873631..b7d82e77a 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -118,7 +118,7 @@ void* GLContextHelper::getXConfig()
void* GLContextHelper::getEGLDisplay()
{
- return resourceForContext(QByteArrayLiteral("egldisplay"));
+ return resourceForIntegration(QByteArrayLiteral("egldisplay"));
}
void* GLContextHelper::getXDisplay()
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index f499d853e..a82143525 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -88,6 +88,9 @@ void* g_display;
const char* g_extensions = NULL;
bool g_egl_surfaceless_context_supported = false;
+
+bool g_initializedEGL = false;
+
} // namespace
@@ -393,11 +396,17 @@ bool GLSurface::InitializeOneOffInternal()
return GLSurfaceQtEGL::InitializeOneOff();
if (GetGLImplementation() == kGLImplementationDesktopGL) {
-#if defined(USE_X11)
- return GLSurfaceQtGLX::InitializeOneOff();
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
return GLSurfaceQtWGL::InitializeOneOff();
+#elif defined(USE_X11)
+ if (GLSurfaceQtGLX::InitializeOneOff())
+ return true;
#endif
+ // Fallback to trying EGL with desktop GL.
+ if (GLSurfaceQtEGL::InitializeOneOff()) {
+ g_initializedEGL = true;
+ return true;
+ }
}
return false;
@@ -579,39 +588,39 @@ void* GLSurfacelessQtEGL::GetShareHandle()
scoped_refptr<GLSurface>
GLSurface::CreateOffscreenGLSurface(const gfx::Size& size)
{
+ scoped_refptr<GLSurface> surface;
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL: {
-#if defined(USE_X11)
- scoped_refptr<GLSurface> surface = new GLSurfaceQtGLX(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
-#elif defined(OS_WIN)
- scoped_refptr<GLSurface> surface = new GLSurfaceQtWGL(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
-#else
- LOG(ERROR) << "Desktop GL is not supported on this platform.";
- Q_UNREACHABLE();
- return NULL;
+#if defined(OS_WIN)
+ surface = new GLSurfaceQtWGL(size);
+ if (surface->Initialize())
+ return surface;
+ break;
+#elif defined(USE_X11)
+ if (!g_initializedEGL) {
+ surface = new GLSurfaceQtGLX(size);
+ if (surface->Initialize())
+ return surface;
+ }
+ // no break
#endif
}
case kGLImplementationEGLGLES2: {
- scoped_refptr<GLSurface> surface;
if (g_egl_surfaceless_context_supported)
surface = new GLSurfacelessQtEGL(size);
else
surface = new GLSurfaceQtEGL(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
+ if (surface->Initialize())
+ return surface;
+ break;
}
default:
- Q_UNREACHABLE();
- return NULL;
+ break;
}
+ LOG(ERROR) << "Requested OpenGL platform is not supported.";
+ Q_UNREACHABLE();
+ return NULL;
}
// static
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index b38e90c69..9683245a0 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -165,7 +165,6 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content:
if (securityOriginsMatch && (microphoneRequested || webcamRequested)) {
switch (request.request_type) {
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY:
- Q_UNREACHABLE(); // only speculative as this is for Pepper
getDefaultDevices("", "", microphoneRequested, webcamRequested, &devices);
break;
case content::MEDIA_DEVICE_ACCESS:
diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp
index 4cb0e06eb..f657b8289 100644
--- a/src/core/print_view_manager_qt.cpp
+++ b/src/core/print_view_manager_qt.cpp
@@ -101,43 +101,62 @@ static void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
metafile.SaveTo(&file);
}
-static void applyQPageLayoutSettingsToDictionary(const QPageLayout& pageLayout, base::DictionaryValue& print_settings)
+static base::DictionaryValue *createPrintSettings()
{
+ base::DictionaryValue *printSettings = new base::DictionaryValue();
// TO DO: Check if we can use the request ID from Qt here somehow.
static int internalRequestId = 0;
- print_settings.SetBoolean(printing::kIsFirstRequest, internalRequestId++ == 0);
- print_settings.SetInteger(printing::kPreviewRequestID, internalRequestId);
+ printSettings->SetBoolean(printing::kIsFirstRequest, internalRequestId++ == 0);
+ printSettings->SetInteger(printing::kPreviewRequestID, internalRequestId);
+
+ // The following are standard settings that Chromium expects to be set.
+ printSettings->SetBoolean(printing::kSettingPrintToPDF, true);
+ printSettings->SetBoolean(printing::kSettingCloudPrintDialog, false);
+ printSettings->SetBoolean(printing::kSettingPrintWithPrivet, false);
+ printSettings->SetBoolean(printing::kSettingPrintWithExtension, false);
+
+ printSettings->SetBoolean(printing::kSettingGenerateDraftData, false);
+ printSettings->SetBoolean(printing::kSettingPreviewModifiable, false);
+ printSettings->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX);
+ printSettings->SetInteger(printing::kSettingCopies, 1);
+ printSettings->SetBoolean(printing::kSettingCollate, false);
+ printSettings->SetBoolean(printing::kSettingGenerateDraftData, false);
+ printSettings->SetBoolean(printing::kSettingPreviewModifiable, false);
+
+ printSettings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false);
+ printSettings->SetBoolean(printing::kSettingShouldPrintBackgrounds, true);
+ printSettings->SetBoolean(printing::kSettingHeaderFooterEnabled, false);
+ printSettings->SetString(printing::kSettingDeviceName, "");
+ printSettings->SetInteger(printing::kPreviewUIID, 12345678);
+
+ return printSettings;
+}
+
+static base::DictionaryValue *createPrintSettingsFromQPageLayout(const QPageLayout &pageLayout)
+{
+ base::DictionaryValue *printSettings = createPrintSettings();
+
//Set page size attributes, chromium expects these in micrometers
QSizeF pageSizeInMilimeter = pageLayout.pageSize().size(QPageSize::Millimeter);
scoped_ptr<base::DictionaryValue> sizeDict(new base::DictionaryValue);
sizeDict->SetInteger(printing::kSettingMediaSizeWidthMicrons, pageSizeInMilimeter.width() * kMicronsToMillimeter);
sizeDict->SetInteger(printing::kSettingMediaSizeHeightMicrons, pageSizeInMilimeter.height() * kMicronsToMillimeter);
- print_settings.Set(printing::kSettingMediaSize, std::move(sizeDict));
+ printSettings->Set(printing::kSettingMediaSize, std::move(sizeDict));
- print_settings.SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape);
+ // Apply page margins
+ QMargins pageMarginsInPoints = pageLayout.marginsPoints();
+ scoped_ptr<base::DictionaryValue> marginsDict(new base::DictionaryValue);
+ marginsDict->SetInteger(printing::kSettingMarginTop, pageMarginsInPoints.top());
+ marginsDict->SetInteger(printing::kSettingMarginBottom, pageMarginsInPoints.bottom());
+ marginsDict->SetInteger(printing::kSettingMarginLeft, pageMarginsInPoints.left());
+ marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right());
+ printSettings->Set(printing::kSettingMarginsCustom, std::move(marginsDict));
+ printSettings->SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS);
- // The following are standard settings that Chromium expects to be set.
- print_settings.SetBoolean(printing::kSettingPrintToPDF, true);
- print_settings.SetBoolean(printing::kSettingCloudPrintDialog, false);
- print_settings.SetBoolean(printing::kSettingPrintWithPrivet, false);
- print_settings.SetBoolean(printing::kSettingPrintWithExtension, false);
-
- print_settings.SetBoolean(printing::kSettingGenerateDraftData, false);
- print_settings.SetBoolean(printing::kSettingPreviewModifiable, false);
- print_settings.SetInteger(printing::kSettingColor, printing::COLOR);
- print_settings.SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX);
- print_settings.SetInteger(printing::kSettingDuplexMode, printing::UNKNOWN_DUPLEX_MODE);
- print_settings.SetInteger(printing::kSettingCopies, 1);
- print_settings.SetBoolean(printing::kSettingCollate, false);
- print_settings.SetBoolean(printing::kSettingGenerateDraftData, false);
- print_settings.SetBoolean(printing::kSettingPreviewModifiable, false);
-
- print_settings.SetBoolean(printing::kSettingShouldPrintSelectionOnly, false);
- print_settings.SetBoolean(printing::kSettingShouldPrintBackgrounds, false);
- print_settings.SetBoolean(printing::kSettingHeaderFooterEnabled, false);
- print_settings.SetString(printing::kSettingDeviceName, "");
- print_settings.SetInteger(printing::kPreviewUIID, 12345678);
+ printSettings->SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape);
+
+ return printSettings;
}
} // namespace
@@ -191,8 +210,9 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout)
{
if (!pageLayout.isValid())
return false;
- m_printSettings.reset(new base::DictionaryValue());
- applyQPageLayoutSettingsToDictionary(pageLayout, *m_printSettings);
+ m_printSettings.reset(createPrintSettingsFromQPageLayout(pageLayout));
+
+ m_printSettings->SetInteger(printing::kSettingColor, printing::COLOR);
return Send(new PrintMsg_InitiatePrintPreview(routing_id(), false));
}
diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp
index 887222285..d093efd0a 100644
--- a/src/core/url_request_custom_job.cpp
+++ b/src/core/url_request_custom_job.cpp
@@ -229,6 +229,9 @@ void URLRequestCustomJobShared::setReplyDevice(QIODevice *device)
if (m_device && !m_device->isReadable())
m_device->open(QIODevice::ReadOnly);
+ qint64 size = m_device ? m_device->size() : -1;
+ if (size > 0)
+ m_job->set_expected_content_size(size);
if (m_device && m_device->isReadable())
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJobShared::notifyStarted, m_weakFactory.GetWeakPtr()));
else
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index bfac6a5b2..fc54c98ed 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1059,18 +1059,12 @@ void WebContentsAdapter::setWebChannel(QWebChannel *channel, uint worldId)
static QMimeData *mimeDataFromDropData(const content::DropData &dropData)
{
QMimeData *mimeData = new QMimeData();
- if (!dropData.text.is_null()) {
+ if (!dropData.text.is_null())
mimeData->setText(toQt(dropData.text.string()));
- return mimeData;
- }
- if (!dropData.html.is_null()) {
+ if (!dropData.html.is_null())
mimeData->setHtml(toQt(dropData.html.string()));
- return mimeData;
- }
- if (dropData.url.is_valid()) {
+ if (dropData.url.is_valid())
mimeData->setUrls(QList<QUrl>() << toQt(dropData.url));
- return mimeData;
- }
return mimeData;
}
@@ -1165,6 +1159,16 @@ Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const Q
rvh->DragTargetDragOver(toGfx(e->pos()), toGfx(screenPos), toWeb(e->possibleActions()),
blink::WebInputEvent::LeftButtonDown);
+ base::MessageLoop *currentMessageLoop = base::MessageLoop::current();
+ DCHECK(currentMessageLoop);
+ if (!currentMessageLoop->NestableTasksAllowed()) {
+ // We're already inside a MessageLoop::RunTask call, and scheduled tasks will not be
+ // executed. That means, updateDragAction will never be called, and the RunLoop below will
+ // remain blocked forever.
+ qWarning("WebContentsAdapter::updateDragPosition called from MessageLoop::RunTask.");
+ return Qt::IgnoreAction;
+ }
+
// Wait until we get notified via RenderViewHostDelegateView::UpdateDragCursor. This calls
// WebContentsAdapter::updateDragAction that will eventually quit the nested loop.
base::RunLoop loop;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 3ade0d0f6..757ae853c 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -74,6 +74,7 @@
#include "ui/events/latency_info.h"
#include <QDesktopServices>
+#include <QTimer>
namespace QtWebEngineCore {
@@ -107,13 +108,19 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents
Q_ASSERT(target);
content::NavigationController::LoadURLParams load_url_params(params.url);
+ load_url_params.source_site_instance = params.source_site_instance;
load_url_params.referrer = params.referrer;
load_url_params.frame_tree_node_id = params.frame_tree_node_id;
+ load_url_params.redirect_chain = params.redirect_chain;
load_url_params.transition_type = params.transition;
load_url_params.extra_headers = params.extra_headers;
load_url_params.should_replace_current_entry = params.should_replace_current_entry;
load_url_params.is_renderer_initiated = params.is_renderer_initiated;
load_url_params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
+ if (params.uses_post) {
+ load_url_params.load_type = content::NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST;
+ load_url_params.browser_initiated_post_data = params.browser_initiated_post_data;
+ }
target->GetController().LoadURLWithParams(load_url_params);
return target;
@@ -319,7 +326,11 @@ void WebContentsDelegateQt::RunFileChooser(content::WebContents *web_contents, c
acceptedMimeTypes.append(toQt(*it));
FilePickerController *controller = new FilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode), web_contents, toQt(params.default_file_name.value()), acceptedMimeTypes);
- m_viewClient->runFileChooser(controller);
+
+ // Defer the call to not block base::MessageLoop::RunTask with modal dialogs.
+ QTimer::singleShot(0, [this, controller] () {
+ m_viewClient->runFileChooser(controller);
+ });
}
bool WebContentsDelegateQt::AddMessageToConsole(content::WebContents *source, int32_t level, const base::string16 &message, int32_t line_no, const base::string16 &source_id)
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index ceb14f843..39e11a96d 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -296,8 +296,10 @@ WebEngineContext::WebEngineContext()
if (useEmbeddedSwitches) {
// Inspired by the Android port's default switches
- parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbar);
- parsedCommandLine->AppendSwitch(switches::kEnablePinch);
+ if (!parsedCommandLine->HasSwitch(switches::kDisableOverlayScrollbar))
+ parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbar);
+ if (!parsedCommandLine->HasSwitch(switches::kDisablePinch))
+ parsedCommandLine->AppendSwitch(switches::kEnablePinch);
parsedCommandLine->AppendSwitch(switches::kEnableViewport);
parsedCommandLine->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges);
parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
@@ -352,16 +354,7 @@ WebEngineContext::WebEngineContext()
glType = gfx::kGLImplementationDesktopName;
}
} else {
- qWarning("WebEngineContext used before QtWebEngine::initialize()");
- // We have to assume the default OpenGL module type will be used.
- switch (QOpenGLContext::openGLModuleType()) {
- case QOpenGLContext::LibGL:
- glType = gfx::kGLImplementationDesktopName;
- break;
- case QOpenGLContext::LibGLES:
- glType = gfx::kGLImplementationEGLName;
- break;
- }
+ qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.");
}
}