Chromium Code Reviews| 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 4279e0b95beab98918ad408a53e01a91accea26a..d2d98b0cb49762cf08de0981de7a580db4e81e67 100644 |
| --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc |
| +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc |
| @@ -347,12 +347,20 @@ void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( |
| << " adapter_install_path=" << adapter_install_path.AsUTF8Unsafe() |
| << " adapter_version_path=" << adapter_version_path.AsUTF8Unsafe(); |
| + base::FilePath adapter_source_path; |
| + PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); |
| + |
| const std::string chrome_version = version_info::GetVersionNumber(); |
| DCHECK(!chrome_version.empty()); |
| std::string adapter_version; |
| - if (!base::ReadFileToString(adapter_version_path, &adapter_version) || |
| - adapter_version != chrome_version || |
| - !base::PathExists(adapter_install_path)) { |
| + |
| + // If we are not using bundled CDM, then we need to verify whether we have |
| + // the correct CDM adapter. If not, copy the CDM adapter from |
| + // |adapter_source_path| to |adapter_install_path|. |
| + if (adapter_install_path != adapter_source_path && |
| + (!base::ReadFileToString(adapter_version_path, &adapter_version) || |
|
Lei Zhang
2016/05/20 23:54:28
Maybe break this off into: AdapterVersionMatchesCh
xhwang
2016/05/21 00:25:57
Done.
|
| + adapter_version != chrome_version || |
| + !base::PathExists(adapter_install_path))) { |
| int bytes_written = base::WriteFile( |
| adapter_version_path, chrome_version.data(), chrome_version.size()); |
| if (bytes_written < 0 || |
| @@ -361,8 +369,6 @@ void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( |
| // Ignore version file writing failure and try to copy the CDM adapter. |
| } |
| - base::FilePath adapter_source_path; |
| - PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); |
| if (!base::CopyFile(adapter_source_path, adapter_install_path)) { |
| PLOG(WARNING) << "Failed to copy Widevine CDM adapter."; |
| return; |