Fix Widevine CDM download (issue #1950)

This commit is contained in:
Marshall Greenblatt 2016-07-15 13:14:56 -04:00
parent da265f6a2d
commit 7686007c1a
2 changed files with 14 additions and 9 deletions

View File

@ -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;

View File

@ -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))