| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 bool CanAutoUpdate() const override; | 245 bool CanAutoUpdate() const override; |
| 246 bool RequiresNetworkEncryption() const override; | 246 bool RequiresNetworkEncryption() const override; |
| 247 bool OnCustomInstall(const base::DictionaryValue& manifest, | 247 bool OnCustomInstall(const base::DictionaryValue& manifest, |
| 248 const base::FilePath& install_dir) override; | 248 const base::FilePath& install_dir) override; |
| 249 bool VerifyInstallation( | 249 bool VerifyInstallation( |
| 250 const base::DictionaryValue& manifest, | 250 const base::DictionaryValue& manifest, |
| 251 const base::FilePath& install_dir) const override; | 251 const base::FilePath& install_dir) const override; |
| 252 void ComponentReady(const base::Version& version, | 252 void ComponentReady(const base::Version& version, |
| 253 const base::FilePath& path, | 253 const base::FilePath& path, |
| 254 std::unique_ptr<base::DictionaryValue> manifest) override; | 254 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 255 base::FilePath GetBaseDirectory() const override; | 255 base::FilePath GetRelativeInstallDir() const override; |
| 256 void GetHash(std::vector<uint8_t>* hash) const override; | 256 void GetHash(std::vector<uint8_t>* hash) const override; |
| 257 std::string GetName() const override; | 257 std::string GetName() const override; |
| 258 std::string GetAp() const override; | 258 std::string GetAp() const override; |
| 259 | 259 |
| 260 // Checks and updates CDM adapter if necessary to make sure the latest CDM | 260 // Checks and updates CDM adapter if necessary to make sure the latest CDM |
| 261 // adapter is always used. | 261 // adapter is always used. |
| 262 // Note: The component is ready when CDM is present, but the CDM won't be | 262 // Note: The component is ready when CDM is present, but the CDM won't be |
| 263 // registered until the adapter is copied by this function (see | 263 // registered until the adapter is copied by this function (see |
| 264 // VerifyInstallation). | 264 // VerifyInstallation). |
| 265 void UpdateCdmAdapter(const base::Version& cdm_version, | 265 void UpdateCdmAdapter(const base::Version& cdm_version, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 bool WidevineCdmComponentInstallerTraits::VerifyInstallation( | 308 bool WidevineCdmComponentInstallerTraits::VerifyInstallation( |
| 309 const base::DictionaryValue& manifest, | 309 const base::DictionaryValue& manifest, |
| 310 const base::FilePath& install_dir) const { | 310 const base::FilePath& install_dir) const { |
| 311 return IsCompatibleWithChrome(manifest) && | 311 return IsCompatibleWithChrome(manifest) && |
| 312 base::PathExists(GetPlatformDirectory(install_dir) | 312 base::PathExists(GetPlatformDirectory(install_dir) |
| 313 .AppendASCII(kWidevineCdmFileName)); | 313 .AppendASCII(kWidevineCdmFileName)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // The base directory on Windows looks like: | 316 // The base directory on Windows looks like: |
| 317 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\. | 317 // <profile>\AppData\Local\Google\Chrome\User Data\WidevineCdm\. |
| 318 base::FilePath WidevineCdmComponentInstallerTraits::GetBaseDirectory() const { | 318 base::FilePath WidevineCdmComponentInstallerTraits::GetRelativeInstallDir() |
| 319 base::FilePath result; | 319 const { |
| 320 PathService::Get(chrome::DIR_COMPONENT_WIDEVINE_CDM, &result); | 320 return base::FilePath(FILE_PATH_LITERAL("WidevineCdm")); |
| 321 return result; | |
| 322 } | 321 } |
| 323 | 322 |
| 324 void WidevineCdmComponentInstallerTraits::GetHash( | 323 void WidevineCdmComponentInstallerTraits::GetHash( |
| 325 std::vector<uint8_t>* hash) const { | 324 std::vector<uint8_t>* hash) const { |
| 326 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); | 325 hash->assign(kSha2Hash, kSha2Hash + arraysize(kSha2Hash)); |
| 327 } | 326 } |
| 328 | 327 |
| 329 std::string WidevineCdmComponentInstallerTraits::GetName() const { | 328 std::string WidevineCdmComponentInstallerTraits::GetName() const { |
| 330 return kWidevineCdmDisplayName; | 329 return kWidevineCdmDisplayName; |
| 331 } | 330 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 std::unique_ptr<ComponentInstallerTraits> traits( | 386 std::unique_ptr<ComponentInstallerTraits> traits( |
| 388 new WidevineCdmComponentInstallerTraits); | 387 new WidevineCdmComponentInstallerTraits); |
| 389 // |cus| will take ownership of |installer| during installer->Register(cus). | 388 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 390 DefaultComponentInstaller* installer = | 389 DefaultComponentInstaller* installer = |
| 391 new DefaultComponentInstaller(std::move(traits)); | 390 new DefaultComponentInstaller(std::move(traits)); |
| 392 installer->Register(cus, base::Closure()); | 391 installer->Register(cus, base::Closure()); |
| 393 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 392 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 394 } | 393 } |
| 395 | 394 |
| 396 } // namespace component_updater | 395 } // namespace component_updater |
| OLD | NEW |