| Index: chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
| diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
| index 60382d1bc813f79fb79547a380f43ce6d2cb1302..b57b354d93115de07b6205eea312fafeadeb0ce4 100644
|
| --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
| +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
| @@ -14,6 +14,8 @@
|
| #include "base/file_util.h"
|
| #include "base/files/file_path.h"
|
| #include "base/path_service.h"
|
| +#include "base/strings/string16.h"
|
| +#include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "build/build_config.h"
|
| #include "chrome/browser/component_updater/component_updater_service.h"
|
| @@ -75,9 +77,12 @@ base::FilePath GetPlatformDirectory(const base::FilePath& base_path) {
|
| return base_path.AppendASCII("_platform_specific").AppendASCII(platform_arch);
|
| }
|
|
|
| -bool MakeWidevineCdmPluginInfo(const base::FilePath& path,
|
| - const base::Version& version,
|
| - content::PepperPluginInfo* plugin_info) {
|
| +bool MakeWidevineCdmPluginInfo(
|
| + const base::Version& version,
|
| + const base::FilePath& path,
|
| + const std::vector<base::string16>& additional_param_names,
|
| + const std::vector<base::string16>& additional_param_values,
|
| + content::PepperPluginInfo* plugin_info) {
|
| if (!version.IsValid() ||
|
| version.components().size() !=
|
| static_cast<size_t>(kWidevineCdmVersionNumComponents)) {
|
| @@ -95,19 +100,46 @@ bool MakeWidevineCdmPluginInfo(const base::FilePath& path,
|
| kWidevineCdmPluginMimeType,
|
| kWidevineCdmPluginExtension,
|
| kWidevineCdmPluginMimeTypeDescription);
|
| + widevine_cdm_mime_type.additional_param_names = additional_param_names;
|
| + widevine_cdm_mime_type.additional_param_values = additional_param_values;
|
| plugin_info->mime_types.push_back(widevine_cdm_mime_type);
|
| plugin_info->permissions = kWidevineCdmPluginPermissions;
|
|
|
| return true;
|
| }
|
|
|
| -void RegisterWidevineCdmWithChrome(const base::FilePath& path,
|
| - const base::Version& version) {
|
| +void GetAdditionalParams(const base::DictionaryValue& manifest,
|
| + std::vector<base::string16>* additional_param_names,
|
| + std::vector<base::string16>* additional_param_values) {
|
| + base::string16 codecs;
|
| + if (manifest.GetString("x-cdm-codecs", &codecs)) {
|
| + DLOG_IF(WARNING, codecs.empty())
|
| + << "Widevine CDM component manifest has empty codecs list";
|
| + additional_param_names->push_back(base::ASCIIToUTF16("codecs"));
|
| + additional_param_values->push_back(codecs);
|
| + } else {
|
| + DLOG(WARNING) << "Widevine CDM component manifest is missing 'codecs'";
|
| + }
|
| +}
|
| +
|
| +void RegisterWidevineCdmWithChrome(const base::Version& version,
|
| + const base::FilePath& path,
|
| + scoped_ptr<base::DictionaryValue> manifest) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + std::vector<base::string16> additional_param_names;
|
| + std::vector<base::string16> additional_param_values;
|
| + GetAdditionalParams(
|
| + *manifest, &additional_param_names, &additional_param_values);
|
| content::PepperPluginInfo plugin_info;
|
| - if (!MakeWidevineCdmPluginInfo(path, version, &plugin_info))
|
| + if (!MakeWidevineCdmPluginInfo(version,
|
| + path,
|
| + additional_param_names,
|
| + additional_param_values,
|
| + &plugin_info)) {
|
| return;
|
| + }
|
|
|
| + // true = Add to beginning of list to override any existing registrations.
|
| PluginService::GetInstance()->RegisterInternalPlugin(
|
| plugin_info.ToWebPluginInfo(), true);
|
| PluginService::GetInstance()->RefreshPlugins();
|
| @@ -127,8 +159,10 @@ class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits {
|
| const base::FilePath& install_dir) OVERRIDE;
|
| virtual bool VerifyInstallation(
|
| const base::FilePath& install_dir) const OVERRIDE;
|
| - virtual void ComponentReady(const base::Version& version,
|
| - const base::FilePath& path) OVERRIDE;
|
| + virtual void ComponentReady(
|
| + const base::Version& version,
|
| + const base::FilePath& path,
|
| + scoped_ptr<base::DictionaryValue> manifest) OVERRIDE;
|
| virtual base::FilePath GetBaseDirectory() const OVERRIDE;
|
| virtual void GetHash(std::vector<uint8>* hash) const OVERRIDE;
|
| virtual std::string GetName() const OVERRIDE;
|
| @@ -156,11 +190,14 @@ bool WidevineCdmComponentInstallerTraits::OnCustomInstall(
|
| // Once the component is installed, register the new version with Chrome.
|
| void WidevineCdmComponentInstallerTraits::ComponentReady(
|
| const base::Version& version,
|
| - const base::FilePath& path) {
|
| + const base::FilePath& path,
|
| + scoped_ptr<base::DictionaryValue> manifest) {
|
| + // TODO(ddorwin): Check API version compatibility. Return if fails.
|
| base::FilePath adapter_install_path = GetPlatformDirectory(path)
|
| .AppendASCII(kWidevineCdmAdapterFileName);
|
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
|
| - &RegisterWidevineCdmWithChrome, adapter_install_path, version));
|
| + &RegisterWidevineCdmWithChrome,
|
| + version, adapter_install_path, base::Passed(&manifest)));
|
| }
|
|
|
| bool WidevineCdmComponentInstallerTraits::VerifyInstallation(
|
|
|