diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-31 11:27:38 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-31 11:27:51 +0200 |
commit | f9e951d0946fe0fcd51e9015108f92c46ecc8138 (patch) | |
tree | a003c9ccf4b70654fe480c86096dac6c93a9ce07 /src/core | |
parent | 9da1716d05770f6deb3af654f28024234d711eb7 (diff) | |
parent | 96df24618fbbc0e06a24e93b7e9aefb0f923f4af (diff) |
Merge remote-tracking branch 'origin/5.7.0' into 5.7
Change-Id: I00f64f15ec2aee18d8e6c7b5f59dfae49be1cba8
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/content_client_qt.cpp | 30 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 19 |
2 files changed, 42 insertions, 7 deletions
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 8a5dde70f..0418873be 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -57,6 +57,18 @@ #include <QLibraryInfo> #include <QString> +#if defined(Q_OS_WIN) +#include <shlobj.h> +static QString getLocalAppDataDir() +{ + QString result; + wchar_t path[MAX_PATH]; + if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) + result = QDir::fromNativeSeparators(QString::fromWCharArray(path)); + return result; +} +#endif + #if defined(ENABLE_PLUGINS) // The plugin logic is based on chrome/common/chrome_content_client.cc: @@ -199,10 +211,24 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) pluginPaths << potentialWidevinePluginPath; } } +#elif defined(Q_OS_WIN) + QDir potentialWidevineDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM"); + if (potentialWidevineDir.exists()) { + QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); + for (int i = 0; i < widevineVersionDirs.size(); ++i) { + QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); +#ifdef WIN64 + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/" + QString::fromLatin1(kWidevineCdmAdapterFileName); +#else + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/" + QString::fromLatin1(kWidevineCdmAdapterFileName); #endif -#if defined(Q_OS_LINUX) + pluginPaths << potentialWidevinePluginPath; + } + } +#elif defined(Q_OS_LINUX) pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdmadapter.so") // Google Chrome - << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so"); // Arch + << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so") // Arch + << QStringLiteral("/usr/lib64/chromium/libwidevinecdmadapter.so"); // OpenSUSE style #endif } diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 0ed0b91f9..260efc081 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -70,6 +70,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/favicon_status.h" +#include "content/public/common/content_constants.h" #include <content/public/common/drop_data.h> #include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" @@ -517,7 +518,12 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT urlString.append(","); urlString.append(encodedData.constData(), encodedData.length()); - content::NavigationController::LoadURLParams params((GURL(urlString))); + GURL dataUrlToLoad(urlString); + if (dataUrlToLoad.spec().size() > content::kMaxURLChars) { + d->adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED); + return; + } + content::NavigationController::LoadURLParams params((dataUrlToLoad)); params.load_type = content::NavigationController::LOAD_TYPE_DATA; params.base_url_for_data_url = toGurl(baseUrl); params.virtual_url_for_data_url = baseUrl.isEmpty() ? GURL(url::kAboutBlankURL) : toGurl(baseUrl); @@ -1114,10 +1120,7 @@ static blink::WebDragOperationsMask toWeb(const Qt::DropActions action) static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeData *mimeData) { - if (mimeData->hasText()) - dropData->text = toNullableString16(mimeData->text()); - if (mimeData->hasHtml()) - dropData->html = toNullableString16(mimeData->html()); + Q_ASSERT(dropData->filenames.empty()); Q_FOREACH (const QUrl &url, mimeData->urls()) { if (url.isLocalFile()) { ui::FileInfo uifi; @@ -1125,6 +1128,12 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat dropData->filenames.push_back(uifi); } } + if (!dropData->filenames.empty()) + return; + if (mimeData->hasHtml()) + dropData->html = toNullableString16(mimeData->html()); + else if (mimeData->hasText()) + dropData->text = toNullableString16(mimeData->text()); } void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPoint &screenPos) |