summaryrefslogtreecommitdiffstats
path: root/src/core/content_client_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/content_client_qt.cpp')
-rw-r--r--src/core/content_client_qt.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 4a67dc029..b6a0909b0 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -30,8 +30,10 @@
#include <QLibraryInfo>
#include <QString>
+
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
#include "media/cdm/cdm_paths.h" // nogncheck
+#include "media/cdm/clear_key_cdm_common.h"
#include "third_party/widevine/cdm/buildflags.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
#if BUILDFLAG(ENABLE_WIDEVINE) && !BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
@@ -61,7 +63,7 @@ static QString webenginePluginsPath()
{
// Look for plugins in /plugins/webengine or application dir.
static bool initialized = false;
- static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QLatin1String("/webengine");
+ static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/webengine");
if (!initialized) {
initialized = true;
if (!QFileInfo::exists(potentialPluginsPath))
@@ -105,7 +107,7 @@ static QString ppapiPluginsPath()
{
// Look for plugins in /plugins/ppapi or application dir.
static bool initialized = false;
- static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QLatin1String("/ppapi");
+ static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/ppapi");
if (!initialized) {
initialized = true;
if (!QFileInfo::exists(potentialPluginsPath))
@@ -161,14 +163,17 @@ static const QDir widevineCdmDirHint(const QDir &widevineDir)
return widevineDir;
}
+ std::string error_message;
JSONStringValueDeserializer deserializer(jsonString);
- std::unique_ptr<base::Value> dict = deserializer.Deserialize(nullptr, nullptr);
+ std::unique_ptr<base::Value> dict = deserializer.Deserialize(nullptr, &error_message);
if (!dict || !dict->is_dict()) {
+ DLOG(ERROR) << "Could not deserialize the CDM hint file. Error: "
+ << error_message;
// Could not deserialize the CDM hint file.
return widevineDir;
}
- std::string *widevineCdmDirPath = dict->FindStringKey("Path");
+ std::string *widevineCdmDirPath = dict->GetDict().FindString("Path");
if (!widevineCdmDirPath)
return widevineDir;
@@ -353,31 +358,23 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::FilePath clear_key_cdm_path = command_line->GetSwitchValuePath(switches::kClearKeyCdmPathForTesting);
if (!clear_key_cdm_path.empty() && base::PathExists(clear_key_cdm_path)) {
- // TODO(crbug.com/764480): Remove these after we have a central place for
- // External Clear Key (ECK) related information.
- // Normal External Clear Key key system.
- const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
- // A variant of ECK key system that has a different GUID.
- const char kExternalClearKeyDifferentGuidTestKeySystem[] =
- "org.chromium.externalclearkey.differentguid";
-
// Supported codecs are hard-coded in ExternalClearKeyProperties.
media::CdmCapability capability(
{}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary,
media::CdmSessionType::kPersistentLicense});
- // Register kExternalClearKeyDifferentGuidTestKeySystem first separately.
+ // Register media::kExternalClearKeyDifferentCdmTypeTestKeySystem first separately.
// Otherwise, it'll be treated as a sub-key-system of normal
// kExternalClearKeyKeySystem. See MultipleCdmTypes test in
// ECKEncryptedMediaTest.
- cdms->push_back(content::CdmInfo(kExternalClearKeyDifferentGuidTestKeySystem,
+ cdms->push_back(content::CdmInfo(media::kExternalClearKeyDifferentCdmTypeTestKeySystem,
Robustness::kSoftwareSecure, capability,
/*supports_sub_key_systems=*/false, media::kClearKeyCdmDisplayName,
media::kClearKeyCdmDifferentCdmType, base::Version("0.1.0.0"),
clear_key_cdm_path));
- cdms->push_back(content::CdmInfo(kExternalClearKeyKeySystem,
+ cdms->push_back(content::CdmInfo(media::kExternalClearKeyKeySystem,
Robustness::kSoftwareSecure, capability,
/*supports_sub_key_systems=*/true, media::kClearKeyCdmDisplayName,
media::kClearKeyCdmType, base::Version("0.1.0.0"),
@@ -420,4 +417,19 @@ std::u16string ContentClientQt::GetLocalizedString(int message_id)
return l10n_util::GetStringUTF16(message_id);
}
+// This method is a copy from chrome/common/chrome_content_client.cc:
+// Copyright 2012 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE.Chromium file.
+blink::OriginTrialPolicy *ContentClientQt::GetOriginTrialPolicy()
+{
+ // Prevent initialization race (see crbug.com/721144). There may be a
+ // race when the policy is needed for worker startup (which happens on a
+ // separate worker thread).
+ base::AutoLock auto_lock(origin_trial_policy_lock_);
+ if (!origin_trial_policy_)
+ origin_trial_policy_ = std::make_unique<embedder_support::OriginTrialPolicyImpl>();
+ return origin_trial_policy_.get();
+}
+
} // namespace QtWebEngineCore