widevine: Use component updater with the Alloy runtime (fixes issue #3149)

Widevine CDM binaries will be downloaded on supported platforms shortly after
application startup. Widevine support will then become available within a few
seconds after successful installation on Windows or after the next application
restart on other platforms. The CDM files will be downloaded to a "WidevineCdm"
directory inside the `CefSettings.user_data_path` directory.

Pass the `--disable-component-update` command-line flag to disable Widevine
download and installation. Pass the `--component-updater=fast-update` command-
line flag to force Widevine download immediately after application startup.

See the related issue for additional usage details.
This commit is contained in:
Marshall Greenblatt
2021-08-09 17:18:43 -04:00
parent eaf581e544
commit 240b869db5
45 changed files with 201 additions and 1459 deletions

View File

@@ -1,70 +0,0 @@
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=5f7db6dda8ac868e8ec94b93e3ae7d2dd7d0cf64$
//
#include "libcef_dll/cpptoc/register_cdm_callback_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK register_cdm_callback_on_cdm_registration_complete(
struct _cef_register_cdm_callback_t* self,
cef_cdm_registration_error_t result,
const cef_string_t* error_message) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: error_message
// Execute
CefRegisterCdmCallbackCppToC::Get(self)->OnCdmRegistrationComplete(
result, CefString(error_message));
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefRegisterCdmCallbackCppToC::CefRegisterCdmCallbackCppToC() {
GetStruct()->on_cdm_registration_complete =
register_cdm_callback_on_cdm_registration_complete;
}
// DESTRUCTOR - Do not edit by hand.
CefRegisterCdmCallbackCppToC::~CefRegisterCdmCallbackCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefRegisterCdmCallback> CefCppToCRefCounted<
CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback,
cef_register_cdm_callback_t>::UnwrapDerived(CefWrapperType type,
cef_register_cdm_callback_t*
s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback,
cef_register_cdm_callback_t>::kWrapperType =
WT_REGISTER_CDM_CALLBACK;

View File

@@ -1,40 +0,0 @@
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9817a192fb9476a843c3ccd0467e781adf426b91$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/cef_web_plugin.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefRegisterCdmCallbackCppToC
: public CefCppToCRefCounted<CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback,
cef_register_cdm_callback_t> {
public:
CefRegisterCdmCallbackCppToC();
virtual ~CefRegisterCdmCallbackCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_

View File

@@ -1,63 +0,0 @@
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=cf53fb30f47eeda9354fa60731d554ea757a47ac$
//
#include "libcef_dll/ctocpp/register_cdm_callback_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
void CefRegisterCdmCallbackCToCpp::OnCdmRegistrationComplete(
cef_cdm_registration_error_t result,
const CefString& error_message) {
shutdown_checker::AssertNotShutdown();
cef_register_cdm_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_cdm_registration_complete))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: error_message
// Execute
_struct->on_cdm_registration_complete(_struct, result,
error_message.GetStruct());
}
// CONSTRUCTOR - Do not edit by hand.
CefRegisterCdmCallbackCToCpp::CefRegisterCdmCallbackCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefRegisterCdmCallbackCToCpp::~CefRegisterCdmCallbackCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_register_cdm_callback_t* CefCToCppRefCounted<
CefRegisterCdmCallbackCToCpp,
CefRegisterCdmCallback,
cef_register_cdm_callback_t>::UnwrapDerived(CefWrapperType type,
CefRegisterCdmCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefRegisterCdmCallbackCToCpp,
CefRegisterCdmCallback,
cef_register_cdm_callback_t>::kWrapperType =
WT_REGISTER_CDM_CALLBACK;

View File

@@ -1,44 +0,0 @@
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=202e9ab7dd5d4dc53daa2f716e0dd74c623ecd8c$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/cef_web_plugin.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefRegisterCdmCallbackCToCpp
: public CefCToCppRefCounted<CefRegisterCdmCallbackCToCpp,
CefRegisterCdmCallback,
cef_register_cdm_callback_t> {
public:
CefRegisterCdmCallbackCToCpp();
virtual ~CefRegisterCdmCallbackCToCpp();
// CefRegisterCdmCallback methods.
void OnCdmRegistrationComplete(cef_cdm_registration_error_t result,
const CefString& error_message) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_REGISTER_CDM_CALLBACK_CTOCPP_H_

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b2f22315d4021be203ececa54d5bb8c651f60dfc$
// $hash=232cd54c28334b9a3d98ebfb5a291643f0a7db62$
//
#include "include/capi/cef_app_capi.h"
@@ -47,7 +47,6 @@
#include "libcef_dll/ctocpp/app_ctocpp.h"
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
#include "libcef_dll/ctocpp/end_tracing_callback_ctocpp.h"
#include "libcef_dll/ctocpp/register_cdm_callback_ctocpp.h"
#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h"
#include "libcef_dll/ctocpp/task_ctocpp.h"
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
@@ -892,22 +891,6 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
CefWebPluginUnstableCallbackCToCpp::Wrap(callback));
}
CEF_EXPORT void cef_register_widevine_cdm(
const cef_string_t* path,
struct _cef_register_cdm_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: path; type: string_byref_const
DCHECK(path);
if (!path)
return;
// Unverified params: callback
// Execute
CefRegisterWidevineCdm(CefString(path),
CefRegisterCdmCallbackCToCpp::Wrap(callback));
}
CEF_EXPORT void cef_execute_java_script_with_user_gesture_for_tests(
struct _cef_frame_t* frame,
const cef_string_t* javascript) {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=85426bf2da9016443939636319265fff616f1cb4$
// $hash=01fb8dd98e44b937595c1e1f987f5e4850bff64d$
//
#include <dlfcn.h>
@@ -177,9 +177,6 @@ typedef void (*cef_register_web_plugin_crash_ptr)(const cef_string_t*);
typedef void (*cef_is_web_plugin_unstable_ptr)(
const cef_string_t*,
struct _cef_web_plugin_unstable_callback_t*);
typedef void (*cef_register_widevine_cdm_ptr)(
const cef_string_t*,
struct _cef_register_cdm_callback_t*);
typedef void (*cef_execute_java_script_with_user_gesture_for_tests_ptr)(
struct _cef_frame_t*,
const cef_string_t*);
@@ -570,7 +567,6 @@ struct libcef_pointers {
cef_unregister_internal_web_plugin_ptr cef_unregister_internal_web_plugin;
cef_register_web_plugin_crash_ptr cef_register_web_plugin_crash;
cef_is_web_plugin_unstable_ptr cef_is_web_plugin_unstable;
cef_register_widevine_cdm_ptr cef_register_widevine_cdm;
cef_execute_java_script_with_user_gesture_for_tests_ptr
cef_execute_java_script_with_user_gesture_for_tests;
cef_browser_host_create_browser_ptr cef_browser_host_create_browser;
@@ -787,7 +783,6 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_unregister_internal_web_plugin);
INIT_ENTRY(cef_register_web_plugin_crash);
INIT_ENTRY(cef_is_web_plugin_unstable);
INIT_ENTRY(cef_register_widevine_cdm);
INIT_ENTRY(cef_execute_java_script_with_user_gesture_for_tests);
INIT_ENTRY(cef_browser_host_create_browser);
INIT_ENTRY(cef_browser_host_create_browser_sync);
@@ -1255,12 +1250,6 @@ void cef_is_web_plugin_unstable(
g_libcef_pointers.cef_is_web_plugin_unstable(path, callback);
}
NO_SANITIZE("cfi-icall")
void cef_register_widevine_cdm(const cef_string_t* path,
struct _cef_register_cdm_callback_t* callback) {
g_libcef_pointers.cef_register_widevine_cdm(path, callback);
}
NO_SANITIZE("cfi-icall")
void cef_execute_java_script_with_user_gesture_for_tests(
struct _cef_frame_t* frame,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b43931d8bb81fbfd7a55c011ac6e5b471b3a30ac$
// $hash=7fef7aaa85b96ed7c7fc82542cd393210e1d89ee$
//
#include "include/capi/cef_app_capi.h"
@@ -44,7 +44,6 @@
#include "libcef_dll/cpptoc/app_cpptoc.h"
#include "libcef_dll/cpptoc/completion_callback_cpptoc.h"
#include "libcef_dll/cpptoc/end_tracing_callback_cpptoc.h"
#include "libcef_dll/cpptoc/register_cdm_callback_cpptoc.h"
#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
#include "libcef_dll/cpptoc/task_cpptoc.h"
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
@@ -167,7 +166,7 @@ NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefCrashReportingEnabled() {
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
void CefSetCrashKeyValue(const CefString& key, const CefString& value) {
void CefSetCrashKeyValue(const CefString& key, const CefString& value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: key; type: string_byref_const
@@ -312,10 +311,10 @@ CEF_GLOBAL void CefLoadCRLSetsFile(const CefString& path) {
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
const CefString& target_protocol,
const CefString& target_domain,
bool allow_target_subdomains) {
bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
const CefString& target_protocol,
const CefString& target_domain,
bool allow_target_subdomains) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: source_origin; type: string_byref_const
@@ -339,10 +338,10 @@ CEF_GLOBAL
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
const CefString& target_protocol,
const CefString& target_domain,
bool allow_target_subdomains) {
bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
const CefString& target_protocol,
const CefString& target_domain,
bool allow_target_subdomains) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: source_origin; type: string_byref_const
@@ -403,7 +402,7 @@ CEF_GLOBAL bool CefCreateURL(const CefURLParts& parts, CefString& url) {
NO_SANITIZE("cfi-icall")
CEF_GLOBAL CefString
CefFormatUrlForSecurityDisplay(const CefString& origin_url) {
CefFormatUrlForSecurityDisplay(const CefString& origin_url) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: origin_url; type: string_byref_const
@@ -441,8 +440,8 @@ CEF_GLOBAL CefString CefGetMimeType(const CefString& extension) {
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
void CefGetExtensionsForMimeType(const CefString& mime_type,
std::vector<CefString>& extensions) {
void CefGetExtensionsForMimeType(const CefString& mime_type,
std::vector<CefString>& extensions) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: mime_type; type: string_byref_const
@@ -596,8 +595,8 @@ CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
}
NO_SANITIZE("cfi-icall")
CEF_GLOBAL CefString
CefWriteJSON(CefRefPtr<CefValue> node, cef_json_writer_options_t options) {
CEF_GLOBAL CefString CefWriteJSON(CefRefPtr<CefValue> node,
cef_json_writer_options_t options) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: node; type: refptr_same
@@ -797,7 +796,7 @@ CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name,
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: visitor; type: refptr_diff
@@ -862,23 +861,6 @@ CEF_GLOBAL void CefIsWebPluginUnstable(
path.GetStruct(), CefWebPluginUnstableCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall")
CEF_GLOBAL
void CefRegisterWidevineCdm(const CefString& path,
CefRefPtr<CefRegisterCdmCallback> callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: path; type: string_byref_const
DCHECK(!path.empty());
if (path.empty())
return;
// Unverified params: callback
// Execute
cef_register_widevine_cdm(path.GetStruct(),
CefRegisterCdmCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall")
CEF_GLOBAL void CefExecuteJavaScriptWithUserGestureForTests(
CefRefPtr<CefFrame> frame,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=8b8237eb5b789df29937eaf46a231e0ca83d86c6$
// $hash=abd4c6d471c9ff3d7113b6125a6cfb2a26d58304$
//
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
@@ -101,7 +101,6 @@ enum CefWrapperType {
WT_PRINT_SETTINGS,
WT_PROCESS_MESSAGE,
WT_READ_HANDLER,
WT_REGISTER_CDM_CALLBACK,
WT_REGISTRATION,
WT_RENDER_HANDLER,
WT_RENDER_PROCESS_HANDLER,