OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" | 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const base::FilePath adapter_install_path = | 336 const base::FilePath adapter_install_path = |
337 GetPlatformDirectory(cdm_install_dir) | 337 GetPlatformDirectory(cdm_install_dir) |
338 .AppendASCII(kWidevineCdmAdapterFileName); | 338 .AppendASCII(kWidevineCdmAdapterFileName); |
339 | 339 |
340 const std::string chrome_version = chrome::VersionInfo().Version(); | 340 const std::string chrome_version = chrome::VersionInfo().Version(); |
341 DCHECK(!chrome_version.empty()); | 341 DCHECK(!chrome_version.empty()); |
342 std::string adapter_version; | 342 std::string adapter_version; |
343 if (!base::ReadFileToString(adapter_version_path, &adapter_version) || | 343 if (!base::ReadFileToString(adapter_version_path, &adapter_version) || |
344 adapter_version != chrome_version || | 344 adapter_version != chrome_version || |
345 !base::PathExists(adapter_install_path)) { | 345 !base::PathExists(adapter_install_path)) { |
346 int bytes_written = file_util::WriteFile( | 346 int bytes_written = base::WriteFile( |
347 adapter_version_path, chrome_version.data(), chrome_version.size()); | 347 adapter_version_path, chrome_version.data(), chrome_version.size()); |
348 if (bytes_written < 0 || | 348 if (bytes_written < 0 || |
349 static_cast<size_t>(bytes_written) != chrome_version.size()) { | 349 static_cast<size_t>(bytes_written) != chrome_version.size()) { |
350 DLOG(WARNING) << "Failed to write Widevine CDM adapter version file."; | 350 DLOG(WARNING) << "Failed to write Widevine CDM adapter version file."; |
351 // Ignore version file writing failure and try to copy the CDM adapter. | 351 // Ignore version file writing failure and try to copy the CDM adapter. |
352 } | 352 } |
353 | 353 |
354 base::FilePath adapter_source_path; | 354 base::FilePath adapter_source_path; |
355 PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); | 355 PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); |
356 if (!base::CopyFile(adapter_source_path, adapter_install_path)) { | 356 if (!base::CopyFile(adapter_source_path, adapter_install_path)) { |
(...skipping 24 matching lines...) Expand all Loading... |
381 DefaultComponentInstaller* installer | 381 DefaultComponentInstaller* installer |
382 = new DefaultComponentInstaller(traits.Pass()); | 382 = new DefaultComponentInstaller(traits.Pass()); |
383 installer->Register(cus); | 383 installer->Register(cus); |
384 #else | 384 #else |
385 return; | 385 return; |
386 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 386 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
387 } | 387 } |
388 | 388 |
389 } // namespace component_updater | 389 } // namespace component_updater |
390 | 390 |
OLD | NEW |