mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefRegisterWidevineCdm function and remove component updater support (issue #2009)
Mac: Check in widevinecdmadapter.plugin binary until Widevine GN build errors are resolved (https://crbug.com/626436).
This commit is contained in:
@ -3,8 +3,10 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_path.h"
|
||||
@ -28,6 +30,22 @@ void PluginsCallbackImpl(
|
||||
}
|
||||
}
|
||||
|
||||
#if !(defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)) || \
|
||||
defined(OS_LINUX)
|
||||
|
||||
void DeliverWidevineCdmError(const std::string& error_message,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
LOG(ERROR) << error_message;
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefRegisterCdmCallback::OnCdmRegistrationComplete,
|
||||
callback.get(), CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
|
||||
error_message));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -150,3 +168,24 @@ void CefIsWebPluginUnstable(
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(CefIsWebPluginUnstable, path, callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefRegisterWidevineCdm(const CefString& path,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
||||
#if defined(OS_LINUX)
|
||||
// Enforce the requirement that CefRegisterWidevineCdm() is called before
|
||||
// CefInitialize() on Linux. See comments in
|
||||
// CefWidevineLoader::AddPepperPlugins for details.
|
||||
if (CONTEXT_STATE_VALID()) {
|
||||
DeliverWidevineCdmError(
|
||||
"Widevine registration is not supported after context initialization",
|
||||
callback);
|
||||
return;
|
||||
}
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
CefWidevineLoader::GetInstance()->LoadWidevineCdm(path, callback);
|
||||
#else
|
||||
DeliverWidevineCdmError("Widevine registration is not supported", callback);
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
||||
}
|
||||
|
Reference in New Issue
Block a user