| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } else { | 199 } else { |
| 200 DLOG(WARNING) << "Widevine CDM component manifest is missing codecs"; | 200 DLOG(WARNING) << "Widevine CDM component manifest is missing codecs"; |
| 201 } | 201 } |
| 202 return codecs; | 202 return codecs; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void RegisterWidevineCdmWithChrome( | 205 void RegisterWidevineCdmWithChrome( |
| 206 const base::Version& cdm_version, | 206 const base::Version& cdm_version, |
| 207 const base::FilePath& cdm_install_dir, | 207 const base::FilePath& cdm_install_dir, |
| 208 std::unique_ptr<base::DictionaryValue> manifest) { | 208 std::unique_ptr<base::DictionaryValue> manifest) { |
| 209 LOG(WARNING) << __FUNCTION__; |
| 210 |
| 209 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 211 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 210 const std::string codecs = GetCodecs(*manifest); | 212 const std::string codecs = GetCodecs(*manifest); |
| 211 | 213 |
| 212 content::PepperPluginInfo plugin_info; | 214 content::PepperPluginInfo plugin_info; |
| 213 if (!MakeWidevineCdmPluginInfo(cdm_version, cdm_install_dir, codecs, | 215 if (!MakeWidevineCdmPluginInfo(cdm_version, cdm_install_dir, codecs, |
| 214 &plugin_info)) { | 216 &plugin_info)) { |
| 215 return; | 217 return; |
| 216 } | 218 } |
| 217 | 219 |
| 218 // true = Add to beginning of list to override any existing registrations. | 220 // true = Add to beginning of list to override any existing registrations. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 const base::FilePath& install_dir) const { | 312 const base::FilePath& install_dir) const { |
| 311 return IsCompatibleWithChrome(manifest) && | 313 return IsCompatibleWithChrome(manifest) && |
| 312 base::PathExists(GetPlatformDirectory(install_dir) | 314 base::PathExists(GetPlatformDirectory(install_dir) |
| 313 .AppendASCII(kWidevineCdmFileName)); | 315 .AppendASCII(kWidevineCdmFileName)); |
| 314 } | 316 } |
| 315 | 317 |
| 316 // The base directory on Windows looks like: | 318 // The base directory on Windows looks like: |
| 317 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\. | 319 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\. |
| 318 base::FilePath WidevineCdmComponentInstallerTraits::GetRelativeInstallDir() | 320 base::FilePath WidevineCdmComponentInstallerTraits::GetRelativeInstallDir() |
| 319 const { | 321 const { |
| 322 // Add LOG(WARNING) here and below to help investigate http://crbug.com/614745 |
| 323 // TODO(xhwang): Remove LOG(WARNING)s in this file after investigation. |
| 324 LOG(WARNING) << __FUNCTION__; |
| 320 return base::FilePath(FILE_PATH_LITERAL("WidevineCdm")); | 325 return base::FilePath(FILE_PATH_LITERAL("WidevineCdm")); |
| 321 } | 326 } |
| 322 | 327 |
| 323 void WidevineCdmComponentInstallerTraits::GetHash( | 328 void WidevineCdmComponentInstallerTraits::GetHash( |
| 324 std::vector<uint8_t>* hash) const { | 329 std::vector<uint8_t>* hash) const { |
| 325 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); | 330 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); |
| 326 } | 331 } |
| 327 | 332 |
| 328 std::string WidevineCdmComponentInstallerTraits::GetName() const { | 333 std::string WidevineCdmComponentInstallerTraits::GetName() const { |
| 329 return kWidevineCdmDisplayName; | 334 return kWidevineCdmDisplayName; |
| 330 } | 335 } |
| 331 | 336 |
| 332 std::string WidevineCdmComponentInstallerTraits::GetAp() const { | 337 std::string WidevineCdmComponentInstallerTraits::GetAp() const { |
| 333 return std::string(); | 338 return std::string(); |
| 334 } | 339 } |
| 335 | 340 |
| 336 static bool HasValidAdapter(const base::FilePath& adapter_version_path, | 341 static bool HasValidAdapter(const base::FilePath& adapter_version_path, |
| 337 const base::FilePath& adapter_install_path, | 342 const base::FilePath& adapter_install_path, |
| 338 const std::string& chrome_version) { | 343 const std::string& chrome_version) { |
| 339 std::string adapter_version; | 344 std::string adapter_version; |
| 340 return base::ReadFileToString(adapter_version_path, &adapter_version) && | 345 return base::ReadFileToString(adapter_version_path, &adapter_version) && |
| 341 adapter_version == chrome_version && | 346 adapter_version == chrome_version && |
| 342 base::PathExists(adapter_install_path); | 347 base::PathExists(adapter_install_path); |
| 343 } | 348 } |
| 344 | 349 |
| 345 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( | 350 void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( |
| 346 const base::Version& cdm_version, | 351 const base::Version& cdm_version, |
| 347 const base::FilePath& cdm_install_dir, | 352 const base::FilePath& cdm_install_dir, |
| 348 std::unique_ptr<base::DictionaryValue> manifest) { | 353 std::unique_ptr<base::DictionaryValue> manifest) { |
| 354 LOG(WARNING) << __FUNCTION__; |
| 355 |
| 349 const base::FilePath adapter_version_path = | 356 const base::FilePath adapter_version_path = |
| 350 GetPlatformDirectory(cdm_install_dir).AppendASCII(kCdmAdapterVersionName); | 357 GetPlatformDirectory(cdm_install_dir).AppendASCII(kCdmAdapterVersionName); |
| 351 const base::FilePath adapter_install_path = | 358 const base::FilePath adapter_install_path = |
| 352 GetPlatformDirectory(cdm_install_dir) | 359 GetPlatformDirectory(cdm_install_dir) |
| 353 .AppendASCII(kWidevineCdmAdapterFileName); | 360 .AppendASCII(kWidevineCdmAdapterFileName); |
| 354 | 361 |
| 355 VLOG(1) << "UpdateCdmAdapter: version" << cdm_version.GetString() | 362 VLOG(1) << "UpdateCdmAdapter: version" << cdm_version.GetString() |
| 356 << " adapter_install_path=" << adapter_install_path.AsUTF8Unsafe() | 363 << " adapter_install_path=" << adapter_install_path.AsUTF8Unsafe() |
| 357 << " adapter_version_path=" << adapter_version_path.AsUTF8Unsafe(); | 364 << " adapter_version_path=" << adapter_version_path.AsUTF8Unsafe(); |
| 358 | 365 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 std::unique_ptr<ComponentInstallerTraits> traits( | 406 std::unique_ptr<ComponentInstallerTraits> traits( |
| 400 new WidevineCdmComponentInstallerTraits); | 407 new WidevineCdmComponentInstallerTraits); |
| 401 // |cus| will take ownership of |installer| during installer->Register(cus). | 408 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 402 DefaultComponentInstaller* installer = | 409 DefaultComponentInstaller* installer = |
| 403 new DefaultComponentInstaller(std::move(traits)); | 410 new DefaultComponentInstaller(std::move(traits)); |
| 404 installer->Register(cus, base::Closure()); | 411 installer->Register(cus, base::Closure()); |
| 405 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 412 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 406 } | 413 } |
| 407 | 414 |
| 408 } // namespace component_updater | 415 } // namespace component_updater |
| OLD | NEW |