Chromium Code Reviews| Index: chrome/common/chrome_content_client.cc |
| diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc |
| index 4a2456f278f66a9a9ef94f3723c46f458e1cb281..7e28bb0d5d67dfd4689f374b56959fca4c941d80 100644 |
| --- a/chrome/common/chrome_content_client.cc |
| +++ b/chrome/common/chrome_content_client.cc |
| @@ -31,6 +31,7 @@ |
| #include "components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h" |
| #include "components/dom_distiller/core/url_constants.h" |
| #include "components/version_info/version_info.h" |
| +#include "content/public/common/cdm_info.h" |
| #include "content/public/common/content_constants.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/url_constants.h" |
| @@ -98,6 +99,35 @@ content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; |
| content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; |
| #endif |
| +#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT) |
| +static bool IsWidevineAvailable( |
|
ddorwin
2016/03/18 19:24:18
GetWidevine<Something> would be more accurate.
jrummell
2016/03/23 21:38:09
However, the function returns bool to indicate if
|
| + base::FilePath* cdm_adapter_path, |
| + std::vector<base::string16>* codecs_supported, |
|
ddorwin
2016/03/18 19:24:18
Should we really be working in string16 here? I th
jrummell
2016/03/23 21:38:09
Done.
|
| + std::vector<base::string16>* supported_init_data_types) { |
|
ddorwin
2016/03/18 19:24:17
supported_init_data_types is never used. Even with
jrummell
2016/03/23 21:38:09
Removed.
|
| + static bool skip_widevine_cdm_file_check = false; |
| + if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, cdm_adapter_path)) { |
|
ddorwin
2016/03/18 20:38:53
This code will compile on all platforms except Win
ddorwin
2016/03/18 20:48:56
Note that the previous location of this was protec
xhwang
2016/03/18 20:57:58
Note sure if I understand the question completely
ddorwin
2016/03/18 22:22:11
I thought the CDM Registry and related IPCs were g
xhwang
2016/03/18 23:16:02
Agreed that we should unify the two IPC paths. I i
|
| + if (skip_widevine_cdm_file_check || base::PathExists(*cdm_adapter_path)) { |
| + skip_widevine_cdm_file_check = true; |
| + |
| + // Add the supported codecs as if they came from the component manifest. |
| + // This list must match the CDM that is being bundled with Chrome. |
| + codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecVp8)); |
| + codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecVp9)); |
| +#if defined(USE_PROPRIETARY_CODECS) |
| + codecs_supported->push_back(base::ASCIIToUTF16(kCdmSupportedCodecAvc1)); |
| +#endif // defined(USE_PROPRIETARY_CODECS) |
| + |
| + // TODO(crbug.com/469202). Add support for initDataTypes in the component |
| + // manifest, and then duplicate the settings here. |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| +#endif // defined(WIDEVINE_CDM_AVAILABLE) && |
| + // !defined(WIDEVINE_CDM_IS_COMPONENT) |
| + |
| // Appends the known built-in plugins to the given vector. Some built-in |
| // plugins are "internal" which means they are compiled into the Chrome binary, |
| // and some are extra shared libraries distributed with the browser (these are |
| @@ -155,43 +185,31 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { |
| #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ |
| !defined(WIDEVINE_CDM_IS_COMPONENT) |
|
xhwang
2016/03/18 19:35:38
Why remove skip_widevine_cdm_file_check?
jrummell
2016/03/23 21:38:09
It has simply moved to the IsWidevineAvailable() m
|
| - static bool skip_widevine_cdm_file_check = false; |
| - if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { |
| - if (skip_widevine_cdm_file_check || base::PathExists(path)) { |
| - content::PepperPluginInfo widevine_cdm; |
| - widevine_cdm.is_out_of_process = true; |
| - widevine_cdm.path = path; |
| - widevine_cdm.name = kWidevineCdmDisplayName; |
| - widevine_cdm.description = kWidevineCdmDescription + |
| - std::string(" (version: ") + |
| - WIDEVINE_CDM_VERSION_STRING + ")"; |
| - widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; |
| - content::WebPluginMimeType widevine_cdm_mime_type( |
| - kWidevineCdmPluginMimeType, |
| - kWidevineCdmPluginExtension, |
| - kWidevineCdmPluginMimeTypeDescription); |
| - |
| - // Add the supported codecs as if they came from the component manifest. |
| - // This list must match the CDM that is being bundled with Chrome. |
| - std::vector<std::string> codecs; |
| - codecs.push_back(kCdmSupportedCodecVp8); |
| - codecs.push_back(kCdmSupportedCodecVp9); |
| -#if defined(USE_PROPRIETARY_CODECS) |
| - codecs.push_back(kCdmSupportedCodecAvc1); |
| -#endif // defined(USE_PROPRIETARY_CODECS) |
| - std::string codec_string = base::JoinString( |
| - codecs, std::string(1, kCdmSupportedCodecsValueDelimiter)); |
| - widevine_cdm_mime_type.additional_param_names.push_back( |
| - base::ASCIIToUTF16(kCdmSupportedCodecsParamName)); |
| - widevine_cdm_mime_type.additional_param_values.push_back( |
| - base::ASCIIToUTF16(codec_string)); |
| - |
| - widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); |
| - widevine_cdm.permissions = kWidevineCdmPluginPermissions; |
| - plugins->push_back(widevine_cdm); |
| - |
| - skip_widevine_cdm_file_check = true; |
| - } |
| + std::vector<base::string16> codecs_supported; |
| + std::vector<base::string16> supported_init_data_types; |
| + if (IsWidevineAvailable(&path, &codecs_supported, |
| + &supported_init_data_types)) { |
| + content::PepperPluginInfo widevine_cdm; |
| + widevine_cdm.is_out_of_process = true; |
| + widevine_cdm.path = path; |
| + widevine_cdm.name = kWidevineCdmDisplayName; |
| + widevine_cdm.description = kWidevineCdmDescription + |
| + std::string(" (version: ") + |
| + WIDEVINE_CDM_VERSION_STRING + ")"; |
| + widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; |
| + content::WebPluginMimeType widevine_cdm_mime_type( |
| + kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension, |
| + kWidevineCdmPluginMimeTypeDescription); |
| + |
| + widevine_cdm_mime_type.additional_param_names.push_back( |
| + base::ASCIIToUTF16(kCdmSupportedCodecsParamName)); |
| + widevine_cdm_mime_type.additional_param_values.push_back(base::JoinString( |
| + codecs_supported, |
| + base::ASCIIToUTF16(std::string(1, kCdmSupportedCodecsValueDelimiter)))); |
| + |
| + widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); |
| + widevine_cdm.permissions = kWidevineCdmPluginPermissions; |
| + plugins->push_back(widevine_cdm); |
| } |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && |
| // !defined(WIDEVINE_CDM_IS_COMPONENT) |
| @@ -520,6 +538,26 @@ void ChromeContentClient::AddPepperPlugins( |
| #endif // defined(ENABLE_PLUGINS) |
| } |
| +void ChromeContentClient::AddContentDecryptionModules( |
|
ddorwin
2016/03/18 20:38:53
I think you need to put all this code in a separat
jrummell
2016/03/23 21:38:09
Added RegisterAllAvailableCdms() that will call Ad
|
| + std::vector<content::CdmInfo>* modules) { |
| +#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT) |
| + base::FilePath widevine_adapter_path; |
| + std::vector<base::string16> codecs_supported; |
| + std::vector<base::string16> supported_init_data_types; |
| + if (IsWidevineAvailable(&widevine_adapter_path, &codecs_supported, |
| + &supported_init_data_types)) { |
| + // |key_systems| needs |path| to be the actual Widevine library, |
| + // not the adapter, so adjust as necessary. It will be in the |
| + // same directory as the installed adapter. |
| + modules->push_back(content::CdmInfo( |
| + kWidevineKeySystem, WIDEVINE_CDM_VERSION_STRING, |
| + widevine_adapter_path.DirName().AppendASCII(kWidevineCdmFileName), |
|
ddorwin
2016/03/18 19:24:17
This line should be a separate statement under the
jrummell
2016/03/23 21:38:09
Done.
|
| + codecs_supported, supported_init_data_types)); |
| + } |
| +#endif // defined(WIDEVINE_CDM_AVAILABLE) && |
| + // !defined(WIDEVINE_CDM_IS_COMPONENT) |
| +} |
|
ddorwin
2016/03/18 19:24:18
TODO: Add ECK?
jrummell
2016/03/23 21:38:09
Done.
|
| + |
| #if defined(OS_CHROMEOS) |
| static const int kNumChromeStandardURLSchemes = 6; |
| #else |