mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add Widevine CDM support (issue #1631)
- Windows/Mac: Use `--enable-widevine-cdm` command-line flag to enable download of CDM binaries via the component updater. - Linux: Use `--widevide-cdm-path` and `--widevine-cdm-version` command-line flags to load CDM binaries that already exist on the system. - A cache-path value is usually required when CDM is enabled.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/chrome_browser_process_stub.h"
|
||||
#include "libcef/browser/component_updater/cef_component_updater_configurator.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/trace_subscriber.h"
|
||||
@@ -22,7 +23,11 @@
|
||||
#include "base/debug/debugger.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/component_updater/widevine_cdm_component_installer.h"
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
#include "components/update_client/configurator.h"
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "content/public/app/content_main_runner.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
@@ -330,6 +335,23 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
||||
return trace_subscriber_.get();
|
||||
}
|
||||
|
||||
component_updater::ComponentUpdateService*
|
||||
CefContext::component_updater() {
|
||||
if (!component_updater_.get()) {
|
||||
CEF_REQUIRE_UIT_RETURN(NULL);
|
||||
scoped_refptr<update_client::Configurator> configurator =
|
||||
component_updater::MakeCefComponentUpdaterConfigurator(
|
||||
base::CommandLine::ForCurrentProcess(),
|
||||
CefContentBrowserClient::Get()->browser_context()->
|
||||
request_context().get());
|
||||
// Creating the component updater does not do anything, components
|
||||
// need to be registered and Start() needs to be called.
|
||||
component_updater_.reset(component_updater::ComponentUpdateServiceFactory(
|
||||
configurator).release());
|
||||
}
|
||||
return component_updater_.get();
|
||||
}
|
||||
|
||||
void CefContext::PopulateRequestContextSettings(
|
||||
CefRequestContextSettings* settings) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
@@ -345,12 +367,31 @@ void CefContext::PopulateRequestContextSettings(
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
|
||||
void RegisterComponentsForUpdate() {
|
||||
component_updater::ComponentUpdateService* cus =
|
||||
CefContext::Get()->component_updater();
|
||||
|
||||
// Registration can be before or after cus->Start() so it is ok to post
|
||||
// a task to the UI thread to do registration once you done the necessary
|
||||
// file IO to know you existing component version.
|
||||
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnableWidevineCdm)) {
|
||||
RegisterWidevineCdmComponent(cus);
|
||||
}
|
||||
#endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
|
||||
}
|
||||
|
||||
void CefContext::OnContextInitialized() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Must be created after the NotificationService.
|
||||
print_job_manager_.reset(new printing::PrintJobManager());
|
||||
|
||||
bool io_was_allowed = base::ThreadRestrictions::SetIOAllowed(true);
|
||||
RegisterComponentsForUpdate();
|
||||
base::ThreadRestrictions::SetIOAllowed(io_was_allowed);
|
||||
|
||||
// Notify the handler.
|
||||
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
|
||||
if (app.get()) {
|
||||
|
Reference in New Issue
Block a user