From 7686007c1a72a6405f631353901666f7260d1e01 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 15 Jul 2016 13:14:56 -0400 Subject: [PATCH] Fix Widevine CDM download (issue #1950) --- .../extensions/extensions_browser_client.cc | 2 +- libcef/common/main_delegate.cc | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index f71ccc8d8..37d6830b1 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -119,7 +119,7 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad( // AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out // why permission is not being granted based on "web_accessible_resources" // specified in the PDF extension manifest.json file. - if (extension->id() == extension_misc::kPdfExtensionId) + if (extension && extension->id() == extension_misc::kPdfExtensionId) return true; bool allowed = false; diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 2f221cd6f..f0bb4e096 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -27,6 +27,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "components/component_updater/component_updater_paths.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/render_process_host.h" @@ -559,21 +560,25 @@ void CefMainDelegate::PreSandboxStartup() { false, // May not be an absolute path. true); // Create if necessary. + const base::FilePath& resources_path = GetResourcesFilePath(); + #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) const base::FilePath& widevine_plugin_path = - GetResourcesFilePath().AppendASCII(kWidevineCdmAdapterFileName); + resources_path.AppendASCII(kWidevineCdmAdapterFileName); if (base::PathExists(widevine_plugin_path)) { PathService::Override(chrome::FILE_WIDEVINE_CDM_ADAPTER, widevine_plugin_path); } -#if defined(WIDEVINE_CDM_IS_COMPONENT) - if (command_line->HasSwitch(switches::kEnableWidevineCdm)) { - PathService::Override( - chrome::DIR_COMPONENT_WIDEVINE_CDM, - user_data_path.Append(FILE_PATH_LITERAL("WidevineCDM"))); - } -#endif // defined(WIDEVINE_CDM_IS_COMPONENT) #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) + + // Paths to find pre-installed components. + PathService::Override(chrome::DIR_COMPONENTS, resources_path); + PathService::Override(chrome::DIR_INTERNAL_PLUGINS, resources_path); + + // Register paths to be used by the component updater. + component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS, + chrome::DIR_INTERNAL_PLUGINS, + chrome::DIR_USER_DATA); } if (command_line->HasSwitch(switches::kDisablePackLoading))